当前位置: 高中信息技术 / 单选题
  • 1. (2021高三上·浙江期中) 某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

微信扫码预览、分享更方便