已知: int a=100; void Func(ref int b) { …… } 则下列函数调用正确的是()
第1题:
以下程序的执行结果是______
include<iostream.h>
void func(int);
void main()
{
int k=4
func(k) ;
func(k) :
cout<<end1;
}
void func(int a)
{
static int m=0;
m+=a;
cout<<m<<" ";
}
第2题:
下面程序的运行结果是
#include<iostream.h>
Void main( )
{
int num=1;
int &ref=num;
ref=ref+2;
cout < < num;
num=num+3;
cout < < ref < <endl;
}
A.13
B.16
C.36
D.33
第3题:
下列程序执行后的输出结果是
void func1(int i);
void func2(int i);
char st[]="hello,friend!";
void func1(int i)
{ printf("%c",st[i]);
if(i<3){i+=2;func2(i);}}
void func2(int i)
{ printf("%c",st[i]);
if(i<3){i+=2;func1(i);}}
main()
{ int i=0; func1(i); printf("\n");}
A.hello
B.hel
C.hlo
D.hlm
第4题:
下列程序执行后的输出结果是______。
A.hello
B.hel
C.hlo
D.hlm void func1 (int i); void func2 (int i); char st[]="hello,friend!"; void func1(int i) { printf("%c",st[i]); if(i<3){ i+=2;func2(i); } } void func2 (int i) { printf("%c",st[i]); if(i<3){ i+=2;func1(i); } } main() { int i=0;func1(i);printf("\n");}
第5题:
类clasg one在声明func成员函数时发生错误,出错原因是______。
class one
private:
int a;
public:
void func(two&);
};
class two
{
private:
int b;
friend vold one::func(two&);
};
void one::func(two&r)
{
a=r.b;
}
第6题:
下列程序的输出结果为
#include<iostream.h>
int func(int n)
{
if(n<1) return 1;
else retur n+func(n-1) ;
return 0;
}
void main( )
{
cout < < func(5) < < endl;
}
A.0
B.10
C.15
D.16
第7题:
A. func f(a, b int) (value int, err error)
B. func f(a int, b int) (value int, err error)
C. func f(a, b int) (value int, error)
D. func f(a int, b int) (int, int, error)
第8题:
以下程序段的输出结果是 [ ] 。
include<iostream.h>
void ref(int &i);
void main(){
int val=1;
cout<<“旧值:”<<val<<end1;
ref(val);
cout<<”新值:”<<val<<end1;
}
void ref(int &i){i=10;}
第9题:
在C程序中有如下语句:char *func(intx,int y); 它是( )。
A.对函数func的定义。
B.对函数func的调用。
C.对函数func的原型说明。
D.不合法的
第10题:
有如下函数模板定义: template<class t> T func(Tx,Ty){return x*x+y*y;} 在下列对func的调用中,错误的是
A.func(3,5);
B.func(3.0,5.5);
C.func(3,5.5);
D.func<int>(3,5.5)