diff --git a/docs/undergraduate/软件工程学院/程序设计基础/2025-2026-1_期中_张泉.md b/docs/undergraduate/软件工程学院/程序设计基础/2025-2026-1_期中_张泉.md new file mode 100644 index 0000000..f572895 --- /dev/null +++ b/docs/undergraduate/软件工程学院/程序设计基础/2025-2026-1_期中_张泉.md @@ -0,0 +1,128 @@ +--- +title: 2025-2026学年春季期期中(张泉) +--- + +## 一、判断(16 分) + +1. 变量定义可以数字开头 +2. C 语言是面向过程的语言 +3. `(x % 2 == 0) && (6 <= x <= 10)` 表示 $[6,10]$ 的偶数 +4. 不符合逻辑顺序的代码如果代码紧凑,则符合书写规范(大意如此) +5. 假定 `a, b` 是 `double` 类型。`printf("%lf", (a = 2, b = a + 3 / 2))` 输出是 `3.000000` + +## 二、读代码(25 分) + +1. a=\_\_\_\_ + + ```c + #include + int main() { + int a = 3, b = 4; + a += b *= a + b; + printf("a=%d", a); + } + ``` + +2. a=\_\_\_\_

a=\_\_\_\_ + + ```c + #include + void Anaesthesia(int b) { + static int a = 0; + a += b; + printf("a=%d\n", a); + } + int main() { + Anaesthesia(5); + Anaesthesia(5); + } + ``` + +3. \_\_\_\_, \_\_\_\_ + + ```c + #include + int main() { + c = 'A' + 4 - 'Z' + 'z'; + d = 'A' + '8' - '5'; + printf("%c %d", c, d); + } + ``` + +4. \_\_\_\_, \_\_\_\_ + + ```c + #include + int main() { + int a = 2; + char b; + double Pi = 3.14; + printf("%d %lf", sizeof(a*b), Pi+8/3); + } + ``` + +5. \_\_\_\_ + + ```c + #include + int main() { + int a = 5, b = 10, c = 15; + if((a -= 5) || (b = a) && (c -= 1)) { + c += 5; + } else { + c -= 5; + } + printf("%d", c); + } + ``` + +## 三、选择题(25分)(注:题面暂缺) + +函数不允许嵌套定义函数(函数里不可以定义函数) + +编译成功一定运行一定成功 + +变量定义是下划线、字母、数字随意组合 + +3. 正确的是() + A. `char` 可以取余 + B. `(a = 3, b = 5, a + b)` 的值是 $3$ + C. `i++` 和 `++i` 任何情况下都一样 + D. 赋值运算符优先级高于所有基本运算符 + +## 四、手写代码(35 分) + +1. 定义一个常量 $E=2.71828$, 输出 $E^3$ (保留五位小数) + + **Input** + + > 无 + + **Output** + + > `20.08553` + +2. 给入一个值 `n`, 打出表格 + + **Input** + + > `4` + + **Output** + + > ```text + > ***# + > **#* + > *#** + > #*** + > ``` + +3. 输入一个字母,小写转大写,大写转小写 + + **Input** + + > `a` + + **Output** + + > `A` diff --git a/docs/undergraduate/软件工程学院/程序设计基础/2025-2026-1_期中_邬海琴.md b/docs/undergraduate/软件工程学院/程序设计基础/2025-2026-1_期中_邬海琴.md new file mode 100644 index 0000000..5325a15 --- /dev/null +++ b/docs/undergraduate/软件工程学院/程序设计基础/2025-2026-1_期中_邬海琴.md @@ -0,0 +1,84 @@ +--- +title: 2025-2026学年春季期期中(邬海琴) +--- + +## 一、选择(20 分) 10道 + +函数可以没有返回值 + +实参形参必须完全一致 + +函数里不允许嵌套定义函数 + +## 二、填空(20 分) + +1. 静态变量关键词\_\_\_\_,常态变量关键词\_\_\_\_ + +2. \_\_\_\_ + + ```c + #include + 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 + 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 + #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.`