上机模拟考试习题集0150解答文档格式.docx
《上机模拟考试习题集0150解答文档格式.docx》由会员分享,可在线阅读,更多相关《上机模拟考试习题集0150解答文档格式.docx(76页珍藏版)》请在冰豆网上搜索。
End
3.综合应用
a(i)=Fix(Rnd*?
+1)其中?
100
Forj=1To?
i-1
i=?
Ifa(i)=?
Then其中?
num
If?
>
10Then其中?
1.2上机模拟试题2解答
PrivateSubHS1_Change()
Text1.Width=HS1.Value
(1)
While(k<
List2.?
)其中?
ListCount
.Selected(k)=TrueThen中?
List2
List2.RemoveItem?
k
List1.RemoveItemList1.?
List1.ListIndex
PrivateSubC1_Click()
Fori=0To2
IfOp1(i).Value=TrueThen
n=Left(Op1(i).Caption,2)
t=1
Forj=1Ton
t=t*j
Nextj
Text1=t
CD1.FilterIndex=?
2
Text1.Text=?
a
CD1.Action=?
程序代码如下:
PrivateSubC2_Click()
Text1.Text=UCase(Text1.Text)
1.3上机模拟试题3解答
Text2.Text=Text1.Text
S1=?
Text1.Text
DoWhileMid(S1,I1,1)<
>
AndI1<
=Len(S1)其中?
List1.AddItem?
S2
S2=?
Fori=?
ToCb1.ListCount-1其中?
IfCb1.List(i)=Cb1.?
Text
Cb1.?
Cb1.Text其中?
AddItem
PrivateSubForm_Load()
DimstrAsString
OpenApp.Path+"
\in5.txt"
ForInputAs#1
DoWhileNotEOF
(1)
Input#1,str
Text1.Text=Text1.Text+str
Loop
Close#1
\out5.txt"
ForOutputAs#2
Print#2,Text1.Text
Close#2
1.4上机模拟试题4解答
Shape1.Shape=3
Shape1.BorderColor=&
HFF&
SelectCase?
Index
Timer1.Enabled=?
True
IfPicture1.Left+Picture1.Width>
=?
Form2.Width
Picture1.Left=?
=TrueThen其中?
Option1.Value=True
Option3.Value=True
Label2.Caption=?
s
'
====考生编写程序开始====
DimiAsInteger,jAsInteger,maxAsInteger
max=a(1,1)
Fori=1To4
Forj=1To4
Ifmax<
a(i,j)Thenmax=a(i,j)
Label3.Caption=max
====考生编写程序结束====
不得修改以下部分
saveLabel3
DimiAsInteger,jAsInteger,sumAsInteger
sum=0
Ifi=jThensum=sum+a(i,j)
Label4.Caption=sum
saveLabel4
1.5上机模拟试题5解答
Timer1.Enabled=True
Timer1.Enabled=False
PrivateSubCommand3_Click()
Callsub1
PrivateSubTimer1_Timer()
Text1.Text=Text1.Text+1
EndSub2.
简单操作
Fori=1To?
5
2*i-1
i+1
9-2*i
=False其中?
Timer1.Enabled
Shape2.Top=?
+d*50其中?
Shape2.Top
IfShape2.Top<
=Shape1.?
OrShape2.Top+Shape2.Width>
=Shape1.Top+Shape1.HeightThen其中?
Top
Shape2.Left=?
Shape2.Left
n=n+?
1
ch$
需要考生编写的内容
DimxAsSingle,pAsSingle
x=Val(Text1.Text)
Ifx<
500Then
p=1
ElseIfx<
1000Then
p=0.98
1500Then
p=0.95
2000Then
p=0.92
Else
p=0.9
Text2.Text=CStr(Int(x*0.3*p))
PrivateSubList1_Click()
DimiAsInteger
Fori=0ToList1.ListCount-1
IfList1.Selected(i)=TrueThen
Text1.Text=CStr(a(i+1))
1.6上机模拟试题6解答
Command1.Width=Command1.Width+100
PrivateSubL1_Click()
Shape1.Shape=Val(L1.List(L1.ListIndex))
Call?
calc(i)
Option1(i).Caption
x=?
Text1
IfiMod2?
<
Label3.Caption=?
result
Timer1.Enabled=?
False
Timer1.Interval=?
500
IfPicture1.Left>
Form1.Width
========考生编写程序开始========
DimiAsInteger,N1AsInteger,N2AsInteger,avgAsSingle,sumAsSingle
Fori=1Ton
Ifarr(i)>
=60Then
N1=N1+1
N2=N2+1
sum=sum+arr(i)
avg=sum
Text1.Text=CStr(n)
Text2.Text=CStr(CInt(avg/n))
Text3.Text=CStr(N1)
Text4.Text=CStr(N2)
==========考生编写程序结束==============
1.7上机模拟试题7解答
PrivateSubT1_Change()
T2.Text=T1.Text
EndSub
Text1.Left=0
L1.?
L1.RemoveItem?
L1.ListIndex
IfOp1=TrueThenText1="
需要1小时"
IfOp2=TrueThenText1="
需要10小时"
IfOp3=TrueThenText1="
需要15小时"
考生应完成的程序
DimiAsInteger,sumAsInteger,avgAsSingle,tem1AsInteger,tem2AsInteger,tem3AsInteger
DimstrAsString,nAsInteger
str=CStr(a(i))
tem1=Val(Mid(str,1,1))
tem2=Val(Mid(str,2,1))
tem3=Val(Mid(str,3,1))
Iftem1^3+tem2^3+tem3^3=a(i)Then
sum=sum+a(i)
n=n+1
avg=Int(sum/n)
Text1.Text=CStr(avg)
1.8上机模拟试题8解答
PrivateSubHScroll1_Change()
Text1.Text=HScroll1.Value
PrivateSubHScroll1_Scroll()
EndSub2.简单操作
IfShape1.Top<
Line1.Y1
IfShape1.Top+?
=Line2.Y1Then其中?
Shape1.Height
考生编写
DimiAsInteger,javgAsSingle,oavgAsSingle,avgAsSingle
Dimn1AsInteger,n2AsInteger
Ifa(i)Mod2=0Then
oavg=oavg+a(i)
n1=n1+1
javg=javg+a(i)
n2=n2+1
avg=avg+a(i)
oavg=CInt(oavg/n1)
javg=CInt(oavg/n2)
avg=CInt(avg/100)
IfCombo1.Text="
所有偶数"
Then
Text1.Text=CStr(oavg)
ElseIfCombo1.Text="
所有奇数"
Text1.Text=CStr(javg)
Dim?
mat(M,N)
OpenApp.Path&
\"
&
datain.txt"
As#1其中?
ForInput
Input#1,mat(i,j)
mat(i,4)=t
1.9上机模拟试题9解答
Image1.Picture=LoadPicture(App.Path+"
\Misc34.ico"
\Misc37.ico"
Image1.Picture=LoadPicture("
Fork=1To?
<
Val(Text1(k).Text)Then其中?
s=(s-a-b)/?
4
s=?
*3*Val(Text2.Text)其中?
=Int(s*100)/100其中?
Text3
(2)程序代码如下:
需考生编写的程序
DimiAsInteger,jAsInteger,sumAsLong,mulAsLong
sum=0:
mul=1
IfOption1.Value=TrueThen
mul=mul*i
Text1.Text=CStr(mul)
Else
sum=sum+j
Text1.Text=CStr(sum)
EndIf
Text4=Text4&
a&
b
a=?
Ifk<
n
=d其中?
1.10上机模拟试题10解答
PrivateSubForm_Click()
Label1.Top=0
Label1.Left=Form1.Width-Label1.Width
arrN(i)=Int(Rnd*?
1001
=arrN
(1)其中?
Min
arrN(i)<
Min
FunctionFun()
DimiAsInteger,jAsInteger
Fori=0To1000
IfiMod7<
0Thenj=j+1
Fun=j
EndFunction
CallReadData1
CallReadData2
DimArr3(20)AsInteger,iAsInteger,sumAsInteger
Fori=1To20
Arr3(i)=Arr1(i)-Arr2(i)
sum=sum+Arr3(i)
Nexti
Printsum
CallWriteData("
dataout.txt"
sum)
1.11上机模拟试题11解答
Text1.Text=InputBox("
请输入身高:
Text2.Text=InputBox("
请输入体重:
VScroll1.Min=100
VScroll1.Max=2400
VScroll1.LargeChange=200
VScroll1.SmallChange=20
PrivateSubVScroll1_Change()
Picture1.Height=VScroll1.Value
IfList1.List(i)=?
List1.RemoveItem?
Start=?
(a)其中?
LBound
Finish=?
UBound
Max=?
(Start)其中?
Ifa(i)?
MaxThenMax=?
、a(i)
arr2(i)=CInt(?
arr1(i)
M=FindMax(?
arr2
OptionBase1
DimArr(100)AsInteger,sumAsInteger
SubReadData()
datain1.txt"
Input#1,Arr(i)
Close#1
SubWriteData(FilenameAsString,NumAsInteger)
FilenameForOutputAs#1
Print#1,Num
EndS