首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer stmame As String*20 strsex As String*2 smark As Single
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino As Integer stmame As String*20 strsex As String*2 smark As Single
admin
2020-07-22
90
问题
设在工程中有一个标准模块,并定义了如下类型:
Type Stutype
ino As Integer
stmame As String*20
strsex As String*2
smark As Single
End Type
在窗体上画一个名为Command1的命令按钮,要求当执行事件过程Command1_Click时,在C盘根目录下的随机文件Student.dat中写入一条记录。下列能够完成该操作的是( )。
选项
A、Sub Command1_Click()
Dim student As Studtype
Dim record_no As Integer
record_no=1
With student
.ino=12:.stmame="smith":
.strsex==男=:.smark=89
End With
Open"c:\Student.dat"For Input As#1 Len
=Len(Student)
Put#1,record_no,Student
Close#1
End Sub
B、Sub Command1_Click()
Dim Student As Stutype
Dim Record_no As Integer
Record_no=1
With Student
.ino=12:.strname="smith"
.strsex="男":.smark=89
End With
Open"c:\student.dat"For RandomAs As#1
Len=Len(Student)
put#1,Record_no,Student
Close#1
End Sub
C、Private Sub Command1_Click()
DimStudent As Stutype
Dim Record no As Integer
Record_no=1
With Student
.ino=12:.stmame="smith"
.strsex="男":.smark=89
End With
Open"c:\student.dat"For Random As 1
Len=Len(Student)
Write#1,Record_no,Student
Close#1
End Sub
D、Sub Command1_Click()
Dim Student As Stutype
Dim Record_no As Integer
Record_no=1
With Student
.ino=12:.stmame="smith"
.strsex="男":.smark=89
End With
Open"c:\student.dat"For Output As#1
Len=Len(Student)
Put#1,Record_no,Student
Close#1
End Sub
答案
B
解析
本题考查文件操作。题目中要求以随机的方式(Random)打开一个文件,打开文件的方法格式为:Open FileNamn For Random As#文件号[Len=记录长度],然后以Put方法写入一条记录,方法的格式为:Put[#]文件号,[记录号],变量名。
转载请注明原文地址:https://kaotiyun.com/show/0fHp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
在窗体上画一个文本框,名称为Text1(可显示多行),然后再画三个命令按钮,名称分别为Command1、Command2和Cornmand3,标题分别为“读数”、“统计”和“存盘”,如图3.67所示。程序的其功能是:单击“读数”按钮,则把考生目录下的in5
窗体上有2个名称分别为Text1和Text2的文本框。编写如下程序:PrivateSubForm_Load()Text1.Text=""Text2.Text=""EndSubPrivateSubCommand1_Cl
能得到组合框Combo1中最后一个列表项序号的表达式是()。
能够存放组合框的所有项目内容的属性是( )。
窗体的单击事件过程如下:PrivateSubForm_Click()Dimm(10)Fork=1To10m(k)=11-kNextkPrintm(4)
下列哪一条小属于数据库设计的任务?()
设工程文件包含两个窗体文件Form1.frm、Form2.frm及一个标准模块文件Module1.bas。两个窗体上分别只有一个名称为Command1的命令按钮。Form1的代码如下:PublicxAsIntegerPrivateSubFo
数据库系统在其内部具有3级模式,用来描述数据库中全体数据的全局逻辑结构和特性的是()。
与数学式子对应的VisualBasic表达式是
在深度为7的满二叉树中,叶子结点的个数为
随机试题
研究低温现象而得到的一个热力学定律是()。
“菜根道人”指()
在实验室依据分子大小进行蛋白质纯化的方法是
高血压病人术中出现血压显著下降的原因不包括
女性患者,55岁。诊断为贫血。急性失血性贫血患者,当丢失血容量至少达多少时即可有贫血表现
某市安然租赁公司购置了大量房产,专门用于出租,以取得租赁收入。2008年1月天然化妆品厂拟租用安然公司在市区的库房数间,用以存储产品及原料。库房原值为1600万元,残值率5%,税法规定按20年折旧,假设企业适用所得税率25%。当地政府规定,房产的减除比例
世界第一家旅行社的创办人是()。
Germs(细菌)onBanknotesPeopleindifferentcountriesusedifferenttypesofmoney:yuaninChina,pesosinMexico,poundsint
ThestudentislookingfortheEconomichistoryoffice.
InFranceandGreece,studentsfindthat______.Thispassageismainlyabout______.
最新回复
(
0
)