组卷题库 > 高中信息技术试卷库
试题详情
某VB程序段如下:

Dim i As Integer, n As Integer, k As Integer, s As String n = Val(Text1.Text):k = 1: s = ""

Do While 2 ^k < n

    k = k + 1

Loop

Do While n <> 0

    If n >= 2 ^ (k -1) Then s = s + "1"

    n = n - 2 ^ (k -1)

    Else

        s = s + "0"

    End If

    k = k - 1

Loop

For i= 1 To k

    s = s + "0"

Next i

在文本框Text1输入12,执行该程序段后,变量s、k的值分别为(     )

A、"1100"、2
B、"11"、2
C、"0011"、4
D、"1100"、4
知识点
参考答案
采纳过本试题的试卷
教育网站链接