ABCDDCBA
ABCD
A
DCBA
第1题:
下列程序的输出结果是______。
include<iostream.h>
include<string.h>
using namespace std;
void fun(const char*s,char &C) {c=s[strlen(s)/2];}
int main()
{
char str[]="ABCDE";
char ch=str[1];
fun(str,ch);
cout<<ch;
return 0;
}
第2题:
有以下程序: #include<stdio.h> union pw { int i; char ch[2]; }a; main() { a.ch[0]=13;a.ch[1]=0;printf("%d\n",a.i);} 程序的输出结果是( )。
A.13
B.14
C.208
D.209
第3题:
有以下程序
main( )
{ char ch[]="uvwxyz",*pc ;
pc =ch; printf("%c\n",*(pc+5));
}
程序运行后的输出结果是
A)z
B)0
C) 元素 ch[5] 的地址
D) 字符 y 的地址
第4题:
下列程序运行时,若输入labcedf2df<回车>输出结果为【 】。
include<stdio.h>
main()
{ char a=0,ch;
while((ch==getchar())!='\n')
{ if(a%2!=0&&(ch>='a'&&ch<='z')) ch=ch'a'+'A';
a++;prtchar(ch);
}
printf("\n");
}
第5题:
有以下程序: #include<stdio.h> main( ) {char ch[3][5]={"AAAA","BBB","CC"}; printf("%s\n",ch[l]); } 程序运行后的输出结果是( )。
A.AAA
B.CC
C.BBBCC
D.BBB
第6题:
在执行以下程序时,如果从键盘上输入ABCdef<回车>,则输出为______。#include <stdio.h>main (){ char ch; while ((ch=getchar())!="\n") { if (ch>='A'&& ch<='B')ch=ch+32; else if (ch>='a'&& ch<='z')ch=ch-32; printf("%c",ch); } printf("\n");}
A.ABCdef
B.abcDEF
C.abc
D.DEF
第7题:
以下程序的输出结果是( )。 #include <stdio.h> charcchar(char eh) { if(ch>='A,&&ch<='Z') ch=ch-'A'+'a'; return ch; } main() { char s[]="ABC+abc=defDEF",*p=s; while(*p) { *p=cchsr(*p); p++; } printf("%s\n",s); }
A.abc+ABC=DEFdef
B.abc+abc=defdef
C.abcABCDEFdef
D.abcabcdefdef
第8题:
有以下程序
main() {char ch[]=“uvwxyz”,*pc; Pc=ch; printf(“%c\n”,*(pc+5)); } 程序运行后的输出结果是( )。
A.z
B.0
C.元素ch[5]的地址
D.字符y的地址
第9题:
下列程序的输出结果是【 】。
include<iostream>
include<cstring>
using namespace std;
void fun(const char *s,char &c){c=s[strlen(s)/2];}
int main()
{
char str[]="ABCDE";
char ch=str[1];
fun(str,ch);
cout<<ch;
return 0;
}
第10题:
若有如下程序: main() {int a=6;char ch=c; printf("%d\n",(a&2)&&(ch<'m'));} 则程序运行后的输出结果是( )
A.0
B.1
C.2
D.3