cs50p-python-reviewer 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cs50p_python_reviewer-1.0.0/MANIFEST.in +2 -0
- cs50p_python_reviewer-1.0.0/PKG-INFO +24 -0
- cs50p_python_reviewer-1.0.0/README.md +12 -0
- cs50p_python_reviewer-1.0.0/cs50p_python_reviewer.egg-info/PKG-INFO +24 -0
- cs50p_python_reviewer-1.0.0/cs50p_python_reviewer.egg-info/SOURCES.txt +10 -0
- cs50p_python_reviewer-1.0.0/cs50p_python_reviewer.egg-info/dependency_links.txt +1 -0
- cs50p_python_reviewer-1.0.0/cs50p_python_reviewer.egg-info/entry_points.txt +2 -0
- cs50p_python_reviewer-1.0.0/cs50p_python_reviewer.egg-info/requires.txt +1 -0
- cs50p_python_reviewer-1.0.0/cs50p_python_reviewer.egg-info/top_level.txt +1 -0
- cs50p_python_reviewer-1.0.0/pyproject.toml +31 -0
- cs50p_python_reviewer-1.0.0/questions.json +335 -0
- cs50p_python_reviewer-1.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cs50p-python-reviewer
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: An interactive CLI study reviewer for CS50P students.
|
|
5
|
+
Author: Ian Carlo G. Ventura
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: rich>=10.0.0
|
|
12
|
+
|
|
13
|
+
# CS50P Python Reviewer TUI
|
|
14
|
+
#### Video Demo: https://youtu.be/YOUR_VIDEO_URL
|
|
15
|
+
#### Description:
|
|
16
|
+
The CS50P Python Reviewer TUI is an interactive terminal application designed for students mastering Python fundamentals. The software uses a structured JSON database (`questions.json`) containing 5 questions per module spanning Weeks 0 through 8 of CS50P.
|
|
17
|
+
|
|
18
|
+
Features include user session tracking, personalized history viewing restricted to the current user, randomized question shuffling, optional timed challenge mode, and a missed-questions review round. The interface uses the `rich` library for formatted panels, tables, and colored prompts.
|
|
19
|
+
|
|
20
|
+
### Files Included:
|
|
21
|
+
- `project.py`: Main application code handling menu logic, user prompts, scoring, and history logging.
|
|
22
|
+
- `questions.json`: Database of multiple-choice and identification questions.
|
|
23
|
+
- `test_project.py`: Pytest test suite for core logic validation.
|
|
24
|
+
- `requirements.txt`: Package dependency list (`rich`, `pytest`).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# CS50P Python Reviewer TUI
|
|
2
|
+
#### Video Demo: https://youtu.be/YOUR_VIDEO_URL
|
|
3
|
+
#### Description:
|
|
4
|
+
The CS50P Python Reviewer TUI is an interactive terminal application designed for students mastering Python fundamentals. The software uses a structured JSON database (`questions.json`) containing 5 questions per module spanning Weeks 0 through 8 of CS50P.
|
|
5
|
+
|
|
6
|
+
Features include user session tracking, personalized history viewing restricted to the current user, randomized question shuffling, optional timed challenge mode, and a missed-questions review round. The interface uses the `rich` library for formatted panels, tables, and colored prompts.
|
|
7
|
+
|
|
8
|
+
### Files Included:
|
|
9
|
+
- `project.py`: Main application code handling menu logic, user prompts, scoring, and history logging.
|
|
10
|
+
- `questions.json`: Database of multiple-choice and identification questions.
|
|
11
|
+
- `test_project.py`: Pytest test suite for core logic validation.
|
|
12
|
+
- `requirements.txt`: Package dependency list (`rich`, `pytest`).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cs50p-python-reviewer
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: An interactive CLI study reviewer for CS50P students.
|
|
5
|
+
Author: Ian Carlo G. Ventura
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: rich>=10.0.0
|
|
12
|
+
|
|
13
|
+
# CS50P Python Reviewer TUI
|
|
14
|
+
#### Video Demo: https://youtu.be/YOUR_VIDEO_URL
|
|
15
|
+
#### Description:
|
|
16
|
+
The CS50P Python Reviewer TUI is an interactive terminal application designed for students mastering Python fundamentals. The software uses a structured JSON database (`questions.json`) containing 5 questions per module spanning Weeks 0 through 8 of CS50P.
|
|
17
|
+
|
|
18
|
+
Features include user session tracking, personalized history viewing restricted to the current user, randomized question shuffling, optional timed challenge mode, and a missed-questions review round. The interface uses the `rich` library for formatted panels, tables, and colored prompts.
|
|
19
|
+
|
|
20
|
+
### Files Included:
|
|
21
|
+
- `project.py`: Main application code handling menu logic, user prompts, scoring, and history logging.
|
|
22
|
+
- `questions.json`: Database of multiple-choice and identification questions.
|
|
23
|
+
- `test_project.py`: Pytest test suite for core logic validation.
|
|
24
|
+
- `requirements.txt`: Package dependency list (`rich`, `pytest`).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
MANIFEST.in
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
questions.json
|
|
5
|
+
cs50p_python_reviewer.egg-info/PKG-INFO
|
|
6
|
+
cs50p_python_reviewer.egg-info/SOURCES.txt
|
|
7
|
+
cs50p_python_reviewer.egg-info/dependency_links.txt
|
|
8
|
+
cs50p_python_reviewer.egg-info/entry_points.txt
|
|
9
|
+
cs50p_python_reviewer.egg-info/requires.txt
|
|
10
|
+
cs50p_python_reviewer.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rich>=10.0.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "cs50p-python-reviewer"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "An interactive CLI study reviewer for CS50P students."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Ian Carlo G. Ventura" }
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"rich>=10.0.0"
|
|
17
|
+
]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.scripts]
|
|
24
|
+
cs50p-review = "project:main"
|
|
25
|
+
|
|
26
|
+
[tool.setuptools]
|
|
27
|
+
packages = []
|
|
28
|
+
include-package-data = true
|
|
29
|
+
|
|
30
|
+
[tool.setuptools.package-data]
|
|
31
|
+
"*" = ["questions.json"]
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
{
|
|
2
|
+
"0": [
|
|
3
|
+
{
|
|
4
|
+
"type": "multiple_choice",
|
|
5
|
+
"question": "Which built-in function outputs text directly to the console?",
|
|
6
|
+
"options": ["A) input()", "B) print()", "C) format()", "D) display()"],
|
|
7
|
+
"answer": "B",
|
|
8
|
+
"explanation": "The print() function is built into Python to output text directly to the console."
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"type": "identification",
|
|
12
|
+
"question": "Which string method removes whitespace from both ends of a string?",
|
|
13
|
+
"options": [],
|
|
14
|
+
"answer": "strip",
|
|
15
|
+
"explanation": "The strip() method removes leading and trailing spaces or specified characters from a string."
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"type": "multiple_choice",
|
|
19
|
+
"question": "What is the return type of the built-in input() function?",
|
|
20
|
+
"options": ["A) int", "B) float", "C) str", "D) bool"],
|
|
21
|
+
"answer": "C",
|
|
22
|
+
"explanation": "The input() function always returns user input as a string (str) data type by default."
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"type": "identification",
|
|
26
|
+
"question": "Which built-in function converts a value into an integer?",
|
|
27
|
+
"options": [],
|
|
28
|
+
"answer": "int",
|
|
29
|
+
"explanation": "The int() function constructs an integer number from an integer literal, float, or valid string."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "multiple_choice",
|
|
33
|
+
"question": "Which operator is used to perform exponentiation in Python?",
|
|
34
|
+
"options": ["A) ^", "B) **", "C) //", "D) %"],
|
|
35
|
+
"answer": "B",
|
|
36
|
+
"explanation": "The double asterisk (**) operator is used for raising a number to a power in Python."
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"1": [
|
|
40
|
+
{
|
|
41
|
+
"type": "identification",
|
|
42
|
+
"question": "What conditional keyword is Python's abbreviation for 'else if'?",
|
|
43
|
+
"options": [],
|
|
44
|
+
"answer": "elif",
|
|
45
|
+
"explanation": "Python uses 'elif' instead of 'else if' to chain conditional checks cleanly."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"type": "multiple_choice",
|
|
49
|
+
"question": "What structural pattern matching keyword was introduced in Python 3.10?",
|
|
50
|
+
"options": ["A) switch", "B) match", "C) select", "D) case"],
|
|
51
|
+
"answer": "B",
|
|
52
|
+
"explanation": "Python 3.10 introduced structural pattern matching using the 'match' and 'case' keywords."
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"type": "multiple_choice",
|
|
56
|
+
"question": "Which comparison operator checks if two values are NOT equal[cite: 8]?",
|
|
57
|
+
"options": ["A) <>", "B) !=", "C) ==", "D) not"],
|
|
58
|
+
"answer": "B",
|
|
59
|
+
"explanation": "The '!=' operator evaluates to True if the operands on either side are not equal."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"type": "identification",
|
|
63
|
+
"question": "Which logical operator evaluates to True only if both expressions are True[cite: 8]?",
|
|
64
|
+
"options": [],
|
|
65
|
+
"answer": "and",
|
|
66
|
+
"explanation": "The 'and' operator requires all connected boolean conditions to be True for the overall statement to be True."
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"type": "multiple_choice",
|
|
70
|
+
"question": "What does bool(0) evaluate to in Python[cite: 8]?",
|
|
71
|
+
"options": ["A) True", "B) False", "C) None", "D) Error"],
|
|
72
|
+
"answer": "B",
|
|
73
|
+
"explanation": "In Python, the number 0 is considered falsy, so bool(0) evaluates to False."
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"2": [
|
|
77
|
+
{
|
|
78
|
+
"type": "multiple_choice",
|
|
79
|
+
"question": "Which loop control keyword immediately skips the current iteration and jumps to the next loop cycle[cite: 7]?",
|
|
80
|
+
"options": ["A) continue", "B) pass", "C) break", "D) exit"],
|
|
81
|
+
"answer": "A",
|
|
82
|
+
"explanation": "The 'continue' statement skips the rest of the current loop iteration and moves directly to the next cycle."
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"type": "identification",
|
|
86
|
+
"question": "Which built-in type represents an ordered, mutable sequence of items[cite: 1, 7]?",
|
|
87
|
+
"options": [],
|
|
88
|
+
"answer": "list",
|
|
89
|
+
"explanation": "Lists are ordered collections in Python that can be modified (mutable) after creation."
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"type": "multiple_choice",
|
|
93
|
+
"question": "Which built-in function generates a sequence of numbers, commonly used in for loops[cite: 7]?",
|
|
94
|
+
"options": ["A) sequence()", "B) range()", "C) loop()", "D) iterate()"],
|
|
95
|
+
"answer": "B",
|
|
96
|
+
"explanation": "The range() function returns a sequence of numbers, typically used to iterate a specific number of times in a loop."
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"type": "identification",
|
|
100
|
+
"question": "Which loop control keyword immediately terminates loop execution entirely[cite: 7]?",
|
|
101
|
+
"options": [],
|
|
102
|
+
"answer": "break",
|
|
103
|
+
"explanation": "The 'break' statement exits out of the enclosing loop completely, skipping any remaining iterations."
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"type": "multiple_choice",
|
|
107
|
+
"question": "Which data structure stores key-value pairs[cite: 7]?",
|
|
108
|
+
"options": ["A) list", "B) tuple", "C) dict", "D) set"],
|
|
109
|
+
"answer": "C",
|
|
110
|
+
"explanation": "Dictionaries (dict) store data in key-value pairs for fast lookups."
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"3": [
|
|
114
|
+
{
|
|
115
|
+
"type": "identification",
|
|
116
|
+
"question": "Which keyword begins a block of code meant to catch exceptions[cite: 1]?",
|
|
117
|
+
"options": [],
|
|
118
|
+
"answer": "except",
|
|
119
|
+
"explanation": "The 'except' block catches and handles exceptions raised inside a preceding 'try' block."
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"type": "multiple_choice",
|
|
123
|
+
"question": "Which exception is raised when dividing a number by zero[cite: 1]?",
|
|
124
|
+
"options": ["A) TypeError", "B) ValueError", "C) ZeroDivisionError", "D) ArithmeticError"],
|
|
125
|
+
"answer": "C",
|
|
126
|
+
"explanation": "Dividing any number by zero triggers a ZeroDivisionError in Python."
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"type": "identification",
|
|
130
|
+
"question": "Which keyword is used to manually raise an exception in Python[cite: 1]?",
|
|
131
|
+
"options": [],
|
|
132
|
+
"answer": "raise",
|
|
133
|
+
"explanation": "The 'raise' keyword allows programmers to force a specified exception to occur."
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"type": "multiple_choice",
|
|
137
|
+
"question": "Which exception is raised when trying to access a dictionary key that does not exist[cite: 1]?",
|
|
138
|
+
"options": ["A) KeyError", "B) IndexError", "C) NameError", "D) LookupError"],
|
|
139
|
+
"answer": "A",
|
|
140
|
+
"explanation": "Accessing a missing key in a dictionary raises a KeyError."
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"type": "identification",
|
|
144
|
+
"question": "What keyword defines a block that executes regardless of whether an exception occurred?",
|
|
145
|
+
"options": [],
|
|
146
|
+
"answer": "finally",
|
|
147
|
+
"explanation": "The 'finally' block always executes at the end of a try/except statement, useful for cleanup tasks."
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
"4": [
|
|
151
|
+
{
|
|
152
|
+
"type": "multiple_choice",
|
|
153
|
+
"question": "Which standard library module provides command-line arguments via sys.argv[cite: 6]?",
|
|
154
|
+
"options": ["A) os", "B) sys", "C) random", "D) math"],
|
|
155
|
+
"answer": "B",
|
|
156
|
+
"explanation": "The 'sys' module includes sys.argv, which holds command-line arguments passed to a script[cite: 6]."
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"type": "identification",
|
|
160
|
+
"question": "What is the name of Python's official third-party package repository[cite: 6]?",
|
|
161
|
+
"options": [],
|
|
162
|
+
"answer": "PyPI",
|
|
163
|
+
"explanation": "PyPI (Python Package Index) is the official repository where third-party Python packages are hosted[cite: 6]."
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"type": "multiple_choice",
|
|
167
|
+
"question": "Which module contains functions for generating pseudo-random numbers[cite: 6]?",
|
|
168
|
+
"options": ["A) statistics", "B) random", "C) math", "D) sys"],
|
|
169
|
+
"answer": "B",
|
|
170
|
+
"explanation": "The 'random' module provides functions like random.choice() and random.randint()[cite: 6]."
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"type": "identification",
|
|
174
|
+
"question": "What command-line package manager is standard for installing third-party libraries[cite: 6]?",
|
|
175
|
+
"options": [],
|
|
176
|
+
"answer": "pip",
|
|
177
|
+
"explanation": "'pip' is the standard package installer used to download packages from PyPI[cite: 6]."
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"type": "multiple_choice",
|
|
181
|
+
"question": "Which popular third-party module is commonly used to query web APIs[cite: 6]?",
|
|
182
|
+
"options": ["A) urllib", "B) requests", "C) http", "D) json"],
|
|
183
|
+
"answer": "B",
|
|
184
|
+
"explanation": "The 'requests' package is the standard third-party library for making HTTP requests to web APIs[cite: 6]."
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"5": [
|
|
188
|
+
{
|
|
189
|
+
"type": "identification",
|
|
190
|
+
"question": "Which keyword is used inside pytest test functions to verify conditions[cite: 5]?",
|
|
191
|
+
"options": [],
|
|
192
|
+
"answer": "assert",
|
|
193
|
+
"explanation": "The 'assert' keyword evaluates boolean expressions in tests; if False, pytest flags a failure[cite: 5]."
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"type": "multiple_choice",
|
|
197
|
+
"question": "What prefix must test files have for pytest to automatically detect them[cite: 5]?",
|
|
198
|
+
"options": ["A) check_", "B) test_", "C) eval_", "D) verify_"],
|
|
199
|
+
"answer": "B",
|
|
200
|
+
"explanation": "Pytest automatically discovers files and test functions starting with the 'test_' prefix[cite: 5]."
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"type": "identification",
|
|
204
|
+
"question": "What specific exception is raised when an assert statement fails in Python[cite: 5]?",
|
|
205
|
+
"options": [],
|
|
206
|
+
"answer": "AssertionError",
|
|
207
|
+
"explanation": "A failed assert statement natively triggers an AssertionError[cite: 5]."
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"type": "multiple_choice",
|
|
211
|
+
"question": "Which package manager command installs the testing framework[cite: 5]?",
|
|
212
|
+
"options": ["A) pip install pytest", "B) conda install pytest", "C) python test pytest", "D) get pytest"],
|
|
213
|
+
"answer": "A",
|
|
214
|
+
"explanation": "You install pytest in your terminal using 'pip install pytest'[cite: 5]."
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"type": "identification",
|
|
218
|
+
"question": "What special file name is historically used to initialize Python package directories[cite: 5]?",
|
|
219
|
+
"options": [],
|
|
220
|
+
"answer": "__init__.py",
|
|
221
|
+
"explanation": "__init__.py marks a directory as a package container[cite: 5]."
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
"6": [
|
|
225
|
+
{
|
|
226
|
+
"type": "multiple_choice",
|
|
227
|
+
"question": "Which built-in file open mode allows appending data without overwriting[cite: 4]?",
|
|
228
|
+
"options": ["A) 'r'", "B) 'w'", "C) 'a'", "D) 'b'"],
|
|
229
|
+
"answer": "C",
|
|
230
|
+
"explanation": "Mode 'a' (append) adds new data to the end of a file without destroying existing contents[cite: 4]."
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"type": "identification",
|
|
234
|
+
"question": "Which standard Python module is used to parse and write CSV tables[cite: 4]?",
|
|
235
|
+
"options": [],
|
|
236
|
+
"answer": "csv",
|
|
237
|
+
"explanation": "The 'csv' module provides reader and writer objects to handle comma-separated value files[cite: 4]."
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"type": "multiple_choice",
|
|
241
|
+
"question": "Which built-in function safely opens files and handles closing automatically using context managers[cite: 4]?",
|
|
242
|
+
"options": ["A) file()", "B) open()", "C) read()", "D) load()"],
|
|
243
|
+
"answer": "B",
|
|
244
|
+
"explanation": "The open() function combined with a 'with' statement safely manages file resources[cite: 4]."
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"type": "identification",
|
|
248
|
+
"question": "Which keyword is used to establish a context manager block when opening files[cite: 4]?",
|
|
249
|
+
"options": [],
|
|
250
|
+
"answer": "with",
|
|
251
|
+
"explanation": "The 'with' statement handles cleanup and resource closing automatically[cite: 4]."
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"type": "multiple_choice",
|
|
255
|
+
"question": "Which built-in function returns a sorted list from any iterable[cite: 4]?",
|
|
256
|
+
"options": ["A) order()", "B) arrange()", "C) sorted()", "D) sort()"],
|
|
257
|
+
"answer": "C",
|
|
258
|
+
"explanation": "The sorted() function returns a new sorted list from any iterable container[cite: 4]."
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
"7": [
|
|
262
|
+
{
|
|
263
|
+
"type": "identification",
|
|
264
|
+
"question": "Which standard library module provides support for regular expressions[cite: 3]?",
|
|
265
|
+
"options": [],
|
|
266
|
+
"answer": "re",
|
|
267
|
+
"explanation": "The 're' module implements regular expression matching operations[cite: 3]."
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"type": "multiple_choice",
|
|
271
|
+
"question": "What does the regular expression anchor symbol '^' signify[cite: 3]?",
|
|
272
|
+
"options": ["A) End of string", "B) Beginning of string", "C) Any character", "D) Zero or one repetition"],
|
|
273
|
+
"answer": "B",
|
|
274
|
+
"explanation": "The '^' anchor asserts that the match must start at the beginning of the string[cite: 3]."
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"type": "identification",
|
|
278
|
+
"question": "Which regular expression shorthand character class matches any decimal digit[cite: 3]?",
|
|
279
|
+
"options": [],
|
|
280
|
+
"answer": "\\d",
|
|
281
|
+
"explanation": "\\d matches any single digit from 0 to 9[cite: 3]."
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"type": "multiple_choice",
|
|
285
|
+
"question": "Which flag makes regular expression matching case-insensitive[cite: 2, 3]?",
|
|
286
|
+
"options": ["A) re.IGNORECASE", "B) re.LOWER", "C) re.CASELESS", "D) re.INSENSITIVE"],
|
|
287
|
+
"answer": "A",
|
|
288
|
+
"explanation": "re.IGNORECASE ensures that letters match regardless of their capitalization[cite: 2, 3]."
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"type": "identification",
|
|
292
|
+
"question": "Which regex metacharacter matches 1 or more repetitions of the preceding character[cite: 3]?",
|
|
293
|
+
"options": [],
|
|
294
|
+
"answer": "+",
|
|
295
|
+
"explanation": "The '+' metacharacter requires one or more occurrences of the element before it[cite: 3]."
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
"8": [
|
|
299
|
+
{
|
|
300
|
+
"type": "identification",
|
|
301
|
+
"question": "What special method initializes instance variables in a class object[cite: 1]?",
|
|
302
|
+
"options": [],
|
|
303
|
+
"answer": "__init__",
|
|
304
|
+
"explanation": "The __init__ method acts as the constructor method when instantiating objects[cite: 1]."
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"type": "multiple_choice",
|
|
308
|
+
"question": "What decorator defines a getter property method within a class[cite: 1]?",
|
|
309
|
+
"options": ["A) @classmethod", "B) @property", "C) @staticmethod", "D) @getter"],
|
|
310
|
+
"answer": "B",
|
|
311
|
+
"explanation": "The @property decorator allows methods to be accessed like attributes while supporting getters[cite: 1]."
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"type": "identification",
|
|
315
|
+
"question": "What keyword is used to declare a new user-defined class[cite: 1]?",
|
|
316
|
+
"options": [],
|
|
317
|
+
"answer": "class",
|
|
318
|
+
"explanation": "The 'class' keyword defines a blueprint for creating objects[cite: 1]."
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"type": "multiple_choice",
|
|
322
|
+
"question": "What decorator defines a class method bound to the class rather than its instance[cite: 1]?",
|
|
323
|
+
"options": ["A) @classmethod", "B) @property", "C) @staticmethod", "D) @bound"],
|
|
324
|
+
"answer": "A",
|
|
325
|
+
"explanation": "@classmethod receives the class as the implicit first argument instead of an instance[cite: 1]."
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"type": "identification",
|
|
329
|
+
"question": "What special method controls the string representation of an object when printed[cite: 1]?",
|
|
330
|
+
"options": [],
|
|
331
|
+
"answer": "__str__",
|
|
332
|
+
"explanation": "The __str__ method returns a readable string representation when print() is called on an object[cite: 1]."
|
|
333
|
+
}
|
|
334
|
+
]
|
|
335
|
+
}
|