试题 试卷
题型:单选题 题类: 难易度:普通
江苏省南通市海安市高级中学2022-2023学年高一下学期信息技术期中考试试卷
def fibs(n):
if n==1 or n==2:
return ____①____
else:
return _____②_____
m=int(input("请输入一个整数:"))
for i in range(1,m+1):
print(___③___ ,end=",")
a(1)=1:a(2)=1
b(1)=1:b(2)=2
For i=3 To 5
a(i)=a(i-1)+a(i-2)
b(i)=b(i-1)+a(i)
Next i
执行该程序段后,数组元素b(5)的值为( )
Private Sub Command1_Click()
Dim a As Integer, b As Integer
a = 5: b = 3
Print work(a, b)
End Sub
Function work(x As Integer, y As Integer) As Integer
If (x < y) Then
work = 0
Exit Function
End If
If (y = 0) Then
work = 1
work = work(x - 1, y - 1) + work(x - 1, y)
End Function
Function s(n As Integer) As Integer
If n=1 Then
s=1
Else
s=s(n-1)+n
Private Sub Form_Click()
Dim x As Integer
x=s(4)
Print x
程序运行时,单击窗体后,变量x的值为( )
Function f(i As Integer)
If i=1 Then
f=2
f=2 * 10 ^ (i-1)+f(i-1)
Dim n As Integer, s As Integer, i As Integer
n=Val(Text1.Text)
s=0
For i=1 To n
s=s+f(i)
Label1.Caption=Str(s)
若在Text1中输入5,则Label1显示的内容为( )
def f(a , n):
n=n-1
if n=0:
return a
return f(a-1, n)+f(a+1, n)
print(f(5, 3))
程序运行后,输出的结果是( )
试题篮