问题
单项选择题
下列程序执行后,变量X的值为( )。
Dim f1, b, c, d As Single
Dim X As Single
f1=10
b=30
C=400
If b>f1 Then
d=f1:f1=b:b=d
EndIf
If b>e Then
x=b
ElseIf f1>c Then
x=c
Else
x=a
EndIf
A.10
B.30
C.400
D.430
答案
参考答案:B
解析: 程序操作过程如下:
程序首先执行If b>aThen语句,条件为真执行d=a:a=b:b=d语句,执行后d=10,a=30,b=10;然后执行If b>C Then语句,条件不成立,因此执行Else If a>CThen语句;条件不成立,因此执行Else后面的X=a语句,执行后x=30。