Private Sub Command1_Click( )
Dim x As Integer,y As Integer
x = 8
y = 10^x
Text1.Text = Str(y)
End Sub
运行程序时,单击Command1后弹出如上图所示的出错提示,引起该错误的原因是( )

Private Function f(x As Single, n As Integer) As Single
If n =0 Then
f =1
Else
If n Mod 2 =1 Then
f=x * f(x, n\2)
Else
f=f(x, n\2) \x
End If
End If
End Function
Private Sub Command1_Click()
Label1.Caption=Str(f(4, 6))
End Sub
程序运行时,单击按钮Command1,标签Label1显示的内容是( )

方框中的代码由以下三部分组成:①s=s+Mid(s1,x,1)②x=Int(Rnd*n)+1 ③s1=Mid(s1,1,x-1)+Mid(s1,x+1)。代码顺序正确的选项是( )
Dim conn As New ADODB. Connection
Dim rs As New ADODB. Recordset
Dim n as Integer
Private Sub Form_ Load()
conn. ConnectionString ="Provider= Microsoft.Ace.
OLEDB.12.0; data source ="+App. Path+"\data\data. accdb"
conn. Open
sql="select*from student"
Set rs. ActiveConnection=conn
rs. Open sql
n=0
Do while Not rs. EOF
List1.AddItem rs("name")
n=n+1
rs. MoveNext
Loop
End Sub
运行上述程序,以下说法不正确的是( )
Dim a(0 To 9)As Integer
Dim t As Long
t=Val(Text1.Text):x=0
Do While t>0
a(t Mod 10)=1
t=t\10
Loop
For i=0 To 9
x=x+a(i)
Next i
若在文本框Text1中输入380305220,则程序执行后,变量x的值为( )
n=Len(Text1.Text):c=1
For i=1 To n
s=Mid(Text1.Text,i,1)
If s>="0"And s<="1"Then
a(c)=a(c)*2+Val(s)
Else
If a(c)>0 Then c=c+1
End If
Next i
在文本框Text1中输入“A:1010 C:1100 E:1110”。执行该程序后,数组a(2)中的元素值为( )
Dim a(1 to 6) As Integer, i As Integer
For i=1 To 6
a(i)=Int(Rnd*4)*2+1
If i Mod 2=1 Then a(i)=a(i) * 2 Else a(i)=a(i)+a(i-1)
Next i
最终a数组各元素的值可能是( )
S=0
for i in range(101):
s+=i
print("s=",s)
循环变量i的终值是( )
s =0
for i in range(1,4):
for j in range(1,6):
s=s+i
print(s)
ans=0
n = Va1 (Text1. Text)
For i=1 To n\2
t=n:x=i
Do While t>0
Loop
Next i
Text2.Text = Str (ans)
方框中的代码由以下三部分组成:
①If t=0 Then ans=ans+1 ②t=t-x③x=x+1
下列选项中,代码顺序正确的是( )
请回答下列问题:
Const n=40
Const k=5
Dim f(1 To 500)As String
Dim sum As Integer
Private Sub Form_Load()
'读取sum张纸的信息,存入到数组f并显示在列表框List1中,代码略
End Sub
Private Sub Command1_Click()
Dim i As Integer,j As Integer,t As Integer,tmp As Integer
Dim a(500)As Integer,b(500)As Integer
Dim c(500)As Integer,d(500)As Integer
'读取每张纸信息,将页码存入到a数组中,活页本编号存入到b数组中
For i=1 To sum
a(i)=Val(Mid(f(i),4))
b(i)=
Next i
For i=1 To sum-1 '对每一页先按照活页本编号、再按照页码从小到大排序
t=i
For j=i+1 To sum
If
Then t=j
Next j
tmp=a(i):a(i)=a(t):a(t)=tmp
tmp=b(i):b(i)=b(t):b(t)=tmp
Next i
c(1)=a(1) '对于每个奇数位i,c(i)与c(i+1)分别存储连续页码的起始编号和结尾编号
d(1)=b(1)
s=1
t=a(1)
For i=2 To sum
If b(i)=b(i-1)And t+1=a(i)Then
Else
c(s*2)=t
s=s+1
=a(i)
d(s)=b(i)
t=a(i)
End If
Next i
c(s*2)=t
List2.AddItem "第1本书:"
List2.AddItem Str(c(1))+"-"+Str(c(2))
For i=2 To s
If d(i)<>d(i-1)Then List2.AddItem"第"+Str(d(i))+"本书:"
List2.AddItem Str(c(2*i-1))+"-"+Str(c(2*i))
Next i
End Sub
|
m = 1 n = 0 for i in range(3): m += 1 for j in range(5): n += 1 print(m, n) |
运行结果是:
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_excel("成绩表.xlsx")
print(df1)
划线处的代码应为 (单选,填字母)
请在划线处填写合适的代码。
num=int(input("请输入小组:"))
plt.figure(figsize=(10,5))
list=[]
for i in range(12):
s="题"+str(i+1)
list.append(df1.at[num,s]*50)
plt.bar(range(1,13),list)
plt.title(str(num)+" ")
plt.xlabel("question number")
plt.ylabel("correct rate")
plt.show()
y=0
for i in [1,2,3,4,5]:
x=int(input(“x=”))
y=y+x
print(y)
从键盘依次输入10、20、30、40、50
Dim s1 As String, s2 As String, n As Integer, t As Integer
Dim a(128) As Integer
s1 = Text1. Text : n = Len(s1)
s2 =""
For i=1 To n
t = Asc(Mid(s1, i, 1))
a(t)=a(t)+1
Next i
For i=1 To 128
Do While a(i)> 0
s2 = s2 + Chr(i)
a(i)=a(i)-1
Loop
Next i
Text2.Text = Mid(s2,5,1)
若Text1中输入的字符串为“He1lo535Study" (不包括引号) ,运行上述程序后,Text2中显示的结果为( )