-
Notifications
You must be signed in to change notification settings - Fork 17
feat: 软件工程学院-程序设计基础 #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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<stdio.h> | ||
| int main() { | ||
| int a = 3, b = 4; | ||
| a += b *= a + b; | ||
| printf("a=%d", a); | ||
| } | ||
| ``` | ||
|
|
||
| 2. a=\_\_\_\_ | ||
|
|
||
| ```c | ||
| #include<stdio.h> | ||
| void Anaesthesia(int b) { | ||
| static int a = 0; | ||
| a += b; | ||
| } | ||
| int main() { | ||
| Anaesthesia(5); | ||
| Anaesthesia(5); | ||
| printf("a=%d", a); | ||
|
KirisameVanilla marked this conversation as resolved.
Outdated
|
||
| } | ||
| ``` | ||
|
|
||
| 3. \_\_\_\_, \_\_\_\_ | ||
|
|
||
| ```c | ||
| #include<stdio.h> | ||
| int main() { | ||
| c = 'A' + 4 - 'Z' + 'z'; | ||
| d = 'A' + '8' - '5'; | ||
| printf("%c %d", c, d); | ||
| } | ||
| ``` | ||
|
|
||
| 4. \_\_\_\_, \_\_\_\_ | ||
|
|
||
| ```c | ||
| #include<stdio.h> | ||
| int main() { | ||
| int a = 2; | ||
| char b; | ||
| double Pi = 3.14; | ||
| printf("%d %lf", sizeof(a*b), Pi+8/3); | ||
| } | ||
| ``` | ||
|
|
||
| 5. \_\_\_\_ | ||
|
|
||
| ```c | ||
| #include<stdio.h> | ||
| 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` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| --- | ||
| title: 2025-2026学年春季期期中(邬海琴) | ||
| --- | ||
|
|
||
| ## 一、选择(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.` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这句话是人话吗