首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino AS Integer strname As String*20 strsex AS String*2 smark As Single
设在工程中有一个标准模块,并定义了如下类型: Type Stutype ino AS Integer strname As String*20 strsex AS String*2 smark As Single
admin
2019-06-11
80
问题
设在工程中有一个标准模块,并定义了如下类型:
Type Stutype
ino AS Integer
strname 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
Dimrecord_no As Integer
record_no=1
With student
.ino=12:.stmame="smith":
.strsex="男":.smark=89
End With
Open"c:\Studont.dat"For Input As #1 Len
=Len(Student)
Put #1,record_no Student
Close#1
End Sub
B、Sub Command 1_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 Random As#1
Len=Len(Student)
Put#1,Record_no,Student
Close #1
End Sub
C、Private Sub Command 1_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 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
EndWith
Open"c:\student.dat"For Output As#1
Len=Len(Student)
Put#1,Record_no,Student
Close #1
End Sub
答案
B
解析
本题考查文件操作。题目中要求以随机的方式(Random)打开一个文件,打开文件的方法格式为:Open FileName For Random As#文件号[Len=记录长度],然后以Put方法写入一条记录,方法的格式为:Put[#]文件号,[记录号],变量名。
转载请注明原文地址:https://kaotiyun.com/show/gyUp777K
本试题收录于:
二级VB题库NCRE全国计算机二级分类
0
二级VB
NCRE全国计算机二级
相关试题推荐
设窗体上有1个名称为HScroll1的水平滚动条,其Max、Min属性分别设置为100、1;有2个名称分别为Option1、Option2的单选按钮,其标题分别为“30”、“50”;还有下面程序代码:PrivateSubOption1_Click()
能够存放组合框的所有项目内容的属性是
下面关于命令按钮的叙述中错误的是
窗体上有一个名称为Text1的文本框,一个名称为Command1的命令按钮。窗体文件的程序如下:PrivateTypexPrivateSubCommand1_Click()aAsInteger:bAsIntegerDimyA
在窗体上画一个命令按钮,然后编写如下程序:Subinc(aAsInteger)PrivateSubCommand1_Click()StaticxAsIntegerinc2:inc3:inc4x=x+aPrintx;E
似定有如下的程序段:DimintVarAsIntegerintvar=TruePrintintVar则输出结果是
设有下列语句:x=5Ifx>0Theny=1y=5程序运行后,则下列叙述中正确的是()。
设:a=12,b=5,c=7,表达式x=(a\c+aModb)+Int(13/5)的值是
某二叉树中有n个度为2的结点,则该二叉树中的叶子结点数为
产生100以内(不含100)2位随机整数的VisualBasic表达式是
随机试题
焊条电弧焊的代号为()。
24岁初孕在门诊,经检查确诊为轻度妊高征,为防止发展为重度,下列哪项处理是错误的
含氟矿物质中最重要的包括
影响危重症患者心理疾病问题的因素包括疾病本身和
骨盆底的组成,错误的是
税目是征税客体的具体项目,我国消费税共有11个税目,其中包括()。
()不是分段式虚拟存储管理优于分页式虚拟存储管理的方面。
简述税收的基本特征。
数列{an}的奇数项与偶数项按原顺序分别组成公比不等于1的等比数列.(1)数列{an}中其中n∈N;(2)数列{an}是等比数列.
计算机辅助测试的英文缩写是()。
最新回复
(
0
)