一、選擇題:
1—8: BBABBCCA
9.I H F C L G E B A J K D
二、填空題
1.Drive 2.Path Print Dir1.Path
3.Path 4.Hidden system
5.順序文件 隨機(jī)文件 二進(jìn)制文件
6.FreeFile
7.Close #1
8.Open “c:\samples\readme.txt” For Output AS #3
9.Open “c:\autoexec.bat” For Intput AS #4
10.Open “c:\samples\xscj.dat” For Random AS #3 Len=54
11.Open “smtext1.txt” For Binary AS #1
12.For Input Eof(1)
13.KeyAscii END(或者End end eNd enD) Text1.text
三、編程題
1.‘在標(biāo)準(zhǔn)模塊中定義
Type stu
ID As String * 12
name As String * 8
z1 As String * 12
z2 As String * 12
sex As String * 2
jc As Boolean
scool As String * 20
sx As Integer
yw As Integer
yy As Integer
wl As Integer
zf As Integer
End Type
Dim p As stu ‘在通用中定義
Private Sub CmdAppend_Click()
p.ID = Text1
p.name = Text2
p.z1 = Text3
p.z2 = Text4
p.scool = Text5
If Option1.Value = True Then p.sex = "男"
If Option2.Value = True Then p.sex = "女"
If Check1.Value = 1 Then p.jc = True Else p.jc = False
p.sx = Val(Text6) : p.yw = Val(Text7)
p.yy = Val(Text8) : p.wl = Val(Text9)
p.zf = Val(Text10)
Put #1, , p
End Sub
Private Sub CmdDisplay_Click()
Get #1, Val(txtRecord_No), p
Text1 = p.ID : Text2 = p.name
Text3 = p.z1 : Text4 = p.z2
Text5 = p.scool
If p.sex = "男" Then Option1.Value = True Else Option2.Value = True
If p.jc = True Then Check1.Value = 1 Else Check1.Value = 0
Text6 = p.sx : Text7 = p.yw
Text8 = p.yy : Text9 = p.wl
Text10 = p.zf
End Sub
Private Sub Command3_Click()
Text1 = "" : Text2 = ""
Text3 = "" : Text4 = ""
Text5 = "" : Text6 = ""
Text7 = "" : Text8 = ""
Text9 = "" : Text10 = ""
End Sub
Private Sub Form_Load()
Open App.Path & "\stu.dat" For Random As #1 Len = Len(p)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Close #1
End Sub
Private Sub Text10_GotFocus()
Text10 = Val(Text6) + Val(Text7) + Val(Text8) + Val(Text9)
End Sub
2.3.4.
Private Type books
id As String * 10
name As String * 8
sex As String * 2
math As Integer
eng As Integer
ele As Integer
End Type
‘成績(jī)輸入
Private Sub Command1_Click()
Dim b As books
Open "c:\stu.dat" For Append As #1
b.id = InputBox("請(qǐng)輸入學(xué)號(hào)")
b.name = InputBox("請(qǐng)輸入姓名")
b.sex = InputBox("請(qǐng)輸入性別")
b.math = InputBox("請(qǐng)輸入數(shù)學(xué)成績(jī)")
b.eng = InputBox("請(qǐng)輸入英語(yǔ)成績(jī)")
b.ele = InputBox("請(qǐng)輸入電子成績(jī)")
Write #1, b.id, b.name, b.sex, b.math, b.eng, b.ele
Close #1
End Sub
‘不及格人員輸出
Private Sub Command2_Click()
Dim a, b, c
Open "c:\stuo.dat" For Input As #1
While Not EOF(1)
Input #1, a, b, c
If c = "數(shù)學(xué)" Then List1.AddItem b
If c = "英語(yǔ)" Then List2.AddItem b
If c = "電子" Then List3.AddItem b
Wend
Close #1
End Sub
‘將不及格人選出存入stuo.dat
Private Sub Command3_Click()
Dim a, b, c, d, e, f
Dim k%
Open "c:\stu.dat" For Input As #1
Open "c:\stuo.dat" For Output As #2
While Not EOF(1)
Input #1, a, b, c, d, e, f
If d < 60 Then Write #2, a, b, "數(shù)學(xué)"
If e < 60 Then Write #2, a, b, "英語(yǔ)"
If f < 60 Then Write #2, a, b, "電子"
Wend
Close #1
Close #2
End Sub