2.2 例题分析与解答
2.2.1 选择题
3.以下程序的输出结果是 。
#include
int i=4,a; }
a=i++;
printf(\
4.下述程序的输出结果是 。
#include
char a=3,b=6; char c=a^b<<2; printf(\}
8.已知字符A的ASCII码值是65,以下程序 。
#include
{char a=’A’; int b=20; }
printf(\,%o\,(a=a+1,a+b,b),a+'a' – 'A',b );
2.3 测试题
选择题
8.如下程序的运行结果是 。
#include
{int y=3,x=3,z=1;
printf(\; }
10.以下程序的输出结果是 。
#include
printf(\,%d\\n\,++i,j--);
}
11.下列程序的输出结果是 。
#INCLUDE
{INT A=0,B=0,C=0; IF (++A>0 || ++B>0) ++C;
PRINTF(\; }
3.2.1 选择题
2.阅读以下程序:
#include
{char str[10];
scanf(\; printf(\; }
运行该程序,输入:HOW DO YOU DO,则程序的输出结果是( )。 3.若有以下程序段:
#include
{int a=2,b=5;
printf(\}
4.以下程序段:
int k;float a;double x;
scanf(\;
printf(\;
3.根据下面的程序及数据的输入和输出形式,程序中输入语句的正确形式应该为 。
main( )
{char ch1,ch2,ch3;
输入语句
printf(\;
}
4.2.1 选择题
2.读下列程序:
#include
{float a,b,t;
scanf(\;
if ( a>b) {t=a;a=b;b=t;} printf (\;
运行时从键盘输入3.8和–3.4,则正确的输出结果是 。
}
3.读下列程序:
#include
{ int x,y; scanf(\ }
y=0;
if (x>=0)
{if (x>0)y=1;} else y= -1; printf (\
当从键盘输入32时,程序输出结果为 。 4.对下述程序, 是正确判断。
#include
scanf(\if (x>y)
x=y:y=x; else x++;y++;
printf(\
5.以下程序的输出结果是 。
#include
{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; case 3:a++;b++;
}
printf(\}
7.以下程序的输出结果是 。
#include
{int a=2,b= -1,c=2; if (a
8.以下程序的输出结果是 。
#include
main ()
{int w=4 ,x=3, y=2, z=1;
printf(\:z 4.2.2 填空题 3.请写出以下程序的输出结果 。 #include {int a=100; if(a>100) printf(\ else printf(\} 4.当a=1,b=3,c=5,d=4时,执行完下面一段程序后x的值是 。 if (a if(c if(b else x=6; else x=7; 6.执行以下程序段后,变量a,b,c的值分别为 。 int x=10,y=9; int a,b,c; a=(--x= =y++)? --x:++y; b=x++; c=y; 5.2.1 选择题 3.在下述程序中,判断i>j共执行了( )次。 #include {int i=0,j=10,k=2,s=0; for(;;) {i+=k; if(i>j) } {printf(\ break;} s+=i; } 4.以下程序段的输出结果是( )。 int x=3; do {printf(\}while(!(--x)); 5.2.2 填空题 1.以下程序段的输出结果是( )。 #include while(x--); printf(\} 2.以下程序的功能是:从键盘上输入若干学生的成绩,统计并输出最高成绩和最低成绩,当输入负数时结束输入,请填空。 #include {float x,amax,amin; scanf(\amax=x;amin=x; while(【1】) } {if(x>amax)amax=x; if(【2】)amin=x; scanf(\ } printf(\ 3.以下程序段的输出结果是( )。 int k,n,m; n=10;m=1;k=1; while(k<=n) m*=2; printf(\ 4.下述程序的运行结果是( )。 #include {int s=0,k; for(k=7;k>4;k--) {switch(k) } { case 1: case 4: case 7:s++;break; case 2: case 3: case 6:break; case 0: case 5:s+=2;break; 百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库C语言程序设计学习与实践指导(源代码)在线全文阅读。
相关推荐: