问题 单项选择题

当a=1、b=3、c=5、d=4时,执行下面一段程序后,x的值为______。
If a<b Then
If c<d Then
x=1
Else
If a<c Then
If b<d Then
x=2
Else
x=3
End If
Else
x=6
End If
End If
Else
x=7
End If

A.1

B.2

C.3

D.6

答案

参考答案:B

解析: 当a<b成立时,继续执行;当c<d不成立时,执行else分支;当a<c成立时,继续执行;当b<d成立时,则x=2,随后连续跳出4层end if

单项选择题
问答题 简答题