首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: 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
76
问题
设在工程中有一个标准模块,并定义了如下类型:
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://www.kaotiyun.com/show/0fHp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
在窗体上画一个名称为Command1的命令按钮,然后编写如下程序代码:DimxAsIntegerPrivateSubMySub()StaticxAsIntegerDimyAsIntegerx=x+10
窗体上有一个名称为Label1的标签;一个名称为Timer1的计时器,其Enabled和Interval属性分别为True和1000。编写如下程序:DimnAsIntegerPrivateSubTimer1_Timer() ch=Chr(
以下关于窗体的叙述中,错误的是()。
关于随机文件,以下叙述中错误的是( )。
面向对象方法中,继承是指()。
从键盘上输入一个浮点数asingle,利用字符串函数对该数进行处理后,如果输出的内容不是“非浮点数”,则对程序输出的内容分析正确的是()。asingle=InputBox("请输入一个浮点数:")str1$=Str$(asing
下列叙述中,不属于软件需求规格说明书的作用的是()。
设窗体上有一个标签Label1和一个计时器Timer1,Timer1的Interval属性被设置为1000,Enabled属性被设置为True。要求程序运行时每秒在标签中显示一次系统当前时间。以下可以实现上述要求的事件过程是()。
下面()不是VB的文件系统控件。
数据库系统在其内部具有3级模式,用来描述数据库中全体数据的全局逻辑结构和特性的是()。
随机试题
Marfan综合征的临床表现符合下列哪项
禽病毒性关节炎()易感
室外配水管网水压在一天之内有定期高低变化的情况下应采用()。[2006年考试真题]
对于钢——混凝土组合连续梁,调整负弯矩区内力的方法有()。
证券公司承销证券,应当同发行人签订代销或者包销协议,并载明()。Ⅰ.当事人的名称、住所及法定代表人姓名Ⅱ.代销、包销证券的种类、数量、金额及发行价格Ⅲ.代销、包销的期限及起止日期Ⅳ.违约责任
实行财政国库集中支付的预算单位在商业银行开设的零余额账户按()管理。
导游员致欢送辞,可以加深与旅游者之间的感情。欢送辞的内容包括()。
名流服装店将盖有服装店公章的空白合同和介绍信交给李文仲。介绍信上写明:“委托李文仲为服装店购买服装。”李文仲以服装店的名义向和记服装厂订购了总价款140万元的工作服。这批服装销售很不理想。名流服装店认为自己委托李文仲购买的是时装而不是工作服,而且自己店面很
(2008年)设函数f(x)=在(一∞,+∞)内连续,则c=______。
ReformandMedicalCosts[A]Americansaredeeplyconcernedabouttherelentlessriseinhealthcarecostsandhealthinsurancep
最新回复
(
0
)