2025-2026学年春季期期中(邬海琴)
一、选择(20 分) 10道
函数可以没有返回值
实参形参必须完全一致
函数里不允许嵌套定义函数
二、填空(20 分)
-
静态变量关键词____,常态变量关键词____
-
____
#include<stdio.h>
int main() {
int a = 3, b = 2;
float c = 3 * 5 / b;
printf("%.2f",c);
} -
a = 9, b = 2,!(a * 2 % 4) && (c = 2) || (7 - 2 * b > 2)输出____ -
unsigned int取值多少 ____ -
short arr[11];占用____ bit(s)
三、判断输出(20 分)
-
#include<stdio.h>
int main() {
int row = 3, col = 4, i, j;
for(i = 0; i < row; i++) {
printf("#");
for(j = 0; j < col; j ++) {
if(i == j) break;
if(i == col - j) continue;
printf("*");
}
printf("\n");
}
return 0;
} -
#include<stdio.h>
#define SQUARE(x) x*x
int main() {
int a = 5;
int b = SQUARE(a + 1);
printf("SQUARE(a+1):%d",b);
return 0;
}
四、手写代码(40 分)
-
求五个数中的中位数
Input
5 2 4 3 1Output
3 -
求
100~999的素数水仙花数,如果没有,输出No Such Number.Input
无
Output
No Such Number.