SharedCourses/docs/undergraduate/软件工程学院/程序设计基础/2025-2026-1_期中_邬海琴.md

86 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 2025-2026学年春季期期中(whq)
---
## 一、选择20 分) 10道
函数可以没有返回值
实参形参必须完全一致
函数里不允许嵌套定义函数
## 二、填空20 分)
1. 静态变量关键词\_\_\_\_常态变量关键词\_\_\_\_
2. ```c
#include<stdio.h>
int main() {
int a = 3, b = 2;
float c = 3 * 5 / b;
printf("%.2f",c);
}
```
\_\_\_\_
3. `a = 9, b = 2``!(a * 2 % 4) && (c = 2) || (7 - 2 * b > 2)` 输出\_\_\_\_
4. `unsigned int` 取值多少 \_\_\_\_
5. `short arr[11];` 占用\_\_\_\_ bit(s)
## 三、判断输出20 分)
1. ```c
#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;
}
```
2. ```c
#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 分)
1. 求五个数中的中位数
**Input**
> `5 2 4 3 1`
**Output**
> `3`
2.`100~999` 的素数水仙花数,如果没有,输出`No Such Number.`
**Input**
>
**Output**
> `No Such Number.`