c
z
/0
d
第1题:
若有定义:int k;,以下程序段的输出结果是______。for(k=2;k<6;k++,k++)printf("%d",k);
本题主要考查for循环语句。for循环的增量表达式为逗号表达式,相当于k+=2;,即每次循环后k增加2。第一次循环时,k=2,因此输出##2;第二次循环时k=4,输出##4。此后k=6,不满足循环条件。
第2题:
有以下程序段 main() { char a[7]="abcdef"; charb[4]="ABC"; strcpy(a,b) ; printf("%c",a[5]); } 程序段运行后的输出结果是( )
A.a
B.\0
C.e
D.f
第3题:
A.0
B.1
C.5
D.6
第4题:
A.c
B.z
C.\0
D.d
第5题:
有以下程序(strcpy为字符串复制函数,strcat为字符串连接函数): #include<stdio.h> #include<string.h> main( ) {char a[10]="abc",b[10]="012",c[10]="xyz"; strcpy(a+1,b+2); puts(strcat(a,c+1)); } 程序运行后的输出结果是( )。
A.al2xyz
B.12yz
C.a2yz
D.bc2yz
第6题:
若有如下程序: main() { int n=2; do {printf("%d",n--);} while(!--n)); } 则程序运行后的输出结果是( )。
A.2
B.11
C.1
D.20
第7题:
若有定义:chara[]="abcdef";charb[]="xyz";则以下程序段运行后屏幕输出为() strcpy(a,b); printf("%c",a[2]);
第8题:
以下程序段运行后屏幕输出为() chara[]="abc/0mis"; printf("%d",strlen(a));
第9题:
若定义chara[80]=”95”,b[]=”windows”;,语句printf(”%s”,strcpy(a,b));的输出结果为()
第10题:
5
8
3
4
第11题:
you!
Howareyou!
areyou!
are you!
第12题:
C D E F
A B E F
A B C D
C D A B
第13题:
以下程序运行后,如果从键盘上输入ABCDEF<回车>,则输出结果为______。 #include<stdio.h> #include<string.h> func(char str[]) { int num=0; while(*(str+num)!='\0') num++; return(num);p } main() { char str[10],*p=str; gets(p);printf("%d\n",func(P)); }
A.8
B.7
C.6
D.5
第14题:
若有定义:char*st="how are you";,下列程序段中正确的是
A.chara[11],*p;strcpy(p=a+1,&st[4]);
B.chara[11];strcpy(++a,st);
C.chara[11];strcpy(a,st);
D.chara[],*p;strcpy(p=&a[1],st+2);
第15题:
A.5
B.8
C.3
D.4
第16题:
若有以下定义语句: char * sl="12345", * s2="1234"; printf("%d"n",strlen(strcpy(s1,s2))); 则输出结果是 ( )
A.4
B.5
C.9
D.10
第17题:
在执行以下程序时,如果从键盘上输入:ABCdef<回车>,则输出为______。 main() { char ch; while((ch=getchar())!='\n') { if(ch>='A' && ch<='Z') ch=ch+32; else if(ch>='a'&&ch<='2')ch=ch-32; printf("%c",ch); } printf("\n"); }
A.ABCdef
B.abcDEF
C.abc
D.DEF
第18题:
数字字符'0'的ASCII值为48,若有以下程序: #include <stdio.h> main( ) char a='1',b ='2'; printf( "% c,",b + + ); printf(" % d \n" ,b - a); } 程序运行后的输出结果是( )。
A.3,2
B.50,2
C.2,2
D.2,50
第19题:
下面程序段的运行结果是()。 char a[7]= “abcdef”; char b[4]= “ABC”; strcpy(a,b); printf(“%c”,a[5]);
第20题:
设已有定义:char*st=”howareyou”;下列程序段中正确的是()。
第21题:
f
e
/0
∪(∪表示空格)
第22题:
aBcDeF
ABCDEF
AbCdEf
abcdef
第23题:
a12xyz
12yz
a2yz
bc2yz