Skip to content

Commit caf09f7

Browse files
committed
vault backup: 2025-04-12 11:05:14
1 parent 2c97d91 commit caf09f7

File tree

3 files changed

+212
-5
lines changed

3 files changed

+212
-5
lines changed

.obsidian/workspace.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
"state": {
2828
"type": "markdown",
2929
"state": {
30-
"file": "src/Exam/习题3.md",
30+
"file": "src/SUMMARY.md",
3131
"mode": "source",
3232
"source": false
3333
},
3434
"icon": "lucide-file",
35-
"title": "习题3"
35+
"title": "SUMMARY"
3636
}
3737
}
3838
],
@@ -189,10 +189,11 @@
189189
"obsidian-git:Open Git source control": false
190190
}
191191
},
192-
"active": "c487bde9a89d6ced",
192+
"active": "f6128934069336ba",
193193
"lastOpenFiles": [
194-
"src/18.内置函数/内置函数.md",
194+
"src/Exam/习题4.md",
195195
"src/Exam/习题3.md",
196+
"src/18.内置函数/内置函数.md",
196197
"src/SUMMARY.md",
197198
"src/Exam/习题.md",
198199
"src/Exam/习题2.md",
@@ -225,7 +226,6 @@
225226
"src/22.排序算法/排序算法.md",
226227
"src/23.二分法查找/二分法查找.md",
227228
"C++ CSP-J/C++ 之 CSP-J 主要内容.md",
228-
"C++ CSP-J/数据类型.md",
229229
"C++ CSP-J",
230230
"Untitled.canvas",
231231
"(25.常用内建模块",

src/Exam/习题4.md

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
# PCEP & PCAP Certification Practice Questions
2+
3+
## 一、单选题(共20题,每题仅一个正确答案)
4+
5+
1. 哪一选项可以正确输出字符串的长度?
6+
- A. `len["hello"]`
7+
- B. `size("hello")`
8+
- C. `length("hello")`
9+
- D. `len("hello")`
10+
11+
2. 以下哪一项是合法的变量名?
12+
- A. `2value`
13+
- B. `value_2`
14+
- C. `value-2`
15+
- D. `@value`
16+
17+
3. 运行以下代码的结果是什么?
18+
```python
19+
print(2 ** 3)
20+
```
21+
- A. 5
22+
- B. 6
23+
- C. 8 ✅
24+
- D. 9
25+
26+
4. 以下哪个关键字用于定义函数?
27+
- A. `func`
28+
- B. `def`
29+
- C. `function`
30+
- D. `define`
31+
32+
5.`x = 5`,以下哪条语句可判断 x 是否等于 5?
33+
- A. `if x = 5:`
34+
- B. `if x == 5:`
35+
- C. `if x === 5:`
36+
- D. `if x => 5:`
37+
38+
6. 哪个不是 Python 的逻辑运算符?
39+
- A. `and`
40+
- B. `or`
41+
- C. `not`
42+
- D. `nor`
43+
44+
7. `list.append(x)` 方法的作用是?
45+
- A. 返回新的列表
46+
- B. 删除 x
47+
- C. 在末尾添加 x ✅
48+
- D. 在开头插入 x
49+
50+
8. 以下哪项不是 Python 的数据类型?
51+
- A. `tuple`
52+
- B. `list`
53+
- C. `map`
54+
- D. `set`
55+
56+
9. 以下哪个语句用于捕获异常?
57+
- A. `handle`
58+
- B. `try-except`
59+
- C. `error-catch`
60+
- D. `check`
61+
62+
10. 若有字符串 `s = "Python"`,执行 `s[0]` 得到?
63+
- A. `"P"`
64+
- B. `"y"`
65+
- C. `"n"`
66+
- D. 报错
67+
68+
11. Python 中,哪个是浮点除法?
69+
- A. `//`
70+
- B. `/`
71+
- C. `%`
72+
- D. `*`
73+
74+
12. 以下哪个模块用于生成随机数?
75+
- A. `math`
76+
- B. `sys`
77+
- C. `random`
78+
- D. `os`
79+
80+
13. 在函数内部修改全局变量,应使用哪个关键字?
81+
- A. `local`
82+
- B. `static`
83+
- C. `global`
84+
- D. `public`
85+
86+
14. 如何定义一个字典?
87+
- A. `[]`
88+
- B. `()`
89+
- C. `{}`
90+
- D. `<>`
91+
92+
15. `x = [1, 2, 3]`,哪条语句可以删除最后一个元素?
93+
- A. `x.remove()`
94+
- B. `x.pop()`
95+
- C. `del x[0]`
96+
- D. `x.delete()`
97+
98+
16. 如果一个模块名为 `math`,正确的导入方式是?
99+
- A. `import math`
100+
- B. `load math`
101+
- C. `using math`
102+
- D. `require math`
103+
104+
17. 类的构造函数方法名是?
105+
- A. `__build__`
106+
- B. `__init__`
107+
- C. `__new__`
108+
- D. `__create__`
109+
110+
18. 哪个语句用于退出循环?
111+
- A. `exit`
112+
- B. `stop`
113+
- C. `break`
114+
- D. `return`
115+
116+
19. 在类中定义方法时,第一个参数通常是?
117+
- A. `this`
118+
- B. `self`
119+
- C. `cls`
120+
- D. `obj`
121+
122+
20. 若想让某模块只在直接运行时执行某段代码,正确做法是?
123+
- A. `if __main__ == "__name__":`
124+
- B. `if __name__ == "__main__":`
125+
- C. `if name == "main":`
126+
- D. `if run == True:`
127+
128+
## 二、多选题(共10题,至少两个选项正确)
129+
130+
21. 以下哪些是合法的数据结构?
131+
- A. `list`
132+
- B. `set`
133+
- C. `dict`
134+
- D. `int`
135+
136+
22. 以下哪些是 Python 的关键字?
137+
- A. `def`
138+
- B. `class`
139+
- C. `import`
140+
- D. `define`
141+
142+
23. 关于字符串的方法,以下哪些是正确的?
143+
- A. `"abc".upper()`
144+
- B. `"abc".append("d")`
145+
- C. `"abc".replace("a", "x")`
146+
- D. `"abc".split()`
147+
148+
24. 以下哪些属于布尔值操作?
149+
- A. `not`
150+
- B. `and`
151+
- C. `or`
152+
- D. `xor`
153+
154+
25. 以下哪些语句会引发异常?
155+
- A. `int("abc")`
156+
- B. `1 / 0`
157+
- C. `open("nofile.txt")`
158+
- D. `print("hello")`
159+
160+
26. 以下哪些函数属于内置函数?
161+
- A. `len()`
162+
- B. `input()`
163+
- C. `sum()`
164+
- D. `main()`
165+
166+
27. 关于 `for` 循环,以下哪些语法是正确的?
167+
- A. `for i in range(5):`
168+
- B. `for i from 1 to 10:`
169+
- C. `for item in my_list:`
170+
- D. `foreach item in my_list:`
171+
172+
28. 关于异常处理,以下哪些写法是合法的?
173+
- A.
174+
```python
175+
try:
176+
...
177+
except:
178+
...
179+
``` ✅
180+
- B.
181+
```python
182+
try:
183+
...
184+
catch:
185+
...
186+
```
187+
- C.
188+
```python
189+
try:
190+
...
191+
except ValueError:
192+
...
193+
``` ✅
194+
- D. `raise Exception("Error")`
195+
196+
29. 以下关于类的说法正确的是?
197+
- A. 类可以有多个方法 ✅
198+
- B. 类可以继承 ✅
199+
- C. 类必须有构造方法
200+
- D. 类是一种对象模板 ✅
201+
202+
30. 关于模块的使用,以下哪些是正确的?
203+
- A. `import math`
204+
- B. `from math import sqrt`
205+
- C. `require(math)`
206+
- D. `math.sqrt(4)`

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
- [习题1](./Exam/习题.md)
5252
- [习题2](./Exam/习题2.md)
5353
- [习题3](./Exam/习题3.md)
54+
- [习题4](./Exam/习题4.md)
5455
## 附录
5556

5657
[进制转换](进制转换.md)

0 commit comments

Comments
 (0)