![](https://static.youtibao.com/asksite/comm/h5/images/m_q_title.png)
有如下程序 main(){ int n={0,0,0},i,k=2; for(i=1;i<3;i++)n【i】=n【i】+1; printf("%d",n【k】); }该程序的输出结果是__
A.不定值
B.2
C.1
![](https://static.youtibao.com/asksite/comm/h5/images/m_q_a.png)
C、1
![](https://static.youtibao.com/asksite/comm/h5/images/solist_ts.png)
A.不定值
B.2
C.1
C、1
有如下程序: #include <stdio.h> main() { int a=2,b= -1,c=2; if(a<b) if(b<0) c=0; else c++; printf("%d\n",c); } 该程序的输出结果是
A.0
B.1
C.2
D.3
A.不定值
B.2
C.1
A.30
B.15
C.20
D.10
有如下程序______。 long fib (int n) { if(n>2) returb(fib(n-1)+fib(n-2)); else return(2); } main() {printf("%d\n",fib(3));} 该程序的输出结果是______。
A.2
B.4
C.6
D.8
有如下程序:
#define N 2
#define M N+1
#define NUM 2*M+1
main()
{
int i;
for(i=1;i<=NUM;i++)printf("%d\n",i);
}
该程序中的for循环执行的次数是
A.5
B.6
C.7
D.8
A.5
B.6
C.7
D.8
有如下程序: long fib(int n) { if(n>2)return(fib(n一1)+fib(n一2)); else return(2); } void main() { printf(“%d\n”,fib(3)); } 该程序的输出结果是()。
A.2
B.4
C.6
D.8
有如下程序 main() { int x=3; do { printf("%d",x--);} while(!x); }该程序的执行结果是______。
A.321
B.3
C.不输出任何内容
D.陷入死循环
有如下程序: #include <iostream> using namespace std; int main() { int *p; *p = 9; cout << "The value at p: " << *p; return 0; } 编译运行程序将出现的情况是()。
A.编译时出现语法错误,不能生成可执行文件
B.运行时一定输出:The value at p:9
C.运行时一定输出:The value at p:*9
D.运行时有可能出错
有如下程序:
#include
using namespace std;
int main()
{
void function(double val);
double val;
function(val);
cout<
return 0;
}
void function(double val)
{
val = 3;
}
编译运行这个程序将出现的情况是
A .编译出错,无法运行
B .输出: 3
C .输出: 3.0
D .输出一个不确定的数
如下程序的输出结果是______。 main() { static int a[4]={1,2,3,4}; int**k,*j; j=a+1;k=&j; printf("%d\n",*(*k+2)); }
A.运行错误
B.4
C.3
D.2