题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-27 18:17:35

[单选题]以下程序的输出结果是( )。
Long fun( int n)
{ long s;
if(n==1||n==2) s=2;
else s=n-fun(n-1);
return s;
}
Int main()
{
cout << fun(3) << endl;
return 0;
}
A. 1
B. 2
C. 3
D. 4

更多"[单选题]以下程序的输出结果是( )。Long fun( int n)"的相关试题:

[简答题]以下程序运行结果是_(__。
Long fib (int g)
{ switch ( g )
{ case 0∶return 0;
case 1∶
case 2∶return 1;
}
return (fib(g-1)+fib(g-2));
}
Int main ( )
{ long k;
k=fib(5);
cout << "k="< return 0;
}
[单选题]有以下程序
Float fun(int x,int y)
{ return(x+y); }
Int main()
{ int a=2,b=5,c=8;
cout << fun((int)fun(a+c,b),a-c) << endl;
return 0;
}
程序运行后的输出结果是( )。
A. 编译出错
B. 9
C. 21
D. 9.0
[单选题]以下程序输出结果是()。        main() { int m=5; if(m++>5) printf("%d\n",m); esle printf("%d\n",m- -); }
A.7
B.6
C.5
D.4
[单选题]以下程序的输出结果是( )。
Int f()
{ static int i=0;
int s=1;
s+=i; i++;
return s;
}
Int main()
{ int i,a=0;
for(i=0;i<5;i++)
a+=f();
cout << a << endl;
return 0;
}
A. 20
B. 24
C. 25
D. 15
[单选题]已定义以下函数 int fun(int *p) {return *p;) fun函数返回值是()。
A.不确定的值
B.一个整数
C.形参P中存放的值
D.形参P的地址值
[单选题]已知函数fun的原型为:int fun(int,int,int);下列重载函数原型中错误的是( )。
A. char fun(int,int);
B. double fun(int,int,double);
C. int fun(int,clar*);
D. float fun(int,int,int);
[单选题]有以下程序
#include
Int i=0;
Void fun()
{
{
static int i=1;
std::cout< }
std::cout<}
Int main()
{
fun(); fun();
return 0;
}
程序执行后的输出结果是( )。
A. 1,2,1,2,
B. 1,2,2,3,
C. 2,0,3,0,
D. 1,0,2,0,
[单选题]下面程序输出的结果是( )。
Int main()
{ int i;
int a[3][3]={1,2,3,4,5,6,7,8,9};
for(i=0;i<3;i++)
cout < return 0;
}
A. 1 5 9
B. 7 5 3
C. 3 5 7
D. 5 9 1
[简答题]以下程序段的输出结果是 。
Int main()
{ char s[]= "abcdefg";
s[3] ='\0';
cout << s;
return 0;
}
[单选题]现有如下程序,则程序的输出结果为( )。
Int f(int
A,int b)
{ int c;
if(a>0&&a<10) c=(a+b)/2;
else c=a*b/2;
return c;
}
Int main()
{ int a=8,b=20,c;
c=f(a,b);
cout << c << endl;
return 0;
}
A. 随机数
B. 80
C. 28
D. 14
[单选题] 以下程序段的输出结果是( )。
1 .int x = 1, a = 0, b = 0;
2 .switch (x)
3 .{
4 .case 0:
5 . b++;
6 .case 1:
7 . a++;
8 .case 2:
9 . a++;
10 . b++;
11 .}
12 .printf("a=%d,b=%d\n",
A, b);
A.a=2,b=1
B.a=1,b=1
C.a=1,b=0
D.a=2,b=2
[单选题]以下程序的输出结果是()。 main() { int a=4,b=5,c=0,d; d=!a&&!b||!c; printf("%d\n",d);}
A.1
B.0
C.非0数
D.-1
[单选题]以下程序段运行后的输出结果是( )。
Int main()
{ char str[][9]={"hello", "student", "computer"};
cout << str[1];
return 0;
}
A. h
B. hello
C. student
D. computer
[单选题]以下程序输出结果是 。 #include "stdio.h" void f (); main() {int a; for(a=1;a<=3;a++) fun(); } void fun() {static int i=1; i+=3; printf("%2d",i); }
A.4 7 10
B.4 4 4
C.4 5 6
D.4 6 8
[单选题]有以下函数定义:
Void fun(int n,double x) {…}
若以下选项中的变量都已经正确定义且赋值,则对函数fun的正确调用语句是( )。
A. fun(int y,double m);
B. k=fun(10,12.5);
C. fun(x,n);
D. void fun(n,x);
[单选题]有以下程序段 struct st {int x;int *y;}*pt; int a[]={1,2},b[]={3,4}; struct st c[2]={10,a,20,b}; pt=c; 以下选项中表达式的值为11的是()。
A.*pt->y
B.pt->x
C.++pt->x
D.(pt++)->x
[单选题]若int 类型占两个字节,则以下语句输出为( )
Int k=-1;
Printf("%d,%u\n",k,k);
A. -1,-1
B. -1,65536
C. -1,32768
D. -1,65535
[简答题]完成下面输出字符串“world”的程序。
Int main( )
{ int i,j;
char c[]="hello world";
for(i=0;i<5;i++)
{ ;
cout << c[j];
}
return 0;
}
[简答题]以下程序输出的最后一个值是____。
#include
Using namespace std;
Int ff(int n)
{ static int f=1;
f=f*n;
return (f);
}
Int main( )
{ for (int i=1;i<=5;i++)
cout << ff(i) << endl;
return 0;
}

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码