试题 试卷
题型:填空题 题类: 难易度:普通
江苏省普通高中学业水平合格性考试信息技术模拟卷(四)
写一个计数器程序,要求反复输入一位数字,遇到数字0结束输入,统计输入了多少个数字(不含0)并输出结果。
a=int(input("请输入一个数字"))
ans= #ans用来统计数字个数
while :
ans+=
print(ans)
Private Sub Command1_Click()
Dim Pi As Single, t As Single
Dim n As Integer, s As Integer
Pi = 0
t = 1: n = 1: s =1
Do While Abs(t) >= 0.0001
Pi = Pi + t
n ={#blank#}1{#/blank#}
s= {#blank#}2{#/blank#}
t = s / n
Loop
Text2.Text ={#blank#}3{#/blank#}
End Sub
为实现上述功能的程序如下,请在程序划线处填入合适的代码。
Dim a As String
Dim n As Integer
a = Text1.Text
n = Len(a)
Do While ① and Mid(a, n, 1)="0"
n = n - 1
For i = n To 1 Step -1
Text2.Text = Text2.text + ②
Next i
tmps = [32,28,26,29]
n = len (tmps) ; top = -1
an s = [0] * n
stk = [-1] * n
for i in range(n):
t = tmps[i]
while top > -1 and t > tmps[stk[top]] :
d = stk[top]
top -= 1
an s[d] = i - d
top += 1
stk[top] = i
print(an s)
执行该程序段后,输出的结果是( )
请回答下列问题:
q=[""]*50
head=tail=0
s="ningbo'
for i in s:
q[tail]=i
tail+=1
while head<tail:
print(q[head],end="")
head+=1
for i in range(3):
q[tail]=q[head]
执行该程序段后,输出结果为( )
试题篮