(39)有以下程序
#include <stdio.h>
main()
{ int a=5,b=1,t;
t=(a<<2|b); printf(“%d\n”,t)
}
程序运行后的输出结果是
A)21 B)11 C)6 D)1
第1题:
设a、b和C都是int型变量,且a=3,b=4,c=5,则以下的表达式中值为0的表达式是( )。
A.a&&b
B.a<;=b
C.a||b+c&&b-c
D.!((a<;b)&&!c||1)
第2题:
下列程序的输出结果是( )。
#include<stdio.h>
int b=2;
int func(int*A)
{ b+=*a;retum b;}
main()
{ int a=1,t=2;
t+=func(&A) ;
printf("%d\n",t);
}
A.4
B.5
C.6
D.8
第3题:
下列程序的输出结果是( )。 #include<stdio.h> int b=2; int func(int*a) { b+=*a;return b;} main() { int a=1,t=2; t+=func(&a); printf("%d\n",t); }
A.4
B.5
C.6
D.8
第4题:
有以下程序: #include<stdio.h> int f(int t[],int n); main() {int a[4]={1,2,3,4},s; s=f(a,2);printf("%d\n",s); } int f(int t[],int n) {if((n>0)&&(n<5))return t[n+1]+f(t,n-1); else return 0; } 程序运行后的输出结果是( )。
A.4
B.7
C.10
D.61
第5题:
有以下程序:#include <stdio.h>void f(int * x,int * y) int t; t= *x; *x= *y; *y=t;main ( ){ int a[8] = { 1,2,3,4,5,6,7,8} ,i, * p, * q; p=a;q =&a[7]; while(p<q) { f(p,q) ;p ++ ;q --; } for(i =0;i<8;i ++ ) printf(" % d," ,a[i]); }程序运行后的输出结果是( )。
A.8,2,3,4.,5,6,7,1,
B.5,6,7,8,1,2,3,4,
C.1,2,3,4,5,6,7,8,
D.8,7,6,5,4,3,2,1,
第6题:
以下程序的输出结果是( )。 include<stdio.h> void swap(int*a,int*B){int*t; t=a;a=b;b=c;} main() {int i=3,j=5,*p=&i,*q=&j; swap(p,q);printf("%d %d\n",*p,*q); }