见面课2-C君和你一起玩结构化编程
1.
【单选题】 (1分)
以下哪一个不是结构化程序设计的基本控制结构______。
答案:算法结构

2.【单选题】 (1分)
有以下程序
#include<stdio.h>
void main( ){
int x = 0x13;
if (x = 0x12) printf("True");
printf("False\n");
}
程序运行后的输出结果是________。
答案:TrueFalse

3.
【单选题】 (1分)
有以下程序:
#include <stdio.h>
void main() {
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("a=%d,b=%d\n", a, b);
}
程序的运行结果是________。
答案:a=2,b=1

4.
【单选题】 (1分)
若变量已正确定义,有以下程序段
i=0;
do printf("%d,",i); while( i++ );
printf("%d\n",i);
其输出结果是_______。
答案:0,1

5.
【单选题】 (1分)
有以下程序
#include <stdio.h>
void main() {
int x,a=1,b=1;
while(1) {
scanf("%d",&x);
if(x>0) {
a*=x;
break;
}
if(x<0) {
b*=x;
continue;
}
printf("%d,%d\n",a,b);
}
}
程序运行时输入:-1 -2 0 1 <回车>,则输出结果是________。
答案:1,2
