-
Notifications
You must be signed in to change notification settings - Fork 0
/
questions.js
3312 lines (3308 loc) · 119 KB
/
questions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
export const questions = [
{
"id": 1,
"question": "Which of the following is a valid variable declaration in Python?",
"options": ["var 1", "1var", "var_1", "$var"],
"answer": "var_1",
"points": 100
},
{
"id": 2,
"question": "What does the '==' operator do in Python?",
"options": ["Assigns a value", "Compares two values", "Concatenates strings", "Checks for membership"],
"answer": "Compares two values",
"points": 100
},
{
"id": 3,
"question": "Which of the following is a loop structure in Python?",
"options": ["if", "for", "try", "def"],
"answer": "for",
"points": 100
},
{
"id": 4,
"question": "Which keyword is used to define a function in Python?",
"options": ["function", "def", "func", "lambda"],
"answer": "def",
"points": 100
},
{
"id": 5,
"question": "Which of the following is an immutable data type in Python?",
"options": ["List", "Dictionary", "Set", "Tuple"],
"answer": "Tuple",
"points": 100
},
{
"id": 6,
"question": "What does the 'len()' function do in Python?",
"options": ["Returns the length of an object", "Calculates the sum of elements", "Finds the maximum value", "Sorts a list"],
"answer": "Returns the length of an object",
"points": 100
},
{
"id": 7,
"question": "Which of the following is a correct syntax for a Python list?",
"options": ["(1, 2, 3)", "{1, 2, 3}", "[1, 2, 3]", "1, 2, 3"],
"answer": "[1, 2, 3]",
"points": 100
},
{
"id": 8,
"question": "How do you start a comment in Python?",
"options": ["//", "/*", "#", "--"],
"answer": "#",
"points": 100
},
{
"id": 9,
"question": "Which of the following is a Python keyword?",
"options": ["return", "print", "input", "len"],
"answer": "return",
"points": 100
},
{
"id": 10,
"question": "Which built-in function can be used to create a range of numbers in Python?",
"options": ["range()", "list()", "set()", "dict()"],
"answer": "range()",
"points": 100
},
{
"id": 11,
"question": "Which of the following is used to handle exceptions in Python?",
"options": ["try", "catch", "error", "except"],
"answer": "try",
"points": 100
},
{
"id": 12,
"question": "How do you create an empty dictionary in Python?",
"options": ["[]", "{}", "()", "''"],
"answer": "{}",
"points": 100
},
{
"id": 13,
"question": "What is the output of the expression 2 ** 3 in Python?",
"options": ["6", "8", "9", "5"],
"answer": "8",
"points": 100
},
{
"id": 14,
"question": "Which of the following is a valid list slicing syntax in Python?",
"options": ["list[0:3]", "list(0:3)", "list{0:3}", "list<0:3>"],
"answer": "list[0:3]",
"points": 100
},
{
"id": 15,
"question": "How do you check the data type of a variable in Python?",
"options": ["type(var)", "dataType(var)", "checkType(var)", "getType(var)"],
"answer": "type(var)",
"points": 100
},
{
"id": 16,
"question": "Which method is used to add an item to a list in Python?",
"options": ["add()", "insert()", "append()", "push()"],
"answer": "append()",
"points": 100
},
{
"id": 17,
"question": "Which of the following is used to create a new set in Python?",
"options": ["[]", "{}", "()", "set()"],
"answer": "set()",
"points": 100
},
{
"id": 18,
"question": "How do you remove whitespace from the beginning and end of a string in Python?",
"options": ["strip()", "trim()", "remove()", "delete()"],
"answer": "strip()",
"points": 100
},
{
"id": 19,
"question": "Which of the following is a valid way to import a module in Python?",
"options": ["import math", "import-math", "include math", "require math"],
"answer": "import math",
"points": 100
},
{
"id": 20,
"question": "Which function converts a string to an integer in Python?",
"options": ["int()", "str()", "float()", "bool()"],
"answer": "int()",
"points": 100
},
{
"id": 21,
"question": "Which of the following is a valid file mode in Python?",
"options": ["r", "write", "open", "start"],
"answer": "r",
"points": 100
},
{
"id": 22,
"question": "What does the 'break' statement do in a loop in Python?",
"options": ["Exits the loop", "Skips the current iteration", "Restarts the loop", "Continues to the next iteration"],
"answer": "Exits the loop",
"points": 100
},
{
"id": 23,
"question": "Which of the following is a built-in function to get the absolute value of a number in Python?",
"options": ["abs()", "round()", "max()", "sum()"],
"answer": "abs()",
"points": 100
},
{
"id": 24,
"question": "How do you start a multi-line comment in Python?",
"options": ["/*", "//", "'''", "<!--"],
"answer": "'''",
"points": 100
},
{
"id": 25,
"question": "Which of the following methods removes the last item in a list in Python?",
"options": ["pop()", "remove()", "del()", "drop()"],
"answer": "pop()",
"points": 100
},
{
"id": 26,
"question": "Which operator is used for floor division in Python?",
"options": ["/", "//", "%", "**"],
"answer": "//",
"points": 100
},
{
"id": 27,
"question": "What is the output of 'print(\"Hello\" + \" World\")' in Python?",
"options": ["Hello World", "HelloWorld", "Hello World", "None"],
"answer": "Hello World",
"points": 100
},
{
"id": 28,
"question": "Which of the following can be used to handle exceptions in Python?",
"options": ["try/except", "catch/except", "try/finally", "handle/catch"],
"answer": "try/except",
"points": 100
},
{
"id": 29,
"question": "Which of the following functions is used to get the largest item in an iterable in Python?",
"options": ["max()", "sum()", "min()", "avg()"],
"answer": "max()",
"points": 100
},
{
"id": 30,
"question": "What is the correct way to create a tuple in Python?",
"options": ["(1, 2, 3)", "[1, 2, 3]", "{1, 2, 3}", "<1, 2, 3>"],
"answer": "(1, 2, 3)",
"points": 100
},
{
"id": 31,
"question": "Which of the following is a mutable data type in Python?",
"options": ["List", "String", "Tuple", "Integer"],
"answer": "List",
"points": 100
},
{
"id": 32,
"question": "Which method can be used to join two lists in Python?",
"options": ["join()", "extend()", "append()", "concatenate()"],
"answer": "extend()",
"points": 100
},
{
"id": 33,
"question": "What will the expression 5 % 2 return in Python?",
"options": ["0", "1", "2", "3"],
"answer": "1",
"points": 100
},
{
"id": 34,
"question": "Which method is used to return the number of elements in a list in Python?",
"options": ["length()", "count()", "size()", "len()"],
"answer": "len()",
"points": 100
},
{
"id": 35,
"question": "Which method can be used to sort a list in ascending order in Python?",
"options": ["sort()", "order()", "arrange()", "shuffle()"],
"answer": "sort()",
"points": 100
},
{
"id": 36,
"question": "Which of the following is not a built-in data type in Python?",
"options": ["list", "tuple", "dict", "array"],
"answer": "array",
"points": 100
},
{
"id": 37,
"question": "How do you declare a global variable in Python?",
"options": ["global var", "declare var", "var global", "var"],
"answer": "global var",
"points": 100
},
{
"id": 38,
"question": "Which function is used to get the length of a string in Python?",
"options": ["len()", "length()", "size()", "count()"],
"answer": "len()",
"points": 100
},
{
"id": 39,
"question": "Which of the following is used to create an anonymous function in Python?",
"options": ["def", "lambda", "func", "anon"],
"answer": "lambda",
"points": 100
},
{
"id": 40,
"question": "Which keyword is used to check if a value is present in a list in Python?",
"options": ["exists", "in", "has", "present"],
"answer": "in",
"points": 100
},
{
"id": 41,
"question": "What is the output of 'print(2 + 3 * 2)' in Python?",
"options": ["7", "10", "12", "8"],
"answer": "8",
"points": 100
},
{
"id": 42,
"question": "Which of the following methods can be used to get the ASCII value of a character in Python?",
"options": ["char()", "ord()", "ascii()", "chr()"],
"answer": "ord()",
"points": 100
},
{
"id": 43,
"question": "Which of the following is used to start a loop in Python?",
"options": ["loop", "while", "iterate", "for"],
"answer": "for",
"points": 100
},
{
"id": 44,
"question": "Which function is used to open a file in Python?",
"options": ["open()", "file()", "read()", "write()"],
"answer": "open()",
"points": 100
},
{
"id": 45,
"question": "Which of the following is a valid variable name in Python?",
"options": ["1var", "var_1", "var-1", "var 1"],
"answer": "var_1",
"points": 100
},
{
"id": 46,
"question": "What is the correct way to create a dictionary in Python?",
"options": ["{key: value}", "[key: value]", "(key: value)", "<key: value>"],
"answer": "{key: value}",
"points": 100
},
{
"id": 47,
"question": "Which function is used to iterate over items in a list in Python?",
"options": ["for item in list", "list.forEach", "loop item in list", "list.each"],
"answer": "for item in list",
"points": 100
},
{
"id": 48,
"question": "Which of the following is a valid way to write a string in Python?",
"options": ["'Hello'", "\"Hello\"", "'''Hello'''", "All of the above"],
"answer": "All of the above",
"points": 100
},
{
"id": 49,
"question": "Which of the following is not a Python keyword?",
"options": ["elif", "yield", "assert", "function"],
"answer": "function",
"points": 100
},
{
"id": 50,
"question": "Which of the following is the correct syntax for a function definition in Python?",
"options": ["def functionName():", "func functionName():", "function functionName():", "functionName def():"],
"answer": "def functionName():",
"points": 100
},
{
"id": 51,
"question": "How do you convert a list to a set in Python?",
"options": ["set(list)", "list.set()", "convert(list)", "toSet(list)"],
"answer": "set(list)",
"points": 100
},
{
"id": 52,
"question": "Which of the following methods can be used to remove an item from a dictionary in Python?",
"options": ["pop()", "remove()", "delete()", "discard()"],
"answer": "pop()",
"points": 100
},
{
"id": 53,
"question": "Which of the following is a correct syntax for a lambda function in Python?",
"options": ["lambda x: x + 1", "def lambda x: x + 1", "lambda function x: x + 1", "lambda(x): x + 1"],
"answer": "lambda x: x + 1",
"points": 100
},
{
"id": 54,
"question": "Which of the following is not a built-in function in Python?",
"options": ["eval()", "compile()", "exec()", "execute()"],
"answer": "execute()",
"points": 100
},
{
"id": 55,
"question": "Which method is used to get the index of an item in a list in Python?",
"options": ["index()", "find()", "search()", "locate()"],
"answer": "index()",
"points": 100
},
{
"id": 56,
"question": "Which of the following can be used to raise an exception in Python?",
"options": ["raise", "throw", "error", "break"],
"answer": "raise",
"points": 100
},
{
"id": 57,
"question": "Which of the following is used to exit a loop prematurely in Python?",
"options": ["break", "continue", "exit", "return"],
"answer": "break",
"points": 100
},
{
"id": 58,
"question": "What is the output of 'print(\"Hello\"[1])' in Python?",
"options": ["H", "e", "l", "o"],
"answer": "e",
"points": 100
},
{
"id": 59,
"question": "Which function can be used to find the largest number in a list in Python?",
"options": ["max()", "sum()", "large()", "biggest()"],
"answer": "max()",
"points": 100
},
{
"id": 60,
"question": "Which of the following methods can be used to sort the elements of a list in descending order in Python?",
"options": ["sort(reverse=True)", "sort(reverse=False)", "order(desc)", "reverse()"],
"answer": "sort(reverse=True)",
"points": 100
},
{
"id": 61,
"question": "How do you concatenate two strings in Python?",
"options": ["str1 + str2", "concat(str1, str2)", "str1.concat(str2)", "str1 . str2"],
"answer": "str1 + str2",
"points": 100
},
{
"id": 62,
"question": "Which of the following is a valid syntax for list comprehension in Python?",
"options": ["[x for x in list]", "(x for x in list)", "{x for x in list}", "<x for x in list>"],
"answer": "[x for x in list]",
"points": 100
},
{
"id": 63,
"question": "Which method is used to return a copy of a list in Python?",
"options": ["copy()", "duplicate()", "clone()", "replicate()"],
"answer": "copy()",
"points": 100
},
{
"id": 64,
"question": "Which of the following is a valid way to create a set in Python?",
"options": ["{1, 2, 3}", "[1, 2, 3]", "(1, 2, 3)", "set(1, 2, 3)"],
"answer": "{1, 2, 3}",
"points": 100
},
{
"id": 65,
"question": "What is the output of 'print(2 ** 3)' in Python?",
"options": ["5", "6", "7", "8"],
"answer": "8",
"points": 100
},
{
"id": 66,
"question": "Which of the following is used to handle exceptions in Python?",
"options": ["try-except", "try-catch", "catch-except", "handle-except"],
"answer": "try-except",
"points": 100
},
{
"id": 67,
"question": "Which of the following is the correct way to check if a list is empty in Python?",
"options": ["if not list:", "if list == []:", "if len(list) == 0:", "All of the above"],
"answer": "All of the above",
"points": 100
},
{
"id": 68,
"question": "Which of the following can be used to iterate over the elements of a list in Python?",
"options": ["for", "while", "do-while", "All of the above"],
"answer": "All of the above",
"points": 100
},
{
"id": 69,
"question": "Which of the following is a correct syntax for a tuple in Python?",
"options": ["(1, 2, 3)", "[1, 2, 3]", "{1, 2, 3}", "<1, 2, 3>"],
"answer": "(1, 2, 3)",
"points": 100
},
{
"id": 70,
"question": "Which method is used to remove the last item from a list in Python?",
"options": ["pop()", "remove()", "delete()", "discard()"],
"answer": "pop()",
"points": 100
},
{
"id": 71,
"question": "Which keyword is used to create a generator function in Python?",
"options": ["yield", "generate", "return", "gen"],
"answer": "yield",
"points": 100
},
{
"id": 72,
"question": "Which of the following is not a valid file mode in Python?",
"options": ["r", "w", "x", "rw"],
"answer": "rw",
"points": 100
},
{
"id": 73,
"question": "Which method is used to convert a string to lowercase in Python?",
"options": ["lower()", "downcase()", "tolower()", "convert()"],
"answer": "lower()",
"points": 100
},
{
"id": 74,
"question": "Which of the following is the correct syntax for a class definition in Python?",
"options": ["class ClassName:", "def ClassName:", "function ClassName():", "ClassName def():"],
"answer": "class ClassName:",
"points": 100
},
{
"id": 75,
"question": "What is the correct syntax to initialize an instance of a class in Python?",
"options": ["object = ClassName()", "object = new ClassName()", "object = ClassName", "object = create ClassName()"],
"answer": "object = ClassName()",
"points": 100
},
{
"id": 76,
"question": "Which method is used to remove whitespace from the beginning and end of a string in Python?",
"options": ["strip()", "trim()", "clean()", "remove()"],
"answer": "strip()",
"points": 100
},
{
"id": 77,
"question": "Which of the following is a correct syntax for list slicing in Python?",
"options": ["list[1:3]", "list(1:3)", "list[1, 3]", "list(1, 3)"],
"answer": "list[1:3]",
"points": 100
},
{
"id": 78,
"question": "Which of the following can be used to check the data type of a variable in Python?",
"options": ["type()", "typeof()", "checkType()", "varType()"],
"answer": "type()",
"points": 100
},
{
"id": 79,
"question": "Given a NumPy array `a = np.array([1, 2, 3, 4, 5])`, what does `a[a > 2]` return?",
"options": ["[3, 4, 5]", "[1, 2, 3]", "Error", "[2, 3, 4]"],
"answer": "[3, 4, 5]",
"points": 100
},
{
"id": 80,
"question": "Which of the following can be used to handle multiple exceptions in Python?",
"options": ["try-except", "try-finally", "try-except-finally", "All of the above"],
"answer": "try-except-finally",
"points": 100
},
{
"id": 81,
"question": "Which of the following is not a valid escape sequence in Python?",
"options": ["\\n", "\\t", "\\r", "\\v"],
"answer": "\\v",
"points": 100
},
{
"id": 82,
"question": "Which of the following methods is used to return the smallest number in a list in Python?",
"options": ["min()", "small()", "least()", "tiny()"],
"answer": "min()",
"points": 100
},
{
"id": 83,
"question": "Which of the following can be used to check if a key exists in a dictionary in Python?",
"options": ["in", "hasKey()", "containsKey()", "exists()"],
"answer": "in",
"points": 100
},
{
"id": 84,
"question": "Which of the following is used to get the number of keys in a dictionary in Python?",
"options": ["len()", "size()", "count()", "All of the above"],
"answer": "len()",
"points": 100
},
{
"id": 85,
"question": "What is the output of 'print(5 // 2)' in Python?",
"options": ["2", "2.5", "3", "3.5"],
"answer": "2",
"points": 100
},
{
"id": 86,
"question": "Which of the following can be used to concatenate two lists in Python?",
"options": ["list1 + list2", "list1.extend(list2)", "list1.append(list2)", "All of the above"],
"answer": "list1 + list2",
"points": 100
},
{
"id": 87,
"question": "Which method is used to insert an item at a specific index in a list in Python?",
"options": ["insert()", "add()", "append()", "put()"],
"answer": "insert()",
"points": 100
},
{
"id": 88,
"question": "Which function is used to find the index of an item in a string in Python?",
"options": ["find()", "index()", "search()", "locate()"],
"answer": "find()",
"points": 100
},
{
"id": 89,
"question": "Which of the following can be used to remove duplicates from a list in Python?",
"options": ["set()", "remove()", "del()", "None of the above"],
"answer": "set()",
"points": 100
},
{
"id": 90,
"question": "Which of the following can be used to create an infinite loop in Python?",
"options": ["while True:", "for i in range(inf):", "while 1:", "All of the above"],
"answer": "while True:",
"points": 100
},
{
"id": 91,
"question": "Which of the following can be used to check if a string starts with a specific substring in Python?",
"options": ["startswith()", "starts()", "isStart()", "begin()"],
"answer": "startswith()",
"points": 100
},
{
"id": 92,
"question": "Which method is used to return the index of the last occurrence of a substring in a string in Python?",
"options": ["rfind()", "findLast()", "lastIndexOf()", "indexLast()"],
"answer": "rfind()",
"points": 100
},
{
"id": 93,
"question": "Which of the following can be used to create a dictionary in Python?",
"options": ["{}", "[]", "()", "None of the above"],
"answer": "{}",
"points": 100
},
{
"id": 94,
"question": "Which of the following is not a valid way to create a list in Python?",
"options": ["[1, 2, 3]", "list([1, 2, 3])", "[1; 2; 3]", "[]"],
"answer": "[1; 2; 3]",
"points": 100
},
{
"id": 95,
"question": "Which of the following is used to create an empty set in Python?",
"options": ["set()", "{}", "[]", "None of the above"],
"answer": "set()",
"points": 100
},
{
"id": 96,
"question": "Which of the following can be used to reverse a list in Python?",
"options": ["list.reverse()", "reversed(list)", "list[::-1]", "All of the above"],
"answer": "All of the above",
"points": 100
},
{
"id": 97,
"question": "Which of the following can be used to get the length of a string in Python?",
"options": ["len()", "length()", "size()", "All of the above"],
"answer": "len()",
"points": 100
},
{
"id": 98,
"question": "Which of the following can be used to check if a string contains a specific substring in Python?",
"options": ["in", "contains()", "has()", "isIn()"],
"answer": "in",
"points": 100
},
{
"id": 99,
"question": "Which of the following is a correct way to initialize an empty dictionary in Python?",
"options": ["{}", "dict()", "Both A and B", "None of the above"],
"answer": "Both A and B",
"points": 100
},
{
"id": 100,
"question": "Which of the following is used to convert a string to uppercase in Python?",
"options": ["upper()", "toupper()", "capitalize()", "convert()"],
"answer": "upper()",
"points": 100
},
{
"id": 101,
"question": "Which of the following is the correct way to create a Python virtual environment?",
"options": ["python -m venv env", "env python create", "python create env", "virtualenv python env"],
"answer": "python -m venv env",
"points": 100
},
{
"id": 102,
"question": "Which function is used to read a file in Python?",
"options": ["read()", "open()", "file.read()", "get()"],
"answer": "open()",
"points": 100
},
{
"id": 103,
"question": "What will be the output of 'print(type([]))'?",
"options": ["<class 'list'>", "<class 'dict'>", "<class 'tuple'>", "<class 'set'>"],
"answer": "<class 'list'>",
"points": 100
},
{
"id": 104,
"question": "Which of the following methods can be used to remove an item from a set?",
"options": ["discard()", "remove()", "pop()", "All of the above"],
"answer": "All of the above",
"points": 100
},
{
"id": 105,
"question": "How can you convert a string to a list in Python?",
"options": ["split()", "list()", "str_to_list()", "Both a and b"],
"answer": "Both a and b",
"points": 100
},
{
"id": 106,
"question": "Which of the following is the correct way to check if a key exists in a dictionary?",
"options": ["key in dict", "dict.key()", "dict.has_key(key)", "key exists in dict"],
"answer": "key in dict",
"points": 100
},
{
"id": 107,
"question": "What does the 'continue' statement do in a loop?",
"options": ["Exits the loop", "Skips to the next iteration", "Restarts the loop", "None of the above"],
"answer": "Skips to the next iteration",
"points": 100
},
{
"id": 108,
"question": "Which method is used to convert a string to uppercase in Python?",
"options": ["upper()", "capitalize()", "toUpper()", "make_upper()"],
"answer": "upper()",
"points": 100
},
{
"id": 109,
"question": "What will be the output of 'print(3 == 3.0)'?",
"options": ["True", "False", "None", "Error"],
"answer": "True",
"points": 100
},
{
"id": 110,
"question": "Which operator is used for membership testing in Python?",
"options": ["in", "not in", "is", "Both a and b"],
"answer": "Both a and b",
"points": 100
},
{
"id": 111,
"question": "What is the output of 'print(10 // 3)'?",
"options": ["3", "3.33", "4", "Error"],
"answer": "3",
"points": 100
},
{
"id": 112,
"question": "Which of the following is a Python built-in module?",
"options": ["math", "os", "sys", "All of the above"],
"answer": "All of the above",
"points": 100
},
{
"id": 113,
"question": "Which of the following is the correct way to define a class in Python?",
"options": ["class MyClass:", "def MyClass:", "create MyClass:", "class: MyClass"],
"answer": "class MyClass:",
"points": 100
},
{
"id": 114,
"question": "How do you handle multiple exceptions in a single 'except' clause?",
"options": ["except (Error1, Error2):", "except Error1, Error2:", "except Error1 | Error2:", "except (Error1 | Error2):"],
"answer": "except (Error1, Error2):",
"points": 100
},
{
"id": 115,
"question": "What does the 'pass' statement do in Python?",
"options": ["Exits the current function", "Does nothing", "Skips the current iteration", "None of the above"],
"answer": "Does nothing",
"points": 100
},
{
"id": 116,
"question": "Which method is used to find the index of a substring in a string?",
"options": ["find()", "index()", "search()", "locate()"],
"answer": "find()",
"points": 100
},
{
"id": 117,
"question": "Which of the following can be used to create a list in Python?",
"options": ["list comprehension", "list()", "[]", "All of the above"],
"answer": "All of the above",
"points": 100
},
{
"id": 118,
"question": "What will be the output of 'print(\"Hello\"[0:2])'?",
"options": ["He", "Hello", "H", "Error"],
"answer": "He",
"points": 100
},
{
"id": 119,
"question": "What is the correct way to import a specific function from a module?",
"options": ["from module import function", "import module.function", "import function from module", "from module.function import"],
"answer": "from module import function",
"points": 100
},
{
"id": 120,
"question": "Which method is used to add multiple items to a list in Python?",
"options": ["add()", "insert()", "extend()", "append()"],
"answer": "extend()",
"points": 100
},
{
"id": 121,
"question": "Which built-in function can be used to sort a list in Python?",
"options": ["sort()", "order()", "arrange()", "sorted()"],
"answer": "sort()",
"points": 100
},
{
"id": 122,
"question": "Which keyword is used to define an anonymous function in Python?",
"options": ["def", "lambda", "func", "anonymous"],
"answer": "lambda",
"points": 100
},
{
"id": 123,
"question": "What will be the output of 'print(len(\"Hello\"))'?",
"options": ["5", "4", "6", "Error"],
"answer": "5",
"points": 100
},
{
"id": 124,
"question": "What is the correct way to open a file for writing in Python?",
"options": ["open('file.txt', 'w')", "open('file.txt', 'r')", "open('file.txt', 'a')", "open('file.txt', 'rw')"],
"answer": "open('file.txt', 'w')",
"points": 100
},
{
"id": 125,
"question": "Which method is used to retrieve all keys from a dictionary in Python?",
"options": ["keys()", "get_keys()", "all_keys()", "retrieve_keys()"],
"answer": "keys()",
"points": 100
},
{
"id": 126,
"question": "How do you reverse a list in Python?",
"options": ["list.reverse()", "reverse(list)", "list[::-1]", "Both a and c"],
"answer": "Both a and c",
"points": 100
},
{
"id": 127,
"question": "Which of the following is used to create a generator in Python?",
"options": ["yield", "return", "def", "lambda"],
"answer": "yield",
"points": 100
},
{
"id": 128,
"question": "Which of the following is a way to remove duplicates from a list?",
"options": ["set()", "list(set())", "for loop", "Both a and b"],
"answer": "Both a and b",
"points": 100
},
{
"id": 129,
"question": "What will be the output of 'print(bool(0))'?",
"options": ["True", "False", "None", "Error"],
"answer": "False",
"points": 100
},
{
"id": 130,
"question": "Which of the following is a correct way to define a function in Python?",
"options": ["def my_function():", "function my_function():", "my_function() def:", "def: my_function()"],
"answer": "def my_function():",
"points": 100
},
{
"id": 131,
"question": "Which keyword is used to create a new scope in Python?",
"options": ["scope", "def", "with", "lambda"],
"answer": "def",
"points": 100
},
{
"id": 132,
"question": "What will be the output of 'print(2 ** 3)'?",
"options": ["8", "6", "9", "4"],
"answer": "8",
"points": 100
},
{
"id": 133,
"question": "Which function can be used to check the type of a variable in Python?",
"options": ["type()", "check()", "isinstance()", "Both a and c"],
"answer": "Both a and c",
"points": 100
},
{
"id": 134,
"question": "How can you remove all items from a list in Python?",
"options": ["list.clear()", "del list[:]", "list = []", "All of the above"],
"answer": "All of the above",
"points": 100
},
{
"id": 135,
"question": "Which built-in function can be used to create a list from an iterable?",
"options": ["list()", "create_list()", "array()", "set()"],
"answer": "list()",
"points": 100
},
{
"id": 136,
"question": "What will be the output of 'print(1 != 2)'?",
"options": ["True", "False", "None", "Error"],
"answer": "True",
"points": 100
},
{
"id": 137,
"question": "In Python, what is the most efficient method for embedding the value of a variable directly within a string for runtime evaluation?",
"options": ["f'My name is {name}'", "format('My name is {name}')", "My name is {name}", "None of the above"],
"answer": "f'My name is {name}'",
"points": 100
},
{
"id": 138,
"question": "Which of the following is NOT a valid way to comment in Python?",
"options": ["# Comment", "''' Comment '''", "// Comment", "\"\"\" Comment \"\"\""],
"answer": "// Comment",
"points": 100
},
{
"id": 139,
"question": "Considering how Python handles string concatenation and memory allocation, what will be the result of executing `print(\"Hello\" + \" World\")`?",
"options": ["Hello World", "HelloWorld", "Error", "Hello + World"],
"answer": "Hello World",
"points": 100
},
{
"id": 140,
"question": "In Python, which method is specifically designed for concatenating elements of an iterable, such as a list of strings, into a single string while allowing a delimiter to be specified?",
"options": ["join()", "concat()", "combine()", "merge()"],
"answer": "join()",
"points": 100
},
{
"id": 141,
"question": "Which keyword is used to define a subclass in Python?",
"options": ["extends", "inherits", "subclass", "class"],
"answer": "class",
"points": 100
},
{
"id": 142,
"question": "What is the output of 'print(\"abc\".count(\"a\"))'?",
"options": ["1", "0", "2", "Error"],
"answer": "1",
"points": 100
},
{
"id": 143,
"question": "Which of the following can be used to catch exceptions in Python?",
"options": ["try/except", "catch", "handle", "try/catch"],
"answer": "try/except",