tuandunghcmut commited on
Commit
9aaf868
·
1 Parent(s): 522d800
__pycache__/coding_examples.cpython-310.pyc ADDED
Binary file (19.4 kB). View file
 
app.py CHANGED
@@ -9,31 +9,9 @@ st.set_page_config(page_title="Coding Multiple Choice Q&A", layout="wide")
9
  # Use the specified model
10
  MODEL_PATH = "tuandunghcmut/Qwen25_Coder_MultipleChoice_v4"
11
 
12
- # Example data
13
- CODING_EXAMPLES_BY_CATEGORY = {
14
- "Python": [
15
- {
16
- "question": "Which of the following is NOT a valid way to iterate through a list in Python?",
17
- "choices": [
18
- "for item in my_list:",
19
- "for i in range(len(my_list)):",
20
- "for index, item in enumerate(my_list):",
21
- "for item from my_list:",
22
- ],
23
- "answer": "D",
24
- },
25
- {
26
- "question": "In Python, what does the `__str__` method do?",
27
- "choices": [
28
- "Returns a string representation of an object for developers",
29
- "Returns a string representation of an object for end users",
30
- "Converts a string to an object",
31
- "Checks if an object is a string",
32
- ],
33
- "answer": "B",
34
- },
35
- ]
36
- }
37
 
38
  # Flatten examples
39
  CODING_EXAMPLES = []
 
9
  # Use the specified model
10
  MODEL_PATH = "tuandunghcmut/Qwen25_Coder_MultipleChoice_v4"
11
 
12
+
13
+
14
+ from coding_examples import CODING_EXAMPLES_BY_CATEGORY
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  # Flatten examples
17
  CODING_EXAMPLES = []
