有以下程序
#include "stdio.h"
void main()
{ int x=1,y=0,a=0,b=0;
switch(x)
{ case 1: switch(y)
{ case 0: a++;break;
case 1: b++;break;
}
case 2: a++;b++;break;
}
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
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346509.html
点击查看答案
有以下程序
#include
#include
void fun(char *w,int m)
{char s,*p1,*p2;
p1=w;p2=w+m-1;
while(p1}
main()
{char a[]=”123456”;
fun(a,strlen(a)); puts(a);
}
程序运行后的输出结果是( )。
A. 654321
B. 116611
C. 161616
D. 123456
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346514.html
点击查看答案
下列对字符串的定义中,错误的是( )。
A. char str[7] = "FORTRAN";
B. char str[] = "FORTRAN";
C. char *str = "FORTRAN";
D. char str[] = {'F','O','R','T','R','A','N',0};
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346514.html
点击查看答案
以下叙述中错误的是()。
A. 可以通过typedef增加新的类型
B. 可以用typedef将已存在的类型用一个新的名字来代表
C. 用typedef定义新的类型名后,原有类型名仍有效
D. 用typedef可以为各种类型起别名,但不能为变量起别名
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346506.html
点击查看答案
C语言中,形参缺省的存储类别是()。
A. auto(自动)
B. static(静态)
C. register(寄存器)
D. extern(外部)
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346509.html
点击查看答案
下列条件语句中,输出结果与其他语句不同的是()。
A. if(a) printf(“%d\n”,x); else printf(“%d\n”,y);
B. if(a==0) printf(“%d\n”,y); else printf(“%d\n”,x);
C. if(a!=0) printf(“%d\n”,x); else printf(“%d\n”,y);
D. if(a==0) printf(“%d\n”,x); else printf(“%d\n”,y);
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e034650b.html
点击查看答案
有以下程序
#include
main()
{ int x;
scanf("%d",&x);
if(x>15) printf("%d",x-5);
if(x>10) printf("%d",x);
if(x>5) printf("%d\n",x+5);
}
若程序运行时从键盘输入12<回车>,则输出结果为( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346506.html
点击查看答案
设ch是char型变量,其值为A,且有下面的表达式:
ch=(ch>='A'&&ch<='Z')?(ch+32):ch 的值是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346512.html
点击查看答案
有以下程序
#include
main()
{char ch[3][5]={“AAAA”,”BBB”,”CC”};
printf(“%s\n”,ch[1]);
}
程序运行后的输出结果是()。
A. AAAA
B. CC
C. BBBCC
D. BBB
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346513.html
点击查看答案
有以下程序
#include
void main()
{ int s;
scanf("%d",&s);
while(s>0)
{ switch(s)
{ case 1:printf("%d",s+5);
case 2:printf("%d",s+4); break;
case 3:printf("%d",s+3);
default:printf("%d",s+1);break;
}
scanf("%d",&s);
}
}
运行时,若输入1 2 3 4 5 0<回车>,则输出结果是( )。
A. 6566456
B. 66656
C. 66666
D. 6666656
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e034650b.html
点击查看答案