下面的代码段,输出结果为________ a=1 def fun1(a): a=2+a print(a) fun1(a) print(a)A.3 1B.4 1C.3 3D.4 3
下面的代码段,输出结果为________ a=1 def fun1(a): a=2+a print(a) fun1(a) print(a)
A.3 1
B.4 1
C.3 3
D.4 3
参考答案和解析
20
相关考题:
有以下程序void fun1(char *p){ char *q;q=p;while(*q!='\0'){ (*q)++; q++; ) }}main(){ char a[]={"Program"),*p;p=a[3];fun1(p);printf(" % s\n",a);}程序执行后的输出结果是A)ProhsbnB)PrphsbnC)ProgsbnD)Program
( 28 )在窗体上画一个命令按钮(名称为 Command1 ) ,并编写如下代码:Functin Fun1(Byval a As Integer ,b As Integer) As IntegerDim t As Integert=a-bb=t+aFun1=t+bEnd FunctionPrivate Sub Command1_Click()Dim x As IntegerX=10Print Fun1(Fun1(x,(Fun1(x,x-1))),x-1)End Sub程序运行后,单击命令按钮,输出结果是A ) 10B ) 0C ) 11D ) 21
有F面的程序段.其功能是按图1所示的规律输出数据Dim a(3,5)As IntegerFor i=1 To 3For i=1 To 5a(i,j)=i+jPrint a(i,j);NextPrintNext若要按图2所示的规律继续输出数据,则接在上述程序段后面的程序段应该是A.For i=i To 5 For j=1 To 3 Print a(j,i); Next Print NextB.For i=1 To 3 For i=1 To 5 Print a(j,i); Next Print NextC.For j=1 To 5 FOr i=1 TO 3 Print a(j,1); Next Print NextD.For i=1 To 5 For j=1 To 3 Print a(i,j); Next Print Print Next Next
有如下函数过程: Function fun1(ByVal x As Integer,ByVal y As Integer) As Integer Do While y<>0 reminder=x Mod y x=y y=reminder Loop fun1=x End Function 在下列按钮单击事件中调用该函数,则该程序的运行结果是( )。 Private Sub Command1_Click() Dim a AS Integer Dim b As Integer a=100 b=25 x=fun1(a,B) Print x End SubA.0B.25C.50D.100
在窗体上画一个命令按钮(名称为Command1),并编写下列代码: Function Fun1(ByVa1 a As Integer,b As Integer)As Integer Dim t As Integer t=a-b b=t+a Fun1=t+b End Function Private Sub Command1Click( ) Dim X As Integer x=10 Print Fun1(Vun1(X,(Fun1(x,x-1))),x-1) End Sub 程序运行后,单击命令按钮,输出结果是( )。A.10B.0C.11D.21
在窗体上画一个名称为Command1命令按钮,然后编写如下事件过程: Private Function fun1(n As Integer)As Integer Dim k As Integer If n = 1 Then k = 1 Else k = 1 + fun1(n - 1)* 2 End If fun1 = k End Function Private Sub Command1_Click () Dim m As Integer, x As Integer x = 4 m = fun1 (x) Print m End Sub 程序运行后,单击命令按钮,则窗体上显示的内容是A.4B.6C.9D.15
有下面的程序段,其功能是按图1所示的规律输出数据: Dim a(3,5)As Integer For i=1 To 3 For j=1 To 5 a(i,j)=i+j Print a(i,j); Next Print Next若要按图2所示的规律继续输出数据,则接在上述程序段后面的程序段应该是( )。A.For i=1 To 5 For j=1 To 3 Print a(j,i); Next Print NextB.For i=1 T0 3 For j=1 To 5 Print a(j,i); Next Print NextC.For j=l To 5 For i=1 To 3 Print a(j,i); Next Print NextD.For i=1 To 5 For=1 To 3 Print a(i,j): Next Print Next
有下列函数过程:Function fun1(ByVal x As Integer,ByVal y As Integer)As IntegerDo While y<>0reminder=x Mod yx=yy=reminderLoopfun1=xEnd Function 在下列按钮单击事件中调用该函数,则该程序的运行结果是( )。Private Sub Command1_Click()Dim a As IntegerDim b As Integera=100b=25x=fun1(a,B)Print xEnd SubA.0B.25C.50D.100
写出程序的输出结果:public class A{public virtual void Fun1(int i){Console.WriteLine(i);}public void Fun2(A a){a.Fun1(1);Fun1(5);}}public class B : A{public override void Fun1(int i){base.Fun1 (i + 1);}public static void Main(){B b = new B();A a = new A();a.Fun2(b);b.Fun2(a);}}
在窗体上画一个命令按钮,然后编写如下程序: Function funl(ByVal Bum As Long)As Long Dim k As Long k = 0 Bum=Abs(Bum) Do While Bum k=k+(Bum Mod 10) Bum=Bum\10 Loop fun1=k End Function Private Sub Command1_Click() Dim n As Long n=InputBox("请输入一个数") Print fun1(n) End Sub 程序运行后,单击命令按钮,在对话框中输入234,输出的结果为A.3B.4C.9D.10
运行下列程序:Private Sub Command1_Click( )a = Val(InputBox(a = ))Print fun1(a)End SubPrivate Function fun1(b)If b 0 Thenfun1 = 10ElseIf b = 0 Thenfun1 = 9Elsefun1 = 8End IfEnd Function单击按钮后从键盘为变量a输入数据3,输出的结果是( )。A.3B.8C.9D.10
运行下列程序:Private Sub form_Click( )Dim sl As String, s2 As Strings1 = "12341234m = 0For i = 3 To 1 Step -1m = m + 1s2 = fun1(s1, m)Debug.Print s2;Next iEnd SubPrivate Function fun1(x, y) As Stringfun1 = Right(x, y)End Function单击窗体后,则在立即窗口内显示结果是( )。A.1234B.4321C.434234D.1111
运行下列程序:Dim x, yPrivate Sub Form_Click( )x = 1: y = 1: z = 1fun1 (1)Print x; y; zEnd SubPrivate Sub fun1(a)x = a + x: y = a + x: z = a + yEnd Sub单击窗体后,则输出结果是( )。A.1 1 1B.2 3 1C.2 3 4D.2 2 1
运行下列程序:Private Sub form_Click( )x = 8: y = 2Call fun1((x), y)Print x, yEnd SubPrivate Sub fun1(x, y)s = xx = s / yy = s Mod yEnd Sub单击窗体后,则在窗体上显示的结果是( )。A.4 2B.8 2C.8 0D.2 4
运行下列程序:Dim bPrivate Sub Form_Click( )a = 1: b = 1Call fun1(a)Print "X = X = ; a; ,Y = ; bEnd SubPrivate Sub fun1(a)b = 2 * aa = 3 * bEnd Sub单击窗体后,则在窗体上显示的结果是( )。A.X = 1,Y = 1B.X = 2,Y = 6C.X = 6,Y = 2D.X = 6,Y = 1
在窗体上画一个名称为Commandl的命令按钮,然后编写如下事件过程: Private Sub Command1_Click() y = 8 Print fun1(1 + fun1(fun1(fun1(y)))*10) End Sub Private FLinctiOn fUnl(A)funl(A)= 1 + a End Function 程序运行后,单击命令按钮,则窗体上显示的内容是A.112B.2C.909090D.1001
以下程序输出什么?"""x=1"""whilex:print(x) A.运行结果显示NameError:name'x'isnotdefinedB.运行结果无限循环输出1C.它等价于下面的程序#x=1whilex:print(x)D.它等价于下面的程序whilex:print(x)
在窗体上画一个命令按钮(名称为Command1),并编写下列代码:Function Fun1(ByVa1 a As Integer,b As Integer)As IntegerDim t As Integert=a-bb=t+aFun1=t+bEnd FunctionPrivate Sub Command1Click( )Dim X As Integerx=10Print Fun1(Vun1(X,(Fun1(x,x-1))),x-1)End Sub程序运行后,单击命令按钮,输出结果是( )。A.10B.0C.11D.21
有如下函数过程: Function fun1 (ByVal x As Integer, ByVal y As Integer) As Integer Do While y <> 0 reminder=x Mod y x=y y=reminder Loop fun1=x End Function 在下列按钮单击事件中调节器用该函数,则该程序的运行结果是( )。 Private Sub Command1_Click() Dim a As Integer Dim b As Integer a=100 b=25 x=fun1(a,b)Print x End SubA.0B.25C.5OD.100
单选题有以下程序#includeint fun1(double a){ return (int)(a*= a);}int fun2(double x,double y){ double a = 0,b = 0; a = fun1(x); b = fun1(y); return (int)(a+b);}main(){ double w; w = fun2(1.1,2.0); printf(%4.2f,w);}程序执行后输出结果是( )。A5B5.00C5.21D0.0