coding_examples.py ADDED
@@ -0,0 +1,865 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ """
3
+ Contains 200 example coding multiple choice questions for the demo application,
4
+ organized by category.
5
+ """
6
+
7
+ # Define the examples by category
8
+ CODING_EXAMPLES_BY_CATEGORY = {
9
+ "Python": [
10
+ {
11
+ "question": "Which of the following is NOT a valid way to iterate through a list in Python?",
12
+ "choices": [
13
+ "for item in my_list:",
14
+ "for i in range(len(my_list)):",
15
+ "for index, item in enumerate(my_list):",
16
+ "for item from my_list:",
17
+ ],
18
+ "answer": "D",
19
+ },
20
+ {
21
+ "question": "In Python, what does the `__str__` method do?",
22
+ "choices": [
23
+ "Returns a string representation of an object for developers",
24
+ "Returns a string representation of an object for end users",
25
+ "Converts a string to an object",
26
+ "Checks if an object is a string",
27
+ ],
28
+ "answer": "B",
29
+ },
30
+ {
31
+ "question": "What is the output of this Python code: `print(list(filter(lambda x: x % 2 == 0, range(10))))`?",
32
+ "choices": [
33
+ "[0, 2, 4, 6, 8]",
34
+ "[1, 3, 5, 7, 9]",
35
+ "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]",
36
+ "[]",
37
+ ],
38
+ "answer": "A",
39
+ },
40
+ {
41
+ "question": "What is the output of the following Python code?\nx = [1, 2, 3]\ny = x\ny.append(4)\nprint(x)",
42
+ "choices": ["[1, 2, 3]", "[1, 2, 3, 4]", "[4, 1, 2, 3]", "Error"],
43
+ "answer": "B",
44
+ },
45
+ {
46
+ "question": "What is the correct way to check if two variables point to the same object in Python?",
47
+ "choices": ["is", "==", "equals()", "==="],
48
+ "answer": "A",
49
+ },
50
+ {
51
+ "question": "What is the output of this Python code?\nprint(0.1 + 0.2 == 0.3)",
52
+ "choices": ["False", "True", "Error", "None"],
53
+ "answer": "A",
54
+ },
55
+ {
56
+ "question": "In Python, what is a generator?",
57
+ "choices": [
58
+ "A function that returns an iterator",
59
+ "A tool that creates new modules",
60
+ "A class that generates random numbers",
61
+ "A method for creating new objects",
62
+ ],
63
+ "answer": "A",
64
+ },
65
+ {
66
+ "question": "In Python, what does the `*args` parameter do?",
67
+ "choices": [
68
+ "Allows a function to accept a variable number of positional arguments",
69
+ "Makes arguments optional",
70
+ "Multiplies all arguments",
71
+ "Unpacks a dictionary into keyword arguments",
72
+ ],
73
+ "answer": "A",
74
+ },
75
+ {
76
+ "question": "What is the output of `print(2 ** 3 ** 2)` in Python?",
77
+ "choices": ["64", "36", "512", "None of the above"],
78
+ "answer": "C",
79
+ },
80
+ {
81
+ "question": "What does the `collections.Counter` class in Python do?",
82
+ "choices": [
83
+ "Counts occurrences of elements in an iterable",
84
+ "Implements a countdown timer",
85
+ "Tracks the number of function calls",
86
+ "Counts the number of objects in memory",
87
+ ],
88
+ "answer": "A",
89
+ },
90
+ {
91
+ "question": "What is the output of `print(list(zip([1, 2, 3], [4, 5, 6, 7])))`?",
92
+ "choices": [
93
+ "[(1, 4), (2, 5), (3, 6)]",
94
+ "[(1, 4), (2, 5), (3, 6), (None, 7)]",
95
+ "[(1, 4), (2, 5), (3, 6), (7, None)]",
96
+ "Error",
97
+ ],
98
+ "answer": "A",
99
+ },
100
+ {
101
+ "question": "What is a Python decorator?",
102
+ "choices": [
103
+ "A function that takes another function and extends its behavior",
104
+ "A design pattern for creating objects",
105
+ "A tool for formatting code",
106
+ "A class for implementing UI elements",
107
+ ],
108
+ "answer": "A",
109
+ },
110
+ {
111
+ "question": "What is the output of `print([i for i in range(10) if i % 2 == 0])`?",
112
+ "choices": [
113
+ "[0, 2, 4, 6, 8]",
114
+ "[1, 3, 5, 7, 9]",
115
+ "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]",
116
+ "[]",
117
+ ],
118
+ "answer": "A",
119
+ },
120
+ {
121
+ "question": "What is the purpose of `__init__.py` files in Python packages?",
122
+ "choices": [
123
+ "To mark a directory as a Python package",
124
+ "To initialize variables when a package is imported",
125
+ "To document the package contents",
126
+ "To define package-level constants",
127
+ ],
128
+ "answer": "A",
129
+ },
130
+ {
131
+ "question": "What is the output of `print(sum(range(5)))`?",
132
+ "choices": ["10", "15", "4", "Error"],
133
+ "answer": "A",
134
+ },
135
+ ],
136
+ "JavaScript": [
137
+ {
138
+ "question": "What is a closure in JavaScript?",
139
+ "choices": [
140
+ "A function that remembers its lexical scope",
141
+ "A way to close browser windows",
142
+ "A method to terminate functions",
143
+ "A design pattern for security",
144
+ ],
145
+ "answer": "A",
146
+ },
147
+ {
148
+ "question": "Which of these is NOT a JavaScript framework/library?",
149
+ "choices": ["React", "Angular", "Django", "Vue"],
150
+ "answer": "C",
151
+ },
152
+ {
153
+ "question": "Which of these is a valid way to declare a constant in JavaScript?",
154
+ "choices": [
155
+ "const PI = 3.14",
156
+ "constant PI = 3.14",
157
+ "final PI = 3.14",
158
+ "define PI = 3.14",
159
+ ],
160
+ "answer": "A",
161
+ },
162
+ {
163
+ "question": 'What does the "this" keyword refer to in JavaScript?',
164
+ "choices": [
165
+ "The current object",
166
+ "The parent object",
167
+ "The global window object",
168
+ "The function itself",
169
+ ],
170
+ "answer": "A",
171
+ },
172
+ {
173
+ "question": "What is the difference between `==` and `===` in JavaScript?",
174
+ "choices": [
175
+ "`==` checks equality with type conversion, `===` checks equality without type conversion",
176
+ "`==` checks reference equality, `===` checks value equality",
177
+ "`==` is used for numbers, `===` is used for strings",
178
+ "There is no difference",
179
+ ],
180
+ "answer": "A",
181
+ },
182
+ {
183
+ "question": "What does the `async/await` feature do in JavaScript?",
184
+ "choices": [
185
+ "Simplifies asynchronous programming",
186
+ "Creates multithreaded code",
187
+ "Prevents memory leaks",
188
+ "Optimizes rendering in browsers",
189
+ ],
190
+ "answer": "A",
191
+ },
192
+ {
193
+ "question": "What is the main purpose of Redux in web development?",
194
+ "choices": [
195
+ "State management",
196
+ "DOM manipulation",
197
+ "Server-side rendering",
198
+ "API communication",
199
+ ],
200
+ "answer": "A",
201
+ },
202
+ {
203
+ "question": "Which of the following is NOT a primitive type in JavaScript?",
204
+ "choices": ["number", "string", "boolean", "array"],
205
+ "answer": "D",
206
+ },
207
+ {
208
+ "question": "What is the output of `console.log(typeof null)` in JavaScript?",
209
+ "choices": ["'object'", "'null'", "'undefined'", "Error"],
210
+ "answer": "A",
211
+ },
212
+ {
213
+ "question": "What is event bubbling in JavaScript?",
214
+ "choices": [
215
+ "When an event triggers on an element and then propagates up to parent elements",
216
+ "When multiple events occur simultaneously",
217
+ "When events are queued for later execution",
218
+ "When events are canceled before execution",
219
+ ],
220
+ "answer": "A",
221
+ },
222
+ {
223
+ "question": "What is the output of `console.log(1 + '2' + 3)` in JavaScript?",
224
+ "choices": ["'123'", "6", "'33'", "Error"],
225
+ "answer": "A",
226
+ },
227
+ {
228
+ "question": "What is a JavaScript Promise?",
229
+ "choices": [
230
+ "An object representing a future completion or failure of an asynchronous operation",
231
+ "A guarantee that a function will execute without errors",
232
+ "A contract between different parts of an application",
233
+ "A method for securing API endpoints",
234
+ ],
235
+ "answer": "A",
236
+ },
237
+ ],
238
+ "SQL & Databases": [
239
+ {
240
+ "question": 'What does the SQL function "ROUND()" do?',
241
+ "choices": [
242
+ "Rounds a number to the nearest integer",
243
+ "Concatenates two or more strings",
244
+ "Converts a string to lowercase",
245
+ "Returns the length of a string",
246
+ ],
247
+ "answer": "A",
248
+ },
249
+ {
250
+ "question": "What does ACID stand for in database systems?",
251
+ "choices": [
252
+ "Atomicity, Consistency, Isolation, Durability",
253
+ "Associativity, Commutativity, Identity, Distributivity",
254
+ "Authentication, Cryptography, Integrity, Decentralization",
255
+ "Availability, Consistency, Integration, Distribution",
256
+ ],
257
+ "answer": "A",
258
+ },
259
+ {
260
+ "question": "What is the purpose of normalization in databases?",
261
+ "choices": [
262
+ "To reduce data redundancy and improve data integrity",
263
+ "To improve query performance",
264
+ "To encrypt sensitive data",
265
+ "To compress data and save storage space",
266
+ ],
267
+ "answer": "A",
268
+ },
269
+ {
270
+ "question": "Which SQL statement is used to retrieve data from a database?",
271
+ "choices": ["SELECT", "FETCH", "GET", "RETRIEVE"],
272
+ "answer": "A",
273
+ },
274
+ {
275
+ "question": "What does the SQL command `GROUP BY` do?",
276
+ "choices": [
277
+ "Groups rows based on a column value",
278
+ "Sorts rows in ascending order",
279
+ "Filters rows based on a condition",
280
+ "Joins two tables",
281
+ ],
282
+ "answer": "A",
283
+ },
284
+ {
285
+ "question": "What is the purpose of the `HAVING` clause in SQL?",
286
+ "choices": [
287
+ "To filter groups that match a condition",
288
+ "To join tables",
289
+ "To select columns",
290
+ "To sort results",
291
+ ],
292
+ "answer": "A",
293
+ },
294
+ {
295
+ "question": "What is a primary key in a database?",
296
+ "choices": [
297
+ "A unique identifier for each record",
298
+ "The first column in a table",
299
+ "The fastest way to query data",
300
+ "A mandatory field in every table",
301
+ ],
302
+ "answer": "A",
303
+ },
304
+ {
305
+ "question": "What is the difference between `DELETE` and `TRUNCATE` in SQL?",
306
+ "choices": [
307
+ "`DELETE` can use WHERE condition, `TRUNCATE` removes all rows",
308
+ "`DELETE` is faster, `TRUNCATE` is slower",
309
+ "`DELETE` is for tables, `TRUNCATE` is for databases",
310
+ "`DELETE` is permanent, `TRUNCATE` can be rolled back",
311
+ ],
312
+ "answer": "A",
313
+ },
314
+ {
315
+ "question": "Which of these is a NoSQL database?",
316
+ "choices": ["MongoDB", "MySQL", "PostgreSQL", "Oracle"],
317
+ "answer": "A",
318
+ },
319
+ {
320
+ "question": "What is a foreign key in a relational database?",
321
+ "choices": [
322
+ "A field that links to a primary key in another table",
323
+ "A key used for encryption",
324
+ "A key that must be unique across all tables",
325
+ "A backup key used when the primary key fails",
326
+ ],
327
+ "answer": "A",
328
+ },
329
+ {
330
+ "question": "What is the purpose of an index in a database?",
331
+ "choices": [
332
+ "To improve query performance",
333
+ "To enforce data integrity",
334
+ "To encrypt sensitive data",
335
+ "To compress data storage",
336
+ ],
337
+ "answer": "A",
338
+ },
339
+ ],
340
+ "Algorithms & Data Structures": [
341
+ {
342
+ "question": "What is the time complexity of binary search?",
343
+ "choices": ["O(1)", "O(log n)", "O(n)", "O(n²)"],
344
+ "answer": "B",
345
+ },
346
+ {
347
+ "question": "Which data structure would be most efficient for implementing a priority queue?",
348
+ "choices": ["Array", "Linked List", "Heap", "Stack"],
349
+ "answer": "C",
350
+ },
351
+ {
352
+ "question": "Which of these sorting algorithms has the worst worst-case time complexity?",
353
+ "choices": ["Merge sort", "Quick sort", "Heap sort", "Bubble sort"],
354
+ "answer": "D",
355
+ },
356
+ {
357
+ "question": "In Big O notation, which of these is the most efficient?",
358
+ "choices": ["O(n²)", "O(n log n)", "O(n)", "O(1)"],
359
+ "answer": "D",
360
+ },
361
+ {
362
+ "question": "What is a recursive function?",
363
+ "choices": [
364
+ "A function that calls itself",
365
+ "A function that runs in the background",
366
+ "A function that cannot be modified",
367
+ "A function that returns multiple values",
368
+ ],
369
+ "answer": "A",
370
+ },
371
+ {
372
+ "question": "Which algorithm is used for finding the shortest path in a weighted graph?",
373
+ "choices": ["Dijkstra's algorithm", "Binary search", "Quicksort", "Depth-first search"],
374
+ "answer": "A",
375
+ },
376
+ {
377
+ "question": "Which of these sorting algorithms has the best average-case time complexity?",
378
+ "choices": ["Merge Sort", "Bubble Sort", "Insertion Sort", "Selection Sort"],
379
+ "answer": "A",
380
+ },
381
+ {
382
+ "question": "Which data structure follows the LIFO (Last In First Out) principle?",
383
+ "choices": ["Stack", "Queue", "Linked List", "Tree"],
384
+ "answer": "A",
385
+ },
386
+ {
387
+ "question": "What is the time complexity of inserting an element into a hash table?",
388
+ "choices": ["O(1) average case", "O(log n)", "O(n)", "O(n²)"],
389
+ "answer": "A",
390
+ },
391
+ {
392
+ "question": "What is the space complexity of a recursive Fibonacci implementation?",
393
+ "choices": ["O(n)", "O(log n)", "O(1)", "O(2^n)"],
394
+ "answer": "A",
395
+ },
396
+ {
397
+ "question": "What is the primary advantage of a B-tree over a binary search tree?",
398
+ "choices": [
399
+ "Better performance with disk-based storage",
400
+ "Simpler implementation",
401
+ "Lower memory usage",
402
+ "Faster in-memory operations",
403
+ ],
404
+ "answer": "A",
405
+ },
406
+ {
407
+ "question": "What is the worst-case time complexity of quicksort?",
408
+ "choices": ["O(n²)", "O(n log n)", "O(n)", "O(log n)"],
409
+ "answer": "A",
410
+ },
411
+ {
412
+ "question": "Which data structure is most suitable for implementing a dictionary?",
413
+ "choices": ["Hash Table", "Array", "Linked List", "Stack"],
414
+ "answer": "A",
415
+ },
416
+ {
417
+ "question": "What is the time complexity of breadth-first search on a graph?",
418
+ "choices": ["O(V + E)", "O(V * E)", "O(log V)", "O(V²)"],
419
+ "answer": "A",
420
+ },
421
+ {
422
+ "question": "What is dynamic programming?",
423
+ "choices": [
424
+ "A method for solving complex problems by breaking them into simpler subproblems",
425
+ "A programming paradigm that uses dynamic typing",
426
+ "A technique for automatically allocating memory",
427
+ "A method for optimizing code at runtime",
428
+ ],
429
+ "answer": "A",
430
+ },
431
+ ],
432
+ "Web Development": [
433
+ {
434
+ "question": "Which of these is NOT a RESTful API method?",
435
+ "choices": ["GET", "PUT", "SEARCH", "DELETE"],
436
+ "answer": "C",
437
+ },
438
+ {
439
+ "question": "What does CSS stand for?",
440
+ "choices": [
441
+ "Computer Style Sheets",
442
+ "Creative Style System",
443
+ "Cascading Style Sheets",
444
+ "Colorful Style Sheets",
445
+ ],
446
+ "answer": "C",
447
+ },
448
+ {
449
+ "question": "Which protocol is used for secure web browsing?",
450
+ "choices": ["HTTP", "FTP", "HTTPS", "SMTP"],
451
+ "answer": "C",
452
+ },
453
+ {
454
+ "question": "In CSS, which property is used to change the text color of an element?",
455
+ "choices": ["color", "text-color", "font-color", "text-style"],
456
+ "answer": "A",
457
+ },
458
+ {
459
+ "question": "What is the purpose of the `useState` hook in React?",
460
+ "choices": [
461
+ "To add state to functional components",
462
+ "To create side effects in components",
463
+ "To optimize rendering performance",
464
+ "To handle form submissions",
465
+ ],
466
+ "answer": "A",
467
+ },
468
+ {
469
+ "question": "What does API stand for?",
470
+ "choices": [
471
+ "Application Programming Interface",
472
+ "Automated Program Interaction",
473
+ "Application Process Integration",
474
+ "Advanced Programming Implementation",
475
+ ],
476
+ "answer": "A",
477
+ },
478
+ {
479
+ "question": "What is JWT used for?",
480
+ "choices": [
481
+ "Authentication and information exchange",
482
+ "JavaScript web testing",
483
+ "Java web toolkit",
484
+ "JSON web transformation",
485
+ ],
486
+ "answer": "A",
487
+ },
488
+ {
489
+ "question": "Which of these is NOT a valid HTTP status code?",
490
+ "choices": [
491
+ "200 OK",
492
+ "404 Not Found",
493
+ "500 Internal Server Error",
494
+ "600 Server Timeout",
495
+ ],
496
+ "answer": "D",
497
+ },
498
+ {
499
+ "question": "What is the purpose of CORS in web development?",
500
+ "choices": [
501
+ "To allow or restrict resources from being requested from another domain",
502
+ "To optimize CSS rendering",
503
+ "To compress HTTP responses",
504
+ "To validate HTML syntax",
505
+ ],
506
+ "answer": "A",
507
+ },
508
+ {
509
+ "question": "What is the difference between localStorage and sessionStorage?",
510
+ "choices": [
511
+ "localStorage persists after browser close, sessionStorage doesn't",
512
+ "localStorage has a smaller storage limit than sessionStorage",
513
+ "localStorage is encrypted, sessionStorage isn't",
514
+ "localStorage is for text only, sessionStorage can store objects",
515
+ ],
516
+ "answer": "A",
517
+ },
518
+ {
519
+ "question": "What is the purpose of a service worker in web development?",
520
+ "choices": [
521
+ "To enable offline functionality and background processing",
522
+ "To manage server-side rendering",
523
+ "To optimize database queries",
524
+ "To handle user authentication",
525
+ ],
526
+ "answer": "A",
527
+ },
528
+ {
529
+ "question": "What is the purpose of the `<meta viewport>` tag?",
530
+ "choices": [
531
+ "To control the viewport's size and scale for responsive design",
532
+ "To improve SEO rankings",
533
+ "To define metadata for social media sharing",
534
+ "To specify the character encoding of the document",
535
+ ],
536
+ "answer": "A",
537
+ },
538
+ ],
539
+ "Software Engineering & DevOps": [
540
+ {
541
+ "question": "Which design pattern is used when you need to create objects without specifying their concrete classes?",
542
+ "choices": [
543
+ "Observer Pattern",
544
+ "Factory Pattern",
545
+ "Singleton Pattern",
546
+ "Decorator Pattern",
547
+ ],
548
+ "answer": "B",
549
+ },
550
+ {
551
+ "question": 'In version control, what does "git rebase" do?',
552
+ "choices": [
553
+ "Integrates changes from one branch onto another",
554
+ "Reverts all changes to the last commit",
555
+ "Creates a new branch",
556
+ "Deletes the remote repository",
557
+ ],
558
+ "answer": "A",
559
+ },
560
+ {
561
+ "question": "What does the command `docker run` do?",
562
+ "choices": [
563
+ "Creates and starts a container",
564
+ "Builds a Docker image",
565
+ "Lists running containers",
566
+ "Stops a running container",
567
+ ],
568
+ "answer": "A",
569
+ },
570
+ {
571
+ "question": "What is the purpose of containerization technologies like Docker?",
572
+ "choices": [
573
+ "To package applications with all dependencies",
574
+ "To create virtual machines",
575
+ "To encrypt sensitive data",
576
+ "To compress code for distribution",
577
+ ],
578
+ "answer": "A",
579
+ },
580
+ {
581
+ "question": "What does MVC stand for in software architecture?",
582
+ "choices": [
583
+ "Model-View-Controller",
584
+ "Multiple-Version-Control",
585
+ "Most-Valuable-Component",
586
+ "Managed-Virtual-Container",
587
+ ],
588
+ "answer": "A",
589
+ },
590
+ {
591
+ "question": "What does the `git pull` command do?",
592
+ "choices": [
593
+ "Fetches changes from a remote repository and merges them",
594
+ "Uploads local changes to a remote repository",
595
+ "Creates a new branch",
596
+ "Lists all commits",
597
+ ],
598
+ "answer": "A",
599
+ },
600
+ {
601
+ "question": "What is the purpose of a load balancer?",
602
+ "choices": [
603
+ "Distributes network traffic across multiple servers",
604
+ "Increases the speed of database queries",
605
+ "Manages memory allocation in applications",
606
+ "Compresses data before storage",
607
+ ],
608
+ "answer": "A",
609
+ },
610
+ {
611
+ "question": "Which of these is NOT a principle of SOLID?",
612
+ "choices": [
613
+ "Single responsibility",
614
+ "Open/closed",
615
+ "Liskov substitution",
616
+ "Dynamic typing",
617
+ ],
618
+ "answer": "D",
619
+ },
620
+ {
621
+ "question": "What is the purpose of Continuous Integration (CI)?",
622
+ "choices": [
623
+ "To automatically build and test code changes",
624
+ "To deploy applications to production",
625
+ "To monitor application performance",
626
+ "To manage database migrations",
627
+ ],
628
+ "answer": "A",
629
+ },
630
+ {
631
+ "question": "What is the difference between CI and CD?",
632
+ "choices": [
633
+ "CI is about integration and testing; CD is about delivery or deployment",
634
+ "CI is for code; CD is for databases",
635
+ "CI is manual; CD is automated",
636
+ "CI is for development; CD is for production only",
637
+ ],
638
+ "answer": "A",
639
+ },
640
+ {
641
+ "question": "What is Infrastructure as Code (IaC)?",
642
+ "choices": [
643
+ "Managing infrastructure through code and automation",
644
+ "Writing code that runs on multiple platforms",
645
+ "Converting legacy systems to modern code",
646
+ "Implementing code reviews for infrastructure teams",
647
+ ],
648
+ "answer": "A",
649
+ },
650
+ {
651
+ "question": "What is the purpose of a Kubernetes pod?",
652
+ "choices": [
653
+ "The smallest deployable unit that can contain one or more containers",
654
+ "A storage volume for container data",
655
+ "A network interface for container communication",
656
+ "A security policy for container isolation",
657
+ ],
658
+ "answer": "A",
659
+ },
660
+ {
661
+ "question": "What is the purpose of a blue-green deployment?",
662
+ "choices": [
663
+ "To reduce downtime and risk by running two identical environments",
664
+ "To separate development and production environments",
665
+ "To implement color-coded security levels",
666
+ "To optimize resource usage in cloud environments",
667
+ ],
668
+ "answer": "A",
669
+ },
670
+ ],
671
+ "Programming Concepts": [
672
+ {
673
+ "question": "What is the result of `5 & 3` in binary operations?",
674
+ "choices": ["1", "7", "8", "15"],
675
+ "answer": "A",
676
+ },
677
+ {
678
+ "question": "What is the purpose of the `static` keyword in Java?",
679
+ "choices": [
680
+ "It makes a variable or method belong to the class, not instances",
681
+ "It prevents a class from being inherited",
682
+ "It restricts access to a method or variable",
683
+ "It makes a variable unchangeable",
684
+ ],
685
+ "answer": "A",
686
+ },
687
+ {
688
+ "question": "In OOP, what is encapsulation?",
689
+ "choices": [
690
+ "The bundling of data and methods that operate on that data",
691
+ "The ability of a class to inherit from multiple classes",
692
+ "The hiding of implementation details",
693
+ "The ability of objects to take different forms",
694
+ ],
695
+ "answer": "A",
696
+ },
697
+ {
698
+ "question": "Which language is primarily used for iOS development?",
699
+ "choices": ["Java", "Swift", "C#", "Kotlin"],
700
+ "answer": "B",
701
+ },
702
+ {
703
+ "question": "What is the difference between TCP and UDP?",
704
+ "choices": [
705
+ "TCP is connection-oriented; UDP is connectionless",
706
+ "TCP is secure; UDP is not",
707
+ "TCP is faster; UDP is more reliable",
708
+ "TCP is for web; UDP is for email",
709
+ ],
710
+ "answer": "A",
711
+ },
712
+ {
713
+ "question": "Which of these is NOT a primitive data type in Java?",
714
+ "choices": ["int", "float", "String", "char"],
715
+ "answer": "C",
716
+ },
717
+ {
718
+ "question": "What is a memory leak?",
719
+ "choices": [
720
+ "Memory allocated that is never freed",
721
+ "When a program uses too much memory",
722
+ "When memory is corrupted by a virus",
723
+ "When cache memory overflows",
724
+ ],
725
+ "answer": "A",
726
+ },
727
+ {
728
+ "question": "What is the purpose of the `virtual` keyword in C++?",
729
+ "choices": [
730
+ "It allows a method to be overridden in derived classes",
731
+ "It makes a class abstract",
732
+ "It restricts a class from being instantiated",
733
+ "It optimizes method calls at compile time",
734
+ ],
735
+ "answer": "A",
736
+ },
737
+ {
738
+ "question": "What is the key feature of a blockchain?",
739
+ "choices": [
740
+ "Distributed immutable ledger",
741
+ "Centralized data storage",
742
+ "Fast transaction processing",
743
+ "Unlimited scalability",
744
+ ],
745
+ "answer": "A",
746
+ },
747
+ {
748
+ "question": "Which protocol is used for sending emails?",
749
+ "choices": ["SMTP", "HTTP", "FTP", "SSH"],
750
+ "answer": "A",
751
+ },
752
+ {
753
+ "question": "What is the difference between a thread and a process?",
754
+ "choices": [
755
+ "Threads share memory space; processes have separate memory",
756
+ "Threads run on multiple CPUs; processes run on a single CPU",
757
+ "Threads are for I/O operations; processes are for computation",
758
+ "Threads are managed by the application; processes by the OS",
759
+ ],
760
+ "answer": "A",
761
+ },
762
+ {
763
+ "question": "What is the purpose of a mutex?",
764
+ "choices": [
765
+ "To ensure only one thread can access a resource at a time",
766
+ "To speed up multi-threaded operations",
767
+ "To allocate memory dynamically",
768
+ "To compress data for transmission",
769
+ ],
770
+ "answer": "A",
771
+ },
772
+ {
773
+ "question": "What is the difference between a stack and a heap in memory management?",
774
+ "choices": [
775
+ "Stack is for static memory allocation; heap is for dynamic allocation",
776
+ "Stack is slower; heap is faster",
777
+ "Stack is for global variables; heap is for local variables",
778
+ "Stack is managed by the OS; heap by the application",
779
+ ],
780
+ "answer": "A",
781
+ },
782
+ ],
783
+ "C & C++": [
784
+ {
785
+ "question": 'What is the output of this C code?\nint x = 5;\nprintf("%d", x++);\n',
786
+ "choices": ["5", "6", "4", "Error"],
787
+ "answer": "A",
788
+ },
789
+ {
790
+ "question": "What is a pointer in C?",
791
+ "choices": [
792
+ "A variable that stores the address of another variable",
793
+ "A variable that can point to multiple values",
794
+ "A function that returns multiple values",
795
+ "A special type of array",
796
+ ],
797
+ "answer": "A",
798
+ },
799
+ {
800
+ "question": "What does the `const` keyword do in C++?",
801
+ "choices": [
802
+ "Declares that a variable or function cannot be modified",
803
+ "Creates a constant expression",
804
+ "Defines a compile-time constant",
805
+ "All of the above",
806
+ ],
807
+ "answer": "D",
808
+ },
809
+ {
810
+ "question": "What is the difference between `new` and `malloc` in C++?",
811
+ "choices": [
812
+ "`new` calls constructors, `malloc` doesn't",
813
+ "`new` is faster than `malloc`",
814
+ "`new` is for arrays, `malloc` is for single objects",
815
+ "`new` is deprecated in modern C++",
816
+ ],
817
+ "answer": "A",
818
+ },
819
+ {
820
+ "question": "What is the purpose of the `volatile` keyword in C?",
821
+ "choices": [
822
+ "Tells the compiler that a variable may change unexpectedly",
823
+ "Makes a variable thread-safe",
824
+ "Prevents a variable from being optimized",
825
+ "Stores the variable in non-volatile memory",
826
+ ],
827
+ "answer": "A",
828
+ },
829
+ {
830
+ "question": "What is a memory leak in C++?",
831
+ "choices": [
832
+ "When memory is allocated with `new` but not freed with `delete`",
833
+ "When a program uses more memory than available",
834
+ "When memory is corrupted by buffer overflow",
835
+ "When memory is accessed after being freed",
836
+ ],
837
+ "answer": "A",
838
+ },
839
+ {
840
+ "question": 'What is the output of this C code?\nint a = 10, b = 5;\nprintf("%d", a | b);\n',
841
+ "choices": ["15", "0", "5", "10"],
842
+ "answer": "A",
843
+ },
844
+ {
845
+ "question": "What is the purpose of the `inline` keyword in C++?",
846
+ "choices": [
847
+ "Suggests that the compiler replace function calls with the function body",
848
+ "Forces a function to be defined in a header file",
849
+ "Makes a function thread-safe",
850
+ "Prevents a function from being overridden",
851
+ ],
852
+ "answer": "A",
853
+ },
854
+ {
855
+ "question": "What is the difference between a struct and a class in C++?",
856
+ "choices": [
857
+ "Members are public by default in struct, private in class",
858
+ "Structs cannot have methods, classes can",
859
+ "Structs are for POD types, classes for objects",
860
+ "Structs cannot be inherited from, classes can",
861
+ ],
862
+ "answer": "A",
863
+ },
864
+ ],
865
+ }