40上机模拟试题答案.docx
- 文档编号:23145145
- 上传时间:2023-05-08
- 格式:DOCX
- 页数:35
- 大小:20.48KB
40上机模拟试题答案.docx
《40上机模拟试题答案.docx》由会员分享,可在线阅读,更多相关《40上机模拟试题答案.docx(35页珍藏版)》请在冰豆网上搜索。
40上机模拟试题答案
1~40套模拟试题的简单应用和综合应用的答案
一:
2
(1):
indexnn+2nf1
2
(2):
ss,s1<>str(n)
3:
PrivateSubC1_Click()
DimxAsInteger
x=17999
DoWhilex<18000
Ifisprime(x)ThenExitDo
x=x-1
Loop
Text1.Text=Str(x)
EndSub
PrivateSubC2_Click()
OpenApp.Path&"\out5.txt"ForOutputAs1
Print#1,Text1.Text
Close1
EndSub
二:
2
(1):
check1.value“”“#”text2.text
2
(2):
5xstr(x)>
3:
DimiAsInteger,jAsInteger,nAsInteger
Fori=1To7
Forj=1To7
Ifi=1Ori=7Orj=1Orj=7Then
Sum=Sum+a(i,j)
Ifa(i,j)Mod7=0Thenn=n+1
EndIf
Nextj
Nexti
lblFirst.Caption=Str(n)
lblSecond.Caption=Str(Sum)
三:
2
(1):
<>ornum>
2
(2):
Avgis>=85is>=60endselectn-1
3:
Dimb(20)AsSingle,iAsInteger,jAsInteger
DimmaxAsInteger
Fori=1To20
Forj=1To5
b(i)=b(i)+a(i,j)
Nextj
b(i)=b(i)/5
Nexti
max=b
(1)
Fori=2To20
Ifmax
Nexti
Text2.Text=Str(max)
四:
2
(1):
trueabcnform1form2
2
(2):
0sellengthttext2.text
3:
Fork=1To100
Ifa(k)Mod3=0Then
num=num+1
b(num)=a(k)
EndIf
Nextk
Fori=1Tonum-1
Forj=i+1Tonum
Ifb(i)>b(j)Then
t=b(i)
b(i)=b(j)
b(j)=t
EndIf
Nextj
Nexti
五:
2
(1):
>x 2 (2): list1,list2l1.textl1.listindexlist1.listcount-1 3: Fori=1Ton Forj=1Ton Ifi=jOri+j=8Then Ifa(i,j)Mod3=0ThenCounter=Counter+1 EndIf Ifi=jThenSum=Sum+a(i,j) Nextj Nexti lblFirst.Caption=Str(Counter) lblSecond.Caption=Str(Sum) 六: 2 (1): 2trueflag 2 (2): 0sellengthttext2.text 3: Fork=1To100 Fori=2Toa(k)-1 Ifa(k)Modi=0ThenExitFor Nexti Ifi=a(k)Then num=num+1 b(num)=a(k) EndIf Nextk 七: 2 (1): trueheightfalse 2 (2): tmp*atmpxn(t,i)str(z) 3: DimiAsInteger,minAsInteger Dimb(40)AsInteger,nAsInteger Fori=1To40 Ifprime(arr(i))Then n=n+1 b(n)=arr(i) EndIf Nexti min=b (1) Fori=2Ton Ifmin>b(i)Thenmin=b(i) Nexti Label3.Caption=Str(n) Label4.Caption=Str(min) 八: 2 (1): lenascb2x(i).caption 2 (2): la.listcountlala 3: eof (1)str(a(i)) DimiAsInteger,jAsInteger,tAsInteger Fori=1To9 Forj=i+1To10 Ifa(i)>a(j)Then t=a(i) a(i)=a(j) a(j)=t EndIf Nextj NextI 九: 2 (1): command1label1controllabel2.caption 2 (2): falsetrue80 3: b(i)=a(i,1) c(i)=1 Forj=2To5 Ifb(i) b(i)=a(i,j) c(i)=j EndIf Nextj 十: 2 (1): true+- 2 (2): 1> 3: DimiAsInteger,jAsInteger DimsAsLong,minAsInteger Fori=1To20 min=a(i,1) Forj=2To5 Ifmin>a(i,j)Thenmin=a(i,j) Nextj s=s+min Nexti s=s/20 Text2.Text=Str(s) 十一: 2 (1): Dimb(100)AsInteger,nAsInteger DimiAsInteger,maxAsInteger,minAsInteger Fori=1To100 Ifisnarc(a(i))Then n=n+1 b(n)=a(i) EndIf Nexti max=b (1) min=b (1) Fori=2Ton Ifmax Ifmin>b(i)Thenmin=b(i) Nexti Text1.Text=Str(max) Text2.Text=Str(min) 2 (2): DimnAsInteger,iAsInteger DimsAsLong n=Val(cb1.Text) Fori=1To5000 IfiModn=0Thens=s+i Nexti Text1.Text=Str(s) 3: Dims1AsInteger,s2AsInteger,s3AsInteger DimiAsInteger,maxAsInteger,aAsString Fori=1ToLen(s) a=Mid(s,i,1) Ifa=""Ori=Len(s)Then s2=s2+1 Ifs3>maxThenmax=s3 s3=0 Else s1=s1+1 s3=s3+1 EndIf Nexti Text1.Text=CInt(s1/s2) Text2.Text=max 十二: 2 (1): 1text1.textcommand1.enabled=true 2 (2): List1.List(List1.ListCount-2)bc 3: Dimb(5)AsInteger,c(5)AsSingle DimiAsInteger,jAsInteger,nAsInteger Fori=1To5 n=0 Forj=1To40 Ifa(i,j)<50Then b(i)=b(i)+a(i,j) n=n+1 EndIf Nextj c(i)=b(i)/n Label1(i-1).Caption=Str(b(i)) Text2(i-1).Text=Str(Int(c(i)*100+0.5)/100) NextI 十三: 2 (1): “A”+n%a 2 (2): sf=10(s-4)*1.2(15-4)*1.2 3: Dima(26)AsInteger,maxAsInteger,iAsInteger DimmAsString,nAsInteger Fori=1ToLen(s) m=UCase(Mid(s,i,1)) Ifm>="A"Andm<="Z"Then n=Asc(m)-Asc("A")+1 a(n)=a(n)+1 EndIf Nexti max=a (1) Fori=2To26 Ifmax Nexti Fori=1To26 Ifa(i)=maxThen Text1.Text=Text1.Text&Chr(Asc("A")+i-1) EndIf Nexti Text2.Text=Str(max) 十四: 2 (1): truetimer1.interval=2000a0 2 (2): list1.clear0list1.list(k)ktext2.text 3: DimiAsInteger,jAsInteger DimmaxAsInteger,avgAsSingle,nAsInteger Fori=1To5 max=0: avg=0: n=0 Forj=1To40 Ifa(i,j)Mod2=0Then
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 40 上机 模拟 试题答案
![提示](https://static.bdocx.com/images/bang_tan.gif)