单选题 VB
题号 #483478

设有如下的记录类型
Type Student
number As String
name As String
age As Integer
End Type
则正确引用该记录类型变量的代码是(  )
A.Student.name=“张红”
B.Dim SAs Student
s.name=“张红”
C.Dim S As Type Student
s.name=“张红”
D.Dim SAsType
s.name=“张红”

进入在线模考

参考答案

B

答案解析

在上述记录类型中,数据类型名是Student,要定义一个Student类型的变量S,格式为:Declare s As Student
这里的“Declare”可以是Dim、Static、Public或Private。
要将字符串”张红”赋值给变量S的name元素,应使用的语句为s.name=“张红”。综上所述,答案是B。

你可能感兴趣的试题

找试题 · 找答案 · 找资料 在线模考