试题 试卷
题型:单选题 题类:常考题 难易度:普通
浙江省义乌市群星外国语学校2017届高三上学期期中考试信息技术试题
Private Sub Command1_Click()
Text1.Text = f(3)
End Sub
Function f(x As Integer) As String
If x = 1 Then f = 1 Else f = f(x - 1) + 2
End Function
运行程序并点击按钮Command1后,文本框Text1中显示的内容是( )
Function f(n As Integer) As Integer
If n <= 1 Then
f = 1
Else
f = n + f(n - 1)
End If
Function f(n As Integer)As Long
Text1.Text=Trim(Str(n))+Text1.Text ‘函数Trim的作用是去掉字串首尾空格
If n=1 Then
f=1
f=3*f(n\2)
Text1.Text=“”
Text1.Text=Trim(Str(f(8)))+Text1.Text
单击按钮Command1后,文本框Text1中显示的值是( )
Dim k As Integer,a As Integer,b As Integer
a=Val(Text1.Text)
b=Val(Text2.Text)
Label1.Caption=trans(a,b)
Function trans(m As Integer,n As Integer)As String
If m<>0 Then
r=m Mod n
trans=trans(m\n,n)+Str(r)
trans=0
程序运行时,在文本框Text1和Text2中分别输入11和2,则Label1中的输出结果是( )
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)
Next i
Label1.Caption=Str(s)
若在Text1中输入5,则Label1显示的内容为( )
def f(m, n):
q=m%n
if q == 0:
return n
else:
return f(n,q)
print(f(14,10))
已知斐波拉契数列1,1,2,3,5,8,1321……其定义如下:
f(a)=
求斐波拉奖数列第n项的值。
def f(n): #定义递归函数
if n==1 {#blank#}1{#/blank#} n==2:
return 1
else:
return {#blank#}2{#/blank#}
n=int(input("请输入正整数n的值:"))
print({#blank#}3{#/blank#}) #打印结果
试题篮