File size: 6,079 Bytes
2b130d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
question,option1,option2,option3,option4,answer,difficulty
"What is the output of: print(type({}))","dict","list","set","tuple","dict","low"
"What keyword is used to define a function in Python?","fun","def","function","define","def","low"
"What does the input() function do?","Reads user input","Converts input to int","Reads user input and converts to int","None of the above","Reads user input","low"
"How do you declare a variable in Python?","var x = 10","int x = 10","x = 10","declare x = 10","x = 10","low"
"What is the output of: print(len('Hello'))?","5","6","Hello","Error","5","low"
"What is the valid way to define a class in Python?","class MyClass()","def MyClass:","class MyClass:","define MyClass","class MyClass:","low"
"What is the output of: print(10 / 2)?","5.0","5","10","Error","5.0","low"
"What does the range() function do?","Generates a sequence of numbers","Creates a list of numbers","Generates a string sequence","None of the above","Generates a sequence of numbers","low"
"What is the output of: print(3 + 2 * 2)?","7","10","8","5","7","low"
"Which of the following is a valid Python data type?","integer","float","string","All of the above","All of the above","low"
"How do you define a default parameter in a function?","def func(x = 5)","def func(x: 5)","func(x = 5)","None of the above","def func(x = 5)","low"
"What is the output of: print(2 ** 3)?","8","6","3","2","8","low"
"What does the del statement do?","Deletes a variable","Deletes a list item","Deletes an object","All of the above","All of the above","low"
"What is the output of the following code: print(isinstance(3.14, (int, float)))?","True","False","Error","None of the above","True","high"
"What is the output of: print([1, 2, 3] + [4, 5])?","[1, 2, 3, 4, 5]","[1, 2, 3] + [4, 5]","[5, 4, 3, 2, 1]","Error","[1, 2, 3, 4, 5]","low"
"How do you create a set in Python?","set([1, 2, 3])","[1, 2, 3]","(1, 2, 3)","set(1, 2, 3)","set([1, 2, 3])","medium"
"What is the output of: print(10 % 3)?","1","3","2","Error","1","medium"
"What is the purpose of the 'break' statement in Python?","Exits a loop","Pauses a loop","Continues the loop","None of the above","Exits a loop","medium"
"How do you declare a class in Python?","class MyClass()","class MyClass:","MyClass()","None of the above","class MyClass:","medium"
"What is the correct way to check if a list is empty?","if list == []:","if list:","if len(list) == 0:","None of the above","if not list:","medium"
"Which of the following is a Python built-in data structure?","list","tuple","dict","All of the above","All of the above","medium"
"What is the output of: print([i**2 for i in range(3)])?","[0, 1, 4]","[1, 4, 9]","[0, 2, 4]","[1, 2, 3]","[0, 1, 4]","medium"
"What is the purpose of the 'pass' statement in Python?","Skips the current iteration of the loop","Exits the loop","Used as a placeholder","None of the above","Used as a placeholder","medium"
"How do you open a file in Python?","open('file.txt')","open('file.txt', 'r')","open('file.txt', 'w')","All of the above","All of the above","medium"
"What is the correct syntax to create a dictionary?","{key: value}","[key: value]","(key: value)","key: value","{key: value}","medium"
"Which function is used to get the length of a string?","size()","length()","len()","count()","len()","medium"
"What is the output of: print(5 // 2)?","2.5","2","3","Error","2","medium"
"How do you handle exceptions in Python?","try-catch","try-finally","try-except","try-else","try-except","medium"
"What is a Python decorator?","A function returning another function","A type of module","A Python class","A data structure","A function returning another function","high"
"What is the purpose of the 'with' statement?","Memory management","Simplify exception handling","File handling and cleanup","All of the above","All of the above","high"
"What is the time complexity of accessing an element in a dictionary?","O(1)","O(n)","O(log n)","O(n^2)","O(1)","high"
"What module is used for multithreading in Python?","multiprocessing","threading","os","subprocess","threading","high"
"How do you create a virtual environment in Python?","python3 -m venv venv","virtualenv venv","venv create venv","None of the above","python3 -m venv venv","high"
"What is the difference between 'is' and '==' in Python?","'is' compares values, '==' compares identities","'is' compares identities, '==' compares values","Both compare values","Both compare identities","'is' compares identities, '==' compares values","high"
"What is the output of: print('Hello' == 'Hello')?","True","False","None","Error","True","high"
"How do you define a lambda function in Python?","lambda x: x * 2","def lambda x: x * 2","lambda x => x * 2","None of the above","lambda x: x * 2","high"
"What does the map() function do in Python?","Applies a function to all items in an iterable","Combines two lists","Filters out elements from a list","None of the above","Applies a function to all items in an iterable","high"
"How do you remove an item from a list by index?","list.remove(index)","list.pop(index)","del list[index]","None of the above","list.pop(index)","high"
"What is the output of: print('Python'[::-1])?","nohtyP","Python","Error","None","nohtyP","high"
"What is the purpose of the 'continue' statement in Python?","Exits the loop","Skips the current iteration","Pauses the loop","None of the above","Skips the current iteration","high"
"What is the output of: print([i for i in range(5) if i % 2 == 0])?","[0, 2, 4]","[1, 3]","[2, 4]","[0, 1, 2, 3, 4]","[0, 2, 4]","high"
"How can you check if a key exists in a dictionary?","key in dict","dict.has_key(key)","key in dict.keys()","None of the above","key in dict","high"
"What is the output of: print(sorted([3, 1, 2]))?","[1, 2, 3]","[3, 2, 1]","[2, 1, 3]","[1, 3, 2]","[1, 2, 3]","high"
"What is the output of: print('abc'.replace('b', 'd'))?","adc","abd","dcd","abcd","adc","high"
"How do you round a number in Python?","round(number)","round(number, 2)","floor(number)","ceil(number)","round(number, 2)","high"