单选题有以下程序#includevoidfun2(chara,charb){ printf(%c%c,a,b);}chara='A',b='B';voidfun1(){ a='C'; b='D';}main(){ fun1(); printf(%c%c,a,b); fun2('E','F');}程序的运行结果是( )AC D E FBA B E FCA B C DDC D A B
单选题
有以下程序
#include
void fun2(char a,char b)
{
printf(%c %c,a,b);
}
char a='A',b='B';
void fun1()
{
a='C';
b='D';
}
main()
{
fun1();
printf(%c %c ,a,b);
fun2('E','F');
}
程序的运行结果是( )
A
C D E F
B
A B E F
C
A B C D
D
C D A B
参考解析
解析:
调用fun1函数将全局变量a和b分别赋值为'C'和'D',然后输出全局变量a和b,最后调用fun2输出局部变量a和b的值,C语言规定,在同一源文件中,允许全局变量和局部变量同名,在局部变量作用域内,同名的全局变量不起作用,因此输出'E'和'F'。答案选择A选项。
调用fun1函数将全局变量a和b分别赋值为'C'和'D',然后输出全局变量a和b,最后调用fun2输出局部变量a和b的值,C语言规定,在同一源文件中,允许全局变量和局部变量同名,在局部变量作用域内,同名的全局变量不起作用,因此输出'E'和'F'。答案选择A选项。
相关考题:
有以下程序void fun2(char a,char b) {printf("%c%c",a,b);}char a='A',b='B';void fun1(){ a='C' ; b='D'; }main(){ fun1( );printf("%c%c",a,b);fun2('E','F');}程序的运行结果是A)CDEFB)ABEFC)ABCDD)CDAB
有以下程序:includevoid fun(char *c,intD){*c=*c+1;d+=1;printf("%c,%c",*c,D;}main( 有以下程序: #include<stdio.h> void fun(char *c,intD){ *c=*c+1; d+=1; printf("%c,%c",*c,D;} main() { char a='F',b='f'; fun(b,A); printf("%c,%c\n",a,B);} 程序的输出结果为( )。A.g,GF,gB.g,FF,gC.G,fF,GD.f,gf,g
有以下程序 void fun2 (char a,char b) {printf("%c%c",a,b);} char a='A',b='B'; void fun1(){ a='C'; b='D'; } main() { fun1(); printf("%c%c",a,b); fun2 ('E','F'); } 程序的运行结果是______。A.CDEFB.ABEFC.ABCDD.CDAB
有以下程序:includevoid fun(char**p){++P;printf("%s\n",*p);}main()char*a[]={"Morn 有以下程序: #include<stdio.h> void fun(char**p) { ++P;printf("%s\n",*p);} main() char*a[]={"Morning","Afternoon","Evening","Night"}; fun(A); } 程序的运行结果是( )。A.AfternoonB.fternoonC.MorningD.oring
有以下程序:includeincludeincludevoid f(char*s,char*t){char k;k=*s; * 有以下程序: #include<stdio.h> #include<string.h> #include void f(char*s,char*t) { char k; k=*s; *s=*t; *t=k; s++;t--; if(*s)f(s,t): } main() {char str[10]="abcdefg",*P; P=str+strlen(str)/2+1: f(p,p-2); printf("%s\n",str); } 程序运行后的输出结果是( )。A.abcdefgB.gfedcbaC.gbcdefaD.abedcfg
下述程序的输出结果是()。includevoid main(){char a=3,b=1;char c=a^b 下述程序的输出结果是( )。 #include<stdio.h> void main() {char a=3,b=1; char c=a^b<<2; printf("%d",C; }A.1B.7C.3D.2
阅读下面程序: include void funl(char a,char b) { char c; c=a;a=b;b=C; } void f 阅读下面程序:include<iostream.h>void funl(char a,char b){char c;c=a;a=b;b=C;}void fun2(char a,char b){char c;c=a;a=b;b=c;}void fun3(char a,char b){char c;c=a;a=b;b=C;}void main(){char a,b;a='A';b='B';funl(a,b);cout<<a<<b;a='A';b='B';fun2(a,b);cout<<a<<b;a='A';b='B';fun3(a,b);cout<<a<<b;}则该程序的输出为【 】。
有以下程序include void WriteStr(char*fn,char*str){FILE*fp; fp=fopen(fn,"w");fpu 有以下程序 #include <stdio.h> void WriteStr(char *fn, char *str) { FILE *fp; fp=fopen(fn,"w"); fputs(str,fp);fclose(fp); } main() { WriteStr("t1.dat","start"); WriteStr("t1.dat","end"); } 程序运行后,文件t1.dat中的内容是A.startB.endC.startendD.endrt
有以下程序: include point ( char * p) {p + = 3; }main( ) char b[4] = {'a','b','c 有以下程序: #include <stdio.h>point ( char * p) { p + = 3; }main( ) char b[4] = {'a','b','c','d'} , *p=b; point(p); printf( "% c \n" , * p);A.aB.bC.cD.d
有以下程序: include void funl (char * p){char * q; q=p; while( *q! ='\0') } (*q) 有以下程序: #include <stdio.h>void funl (char * p){ char * q; q=p; while( *q! ='\0') } (*q) ++;q++;}mains( ){ char a[ ] = { "Program" } , * p; p = a[3]; fun1 (p); printf("% s \n" ,a);}程序执行后的输出结果是( )。A.ProhsbnB.PrphsbnC.ProgsbnD.Program
有以下程序: include void f(char *s,char *t) {char k; k=*s; +s=*t; 有以下程序: #include<string.h> void f(char *s,char *t) {char k; k=*s; +s=*t; *t=k; S++; t--; if(*s) f(s,t); } main() {char.str[10]="abcdefg",*p; p=str+strlen(str) /2+1; f(p,p-2); printf("%s\n",str); } 程序运行后的输出结果是 ______。A.abcdefgB.gfedcbaC.gbcdefaD.abedcfg
下列程序段的运行结果是()。 include void main() {char str[]="ABC",*p=str; printf(" 下列程序段的运行结果是( )。#include<stdio.h>void main(){ char str[]="ABC",*p=str;printf("%d\n",*(p+3) );}A.67B.0C.字符'C'的地址D.字符'C'
有以下程序 include void fun(char **p) { ++p; printf("%s\n",*p); 有以下程序 #include <stdio.h> void fun(char **p) { ++p; printf("%s\n",*p); } main() { char *a[]={"Moming","Afternoon","Evening","Night"}; fun(a); } 程序的运行结果是A.AfternoonB.fternoonC.MorningD.orning
有以下程序 include void fun(char *t, char *s) { whil 有以下程序 #include <stdio.h> void fun(char *t, char *s) { while(*t!=0) t++; while( (*t++ = *s++ )!=0 ); main() { char ss[10]="acc",aa[10]="bbxxyy"; fun(ss, aa); printff"%s,%s\n", ss,aa); 程序的运行结果是A.accxyy, bbxxyyB.acc, bbxxyyC.accxxyy, bbxxyyD.accbbxxyy, bbxxyy
有以下程序: include main( ) {char s[ ] ="159" , * p;p=s;printf( "% c", * p + + 有以下程序: #include <stdio.h> main( ) { char s[ ] ="159" , * p; p=s; printf( "% c", * p + + ); printf("%~", * p++);}程序运行后的输出结果是( )。A.15B.16C.12D.59
有以下程序 include main() { char a=4; printf("%d/n,a=a 有以下程序 #include <stdio.h> main() { char a=4; printf("%d/n,a=a<<1); } 程序的运行结果是______。A.40B.16C.8D.4
阅读下面程序: include void fun1(char a,char b) { char c; c=a;a=b;b=c; } void f 阅读下面程序:include<iostream.h>void fun1(char a,char b){char c;c=a;a=b;b=c;}void fun2(chara,charb){char c;c=a;a=b;b=c;}void main(){char a,b;a='x';b='y';fun1(a,b);cout<<a<<b;a='x';b='y';fun2(a,b);cout<<a<<b;}则该程序的输出为______。
请读程序: includde include void fun(char * s) {char a[10]; str 请读程序: # includde<stdio.h> # include<string.> void fun(char * s) {char a[10]; strcpy(a,"STRING"); s=a; } main() { char*p; fun(p); print{("%s\n",p); } 上面程序的输出结果(表示空格) ( )A.STRINGB.STRINGC.STRINGD.不确定的值
有以下程序: void fun2(char a,char b) {printf(”%c%c”,a,b); } char a=A,b=B; void funl( ){a=C;b=D;} main( ) { funl( ); printf("%c%c",a,b); fun2(E,F); } 程序的运行结果是( )。A.CDEFB.ABEFC.ABCDD.CDAB
下列程序输出的结果是()。includeun1(char a,char b){char c;c=a;a=b;b=c;}fun2(char*a 下列程序输出的结果是( )。 #include<stdio.h> un1(char a,char b){char c;c=a;a=b;b=c;} fun2(char*a,char b){char c;c=*a;*a=b;b=c;} fun3(char*2,char*b){charc;c=*a;*a=*b;*b=c;} void main() { char a,b; a='A';b='B';funl(a,b);putchar(a);putchar(b);A.BABBABB.ABBBBAC.ABBABAD.ABABBA
有以下程序:include main( ){char P[] = {'a','b','c'} ,q[]: "abc";printf( "% d % d 有以下程序:#include <stdio.h>main( ){ char P[] = {'a','b','c'} ,q[]: "abc"; printf( "% d % d \ n", sizeof(p), sizeof(q) );}程序运行后的输出结果是( )。A.44B.33C.34D.43
有以下程序: include include void f(char * s,char*t){char k; k=*s;*s=* 有以下程序: #include <stdio.h>#include <string.h>void f(char * s,char*t){ char k; k=*s; *s=*t; *t=k; s++; t--; if( * s) f(s,t);}main( ){ char str[10] :"abedefg", * p; p = str + strlen(str)/2+1; f(p,p -2); printf( "% s \n" ,str);程序运行后的输出结果是( )。A.abcdefgB.gfedcbaC.gbcdefaD.abedcfg
下列程序输出的结果是()。includefun1(char a,char b){char c;c=a;a=b;b=c;}fun2(char* 下列程序输出的结果是( )。 #include<stdio.h> fun1(char a,char b){char c;c=a;a=b;b=c;} fun2(char*a,char b){char c;c=*a;*a=b;b=c;} fun3(char*a,char*b){char c;c=*a;*a=*b;*b=c;} void main() { char a,b; a='A';b='B';fun1(a,b);putchar(a);putchar(b); a='A';b='B';fun2(a,b);putchar(a);putchar(b); a='A';b='B';fun3(a,b);putchar(a);putchar(b); putchar('\n'); } A) B)C) D)A.BABBABB.ABBBBAC.ABBABAD.ABABBA
有以下程序 include void fun(char *t,char *s) { while(*t!=0) t++; while((*t++=*s 有以下程序#include <stdio.h>void fun(char *t,char *s){ while(*t!=0) t++;while((*t++=*s++)!=0);}main( ){ char ss[10]="acc",aa[10]="bbxxyy";fun(ss,aa); printf("%s,%s\n",ss,aa);}程序的运行结果是A.accxyy,bbxxyyB.acc,bbxxyyC.accxxyy,bbxxyyD.accbbxxyy,bbxxyy
有以下程序:include char fun(char x,char y){if(x 有以下程序: #include <stdio.h> char fun(char x,char y) { if(x<y) return x; return y; } main() { int a='9',b='8',c='7'; printf("%c\n",fun(fun(a,b),fun(b,c))); } 程序的执行结果是( )。A.函数调用出错B.8C.9D.7
有以下程序:include void swap(char * x,ehar * y){ char t;t= *x; *x: *y; *y=t;main 有以下程序:#include <stdio.h>void swap(char * x,ehar * y){ char t; t= *x; *x: *y; *y=t;main ( ){ char *s1 ="abc", * s2 ="123"; swap(s1 ,s2); printf("%s,%s \n" ,s1 ,s2);}程序执行后的输出结果是( )。A.123,abeB.abe,123C.1bc,a23D.321,cba
下列程序输出的结果是( )。 include fun1(char a,char b) {char c;c=a;a=b;b=c;} fun2 下列程序输出的结果是( )。 #include<stdio.h> fun1(char a,char b) {char c;c=a;a=b;b=c;} fun2 (char*a,char b) {char c;c=*a;*a=b;b=c;} fun3(char*a,char*b) {char c;c=*a;*a=*b;*b=c;} void main() { char a,b; a='A';b='B'; fun1 (a,b);putchar(a);putchar(b); a='A';b='B'; fun2 (a,b);putchar(a);putchar(b); a='A';b='B'; fun3 (a,b);putchar(a);putchar(b); putchar('\n'); }A.BABBABB.ABBBBAC.ABBABAD.ABABBA
单选题有以下程序#include void fun(char **p){ ++p; printf(%s,*p);}main(){ char *a[] = {Morning, Afternoon, Evening, Night}; fun(a);}程序的运行结果是( )。AAfternoonBflemoonCMorningDoming