Spaces:
Runtime error
Runtime error
Update utils/quiz_utils.py
Browse files- utils/quiz_utils.py +16 -16
utils/quiz_utils.py
CHANGED
|
@@ -4,36 +4,36 @@ quiz_questions = {
|
|
| 4 |
"beginner": [
|
| 5 |
{"question": "What is the correct syntax to print a message in Python?",
|
| 6 |
"options": ["A. echo 'Hello'", "B. printf('Hello')", "C. print('Hello')", "D. write('Hello')"],
|
| 7 |
-
"answer": "C
|
| 8 |
{"question": "What is a correct variable name in Python?",
|
| 9 |
"options": ["A. 1variable", "B. variable1", "C. variable-1", "D. variable@1"],
|
| 10 |
-
"answer": "B
|
| 11 |
{"question": "Which of the following is a Python data type?",
|
| 12 |
"options": ["A. list", "B. array", "C. stack", "D. queue"],
|
| 13 |
-
"answer": "A
|
| 14 |
{"question": "What does `len()` do in Python?",
|
| 15 |
"options": ["A. Calculates length of a string or list", "B. Slices a list", "C. Joins strings", "D. Sorts a list"],
|
| 16 |
-
"answer": "A
|
| 17 |
{"question": "What is the output of `print(type(10))`?",
|
| 18 |
"options": ["A. int", "B. float", "C. str", "D. None"],
|
| 19 |
-
"answer": "A
|
| 20 |
],
|
| 21 |
"intermediate": [
|
| 22 |
{"question": "Which keyword is used to handle exceptions in Python?",
|
| 23 |
"options": ["A. catch", "B. handle", "C. try", "D. except"],
|
| 24 |
-
"answer": "C
|
| 25 |
{"question": "What is the result of `3 == 3.0` in Python?",
|
| 26 |
"options": ["A. True", "B. False", "C. Error", "D. None"],
|
| 27 |
-
"answer": "A
|
| 28 |
{"question": "Which of the following is an immutable data type?",
|
| 29 |
"options": ["A. List", "B. Tuple", "C. Dictionary", "D. Set"],
|
| 30 |
-
"answer": "B
|
| 31 |
{"question": "What does the `join()` method do?",
|
| 32 |
"options": ["A. Joins lists", "B. Joins elements of a list into a string", "C. Combines dictionaries", "D. Concatenates two strings"],
|
| 33 |
-
"answer": "B
|
| 34 |
{"question": "What does `list.pop()` do?",
|
| 35 |
"options": ["A. Removes and returns the last element of the list", "B. Removes a random element", "C. Sorts the list", "D. Reverses the list"],
|
| 36 |
-
"answer": "A
|
| 37 |
],
|
| 38 |
"advanced": [
|
| 39 |
{"question": "What is the purpose of the `@staticmethod` decorator in Python?",
|
|
@@ -41,27 +41,27 @@ quiz_questions = {
|
|
| 41 |
"B. To define a method that can modify a class attribute",
|
| 42 |
"C. To define a method that requires an instance",
|
| 43 |
"D. To define a private method"],
|
| 44 |
-
"answer": "A
|
| 45 |
{"question": "What is the time complexity of searching for an element in a dictionary?",
|
| 46 |
"options": ["A. O(1)", "B. O(n)", "C. O(log n)", "D. O(n^2)"],
|
| 47 |
-
"answer": "A
|
| 48 |
{"question": "What does the `zip()` function do in Python?",
|
| 49 |
"options": ["A. Combines multiple iterables element-wise",
|
| 50 |
"B. Compresses a list",
|
| 51 |
"C. Converts a tuple into a dictionary",
|
| 52 |
"D. Creates a list of pairs from two dictionaries"],
|
| 53 |
-
"answer": "A
|
| 54 |
{"question": "What is the difference between `deepcopy()` and `copy()`?",
|
| 55 |
"options": ["A. `copy()` creates a shallow copy, `deepcopy()` creates a deep copy",
|
| 56 |
"B. `copy()` is faster than `deepcopy()`",
|
| 57 |
"C. `deepcopy()` is for strings only",
|
| 58 |
-
"D
|
| 59 |
"answer": "A. `copy()` creates a shallow copy, `deepcopy()` creates a deep copy"},
|
| 60 |
{"question": "What does the `yield` keyword do?",
|
| 61 |
"options": ["A. Returns multiple values from a function",
|
| 62 |
"B. Converts a function into a generator",
|
| 63 |
"C. Pauses a function and resumes it later",
|
| 64 |
"D. Both B and C"],
|
| 65 |
-
"answer": "D
|
| 66 |
]
|
| 67 |
-
}
|
|
|
|
| 4 |
"beginner": [
|
| 5 |
{"question": "What is the correct syntax to print a message in Python?",
|
| 6 |
"options": ["A. echo 'Hello'", "B. printf('Hello')", "C. print('Hello')", "D. write('Hello')"],
|
| 7 |
+
"answer": "C"},
|
| 8 |
{"question": "What is a correct variable name in Python?",
|
| 9 |
"options": ["A. 1variable", "B. variable1", "C. variable-1", "D. variable@1"],
|
| 10 |
+
"answer": "B"},
|
| 11 |
{"question": "Which of the following is a Python data type?",
|
| 12 |
"options": ["A. list", "B. array", "C. stack", "D. queue"],
|
| 13 |
+
"answer": "A"},
|
| 14 |
{"question": "What does `len()` do in Python?",
|
| 15 |
"options": ["A. Calculates length of a string or list", "B. Slices a list", "C. Joins strings", "D. Sorts a list"],
|
| 16 |
+
"answer": "A"},
|
| 17 |
{"question": "What is the output of `print(type(10))`?",
|
| 18 |
"options": ["A. int", "B. float", "C. str", "D. None"],
|
| 19 |
+
"answer": "A"}
|
| 20 |
],
|
| 21 |
"intermediate": [
|
| 22 |
{"question": "Which keyword is used to handle exceptions in Python?",
|
| 23 |
"options": ["A. catch", "B. handle", "C. try", "D. except"],
|
| 24 |
+
"answer": "C"},
|
| 25 |
{"question": "What is the result of `3 == 3.0` in Python?",
|
| 26 |
"options": ["A. True", "B. False", "C. Error", "D. None"],
|
| 27 |
+
"answer": "A"},
|
| 28 |
{"question": "Which of the following is an immutable data type?",
|
| 29 |
"options": ["A. List", "B. Tuple", "C. Dictionary", "D. Set"],
|
| 30 |
+
"answer": "B"},
|
| 31 |
{"question": "What does the `join()` method do?",
|
| 32 |
"options": ["A. Joins lists", "B. Joins elements of a list into a string", "C. Combines dictionaries", "D. Concatenates two strings"],
|
| 33 |
+
"answer": "B"},
|
| 34 |
{"question": "What does `list.pop()` do?",
|
| 35 |
"options": ["A. Removes and returns the last element of the list", "B. Removes a random element", "C. Sorts the list", "D. Reverses the list"],
|
| 36 |
+
"answer": "A"}
|
| 37 |
],
|
| 38 |
"advanced": [
|
| 39 |
{"question": "What is the purpose of the `@staticmethod` decorator in Python?",
|
|
|
|
| 41 |
"B. To define a method that can modify a class attribute",
|
| 42 |
"C. To define a method that requires an instance",
|
| 43 |
"D. To define a private method"],
|
| 44 |
+
"answer": "A"},
|
| 45 |
{"question": "What is the time complexity of searching for an element in a dictionary?",
|
| 46 |
"options": ["A. O(1)", "B. O(n)", "C. O(log n)", "D. O(n^2)"],
|
| 47 |
+
"answer": "A"},
|
| 48 |
{"question": "What does the `zip()` function do in Python?",
|
| 49 |
"options": ["A. Combines multiple iterables element-wise",
|
| 50 |
"B. Compresses a list",
|
| 51 |
"C. Converts a tuple into a dictionary",
|
| 52 |
"D. Creates a list of pairs from two dictionaries"],
|
| 53 |
+
"answer": "A"},
|
| 54 |
{"question": "What is the difference between `deepcopy()` and `copy()`?",
|
| 55 |
"options": ["A. `copy()` creates a shallow copy, `deepcopy()` creates a deep copy",
|
| 56 |
"B. `copy()` is faster than `deepcopy()`",
|
| 57 |
"C. `deepcopy()` is for strings only",
|
| 58 |
+
"D"],
|
| 59 |
"answer": "A. `copy()` creates a shallow copy, `deepcopy()` creates a deep copy"},
|
| 60 |
{"question": "What does the `yield` keyword do?",
|
| 61 |
"options": ["A. Returns multiple values from a function",
|
| 62 |
"B. Converts a function into a generator",
|
| 63 |
"C. Pauses a function and resumes it later",
|
| 64 |
"D. Both B and C"],
|
| 65 |
+
"answer": "D"}
|
| 66 |
]
|
| 67 |
+
}
|