试题 试卷
题型:单选题 题类: 难易度:普通
浙江省衢州、丽水、湖州三地市2023年11月高三上学期信息技术教学质量检测试卷
def judge(a, b):
n=len(a) ;st=[- 1]*n
top-= 1; i=j=0
while i<n:
top+= 1
①
i+= 1
while top> - 1 and ② :
top-= 1
j+= 1
return top==- 1
from random import shuffle
a=[1,2,3,4, 5]
b=[1,2, 3, 4, 5]
shuffle (b) #将序列 b 的元素随机排序
if judge(a, b):
print (b,'是' ,a,' 的出栈序列')
else:
print (b,'不是' ,a,' 的出栈序列')
程序运行结果如图所示。划线处应填写的语句是( )
q=[0]*6
q[0]=1
head=0; tail=1
while tail<len(q)=1:
x=q[head]
if x%2==0:
q[tail]=x//2
tail+=1
else:
q[tail]=x*2
q[tail+1]=x*3
tail+=2
head+=1
程序运行后 , tail-head的值为( )
比如:仓库存储情况列表 a=["0", "A", "A", "B", "B", "A", "0", "0", "0"],其中"0"表示空位,"A", "B"表示位置上货物种类 , 现需从中取出一件B货物,则应从右侧取出,取完后,仓库存储列表更新为a=["0", "A", "A", "B", "A", "0", "0", "0", "0"]。
q=[""]*50
head=tail=0
s="ningbo'
for i in s:
q[tail]=i
while head<tail:
print(q[head],end="")
for i in range(3):
q[tail]=q[head]
执行该程序段后,输出结果为( )
试题篮