运行下面的程序,输入字符串Microsoft Visual Studio,则程序的执行结果是( )。 #include<stdio.h> main() {char Chr[20]; scanf("%s",&Chr); printf("%s\n”,Chr); }
A.Microsoft Visua1 Studio
B.M
C.Microsoft
D.MicrosoflVisualStudio
第1题:
以下程序执行时如果输入Language Programming,则程序输出结果是? #include <stdio.h> main() { char str[30]; scanf("%s",str); printf("%sn",str); }
第2题:
若在程序运行时,输入:4 3,则执行下面程序输出的结果是()。 #include <stdio.h> int main() { int a,b,s; scanf("%d%d",&a,&b); s=a; if(a>b) s=b; s=s*s; printf("%dn", s); return 0; }
A.13
B.9
C.16
D.15
第3题:
运行程序,输入-5,则程序结果是 。 #include <stdio.h> void main() {int x,y; scanf("%d",&x); y=(x>=0)? x*x :-x%3; printf("%dn",y); }
第4题:
阅读下面语句,则程序的执行结果是______。
include"stdio.h"
main()
{ inta=-1,b=1,k;
if((++a<0)&&! (b--<=0))
printf("%d,%d\n",a,b);
else printf("%d,%d\n",b,a);}
第5题:
执行以下程序时输入1234567<CR>,则输出结果是【 】。
include <stdio.h>
main()
{ int a=1,b;
scanf("%2d%2d",&a,&b); prinff("%d %dhn",a,b);
}
第6题:
下列程序运行时输入1234567<CR>,则输出结果是______。
include<stdio.h>
main()
{ int a=1,b;
scanf("%2d%2d",&a,&b);printf("%d %d\n", a,b);
}
本题考查的重点是scanf函数的调用。scanf(“格式化字符串>”,地址表>),格式化字符串后可以加上场宽,本题中两个变量的场宽都为2,所以输入1234567CR>后,变量a的值为12。变址b的值为34,从而输出为12 34。
第7题:
执行下列程序时输入12345678,程序的运行结果是______。 #include<stdio.h> main() { int x,y; scanf("%2d%2d"); printf("%d\n",x+y); }
A.17
B.46
C.15
D.9
第8题:
以下程序: #include<stdio.h> main() {char str[10]; scanf("%s",&str); printf("%s\n",str); } 运行上面的程序,输入字符串how are you,则程序的执行结果是( )。
A.how
B.how are you
C.h
D.howareyou
第9题:
当执行下面的程序时,如果输入ABC,则输出结果是 ( ) # include<stdio.h> # include<string.h> main( ) { char ss [10] ="12345"; gets(ss);strcat(ss"6789");printf("%s\n",ss); }
A.ABC6789
B.ABC67
C.12345ABC6
D.ABC456789