预测以下代码片段的输出结果:() function add(i) { var k = i+10; alert(k); } ; function add(i) { var k = i+20; alert(k); } ; add(10);
第1题:
下列程序的运行结果是( )。 #include<stdio.h> #define ADD(x)x+x main() { int m=1,n=2,k=3; int s=ADD(m+n)*k; printf("s=%d",s); }
A.sum=18
B.sum=10
C.sum=9
D.sum=25
第2题:
有如下程序:
Private Sub Command1_Click()
Dim k As Integer, m As Integer
Dim p As Integer
k=4: m=1
p=PC(k, m) : Print p;
p=PC(k, m) : Print p
End Sub
Private Function PC(a As Integer, b As Integer)
Static m As Integer, i As Integer
m=0: i=2
i=i + m + 1
m=i + a + b
PC=m
End Function
程序运行后,输出的结果为( )。
A.4 6
B.6 6
C.8 8
D.10 12
第3题:
有以下程序
int add( int a,int b){ return (a+b); }
main()
{ int k, (*f)(), a=5,b=10;
f=add;
…
}
则以下函数调用语句错误的是
A)k=(*f)(a,b);
B)k=add(a,b);
C)k= *f(a,b);
D)k=f(a,b);
第4题:
A.type Integer intfunc (a Integer) Add(b Integer) Integer { return a + b}
B.type Integer intfunc (a Integer) Add(b *Integer) Integer { return a + *b}
C.type Integer intfunc (a *Integer) Add(b Integer) Integer { return *a + b}
D.type Integer intfunc (a *Integer) Add(b *Integer) Integer { return *a + *b}
第5题:
以下用户自定义函数 Function Func(a As Integer,b As Integer)As Integer Static m As Integer.i As Integer m=0:i=2 i=i+m+i m=i+a-i-b Func=m End Function 在窗体上画一个命令按钮,然后编写如下事件过程: Private Sub Command1_Click() Dim k As Integer,m As Integer,p As Integer k=4:m=1 P=Func(k,m) Print P End Sub 程序运行后,单击命令按钮,输出结果为
A.8
B.9
C.10
D.11
第6题:
有以下程序 iht add (int a, int b) {return(a+b);} mian() {int k,(*f)(),a=5,b=10; f=add; … } 则以下函数调用语句错误的是______。
A.k=(*f)(a,b);
B.k=add(a,b);
C.k=*f(a,b);
D.k=f(a,b);
第7题:
有以下程序: int add(int a,intB){return(a+B);} main() { int k,(*f)(),a=5,b=10; f=add; } 则以下函数调用语句错误的是( )。
A.k=(*f)(a,B);
B.k=add(a,B);
C.k=*f(a,B);
D.k=f(a,B);
第8题:
下列程序的输出结果是非曲直【 】。
include<iostream, h>
class base
{
int x, y;
public:
base(int i, int j){x=i; y=j;}
virtual int add(){return x+ y;}
};
class three: public base
{
int z;
public:
three(int i, int j, int k) :base(i, j){z=k; }
int add() { return (base:: add()+z); }
};
void main()
{
three * q=new three(lO,20,30);
cout<<q->add()<<end1;
}
第9题:
(28)阅读下列程序: Private Sub Commandl_Click() Dim i As Integer,k As Integer k=2 For i=1 To 3 PrintH(K); Next i End Sub Function H(j As Integer) Static b a=0 a=a+1 b=b+1 H=a*b+jEnd Function 单击命令按钮,执行程序,输出结果是A.2 3 4 B.3 4 5 C.5 6 7 D.3 5 6
第10题:
有如下程序: Private Sub Command1_Click() Dim k As Integer,m As Integer Dim p As Integer k=4:m=1 p=PC(k,m):Print p; p=PC(k,m):Print p End Sub Private Function PC(a As Integer,b As Integer) Static m As Integer,i As Integer m=0:i=2 i=i + m + 1 m=i + a + b PC=m End Function 程序运行后,输出的结果为
A.4 6
B.6 6
C.8 8
D.10 12