网站导航:首页 -> 计算机等级考试 -> 计算机等级考试二级 -> 计算机二级考试VB辅导 -> 计算机二级考试VB模拟题 -> [二级VB试题天天练]VB考试试题8

[二级VB试题天天练]VB考试试题8


11.程序控制结构练习(1) 
下列程序段的运行结果是?
dim i as integer
dim x as integer
i = 2
x = 4
select case i
    case 0
        print 'case 0'
    case 1
        print 'case 1'
    case x - i
        print 'case x - i'
    case x
        print 'case x'
    case else
        print 'case else'
end select
运行程序后可以看到结果是
case x - i
因为表达式“x - i”的返回值和要检查的表达式“i”的返回值是相同的,
所以会执行case x - i 语句。