
Q1
Q1 What data type would you use to store a whole number in Python?
int
float
str
bool
Q2
Q2 Which of the following is not a Python built-in data type?
dict
array
set
frozenset
Q3
Q3 Which of the following is an immutable data type?
Lists
Dictionaries
Tuples
Sets
Q4
Q4 Evaluate this pseudocode:
Set x = [1, 2, 3];
If x is a list, print length of x, else print "Not a list"
3
Not a list
Error
0
Q5
Q5 What will be the output of
print("Python", "Programming", sep="-")
Python-Programming
Python Programming
PythonProgramming
Python,Programming
Q6
Q6 What is the output of
print("Hello", end='@');
print("World")
HelloWorld
Hello@World
Hello World
Hello@ World
Q7
Q7 Pseudocode:
Print each element in list [1, 2, 3] with a space in between
123
37623
[1, 2, 3]
37623
Q8
Q8 Identify the error:
print("Hello World!"))
Missing quotation marks
Extra parenthesis
Missing parenthesis
No error
Q9
Q9 What will happen if the condition in an if statement in Python evaluates to False?
The program will stop
It will execute the else block
It will raise an error
It will skip to the next if
Q10
Q10 What is the outcome if the elif and else blocks are missing in an if statement?
Syntax error
The program will stop
Nothing, it's optional
Runtime error
Q11
Q11 What is the output of the following code?
x = 10;
if x > 5:
print("Greater")
Error
Greater
Nothing
Less
Q12
Q12 What will the following code print?
x = 10;
if x < 10:
print("Less");
else:
print("Not Less")
Less
Not Less
Error
Nothing
Q13
Q13 Pseudocode:
Check if a number is divisible by 2,
if yes
print "Even",
otherwise
"Odd"
Prints "Even"
Prints "Odd"
Error
No output
Q14
Q14 Identify the error:
if x > 10
print("Greater")
Missing parentheses around condition
No error
Missing colon after condition
Incorrect comparison operator
Q15
Q15 What is the use of a for loop in Python?
To repeat a block a fixed number of times
To check a condition
To declare variables
To handle exceptions
Q16
Q16 What does the continue statement do inside a loop?
Pauses the loop
Stops the loop
Skips the current iteration
Exits the program
Q17
Q17 What is the difference between a for loop and a while loop in Python?
for is used for fixed iterations
while is faster than for
for can't use conditional statements
There is no difference
Q18
Q18 What is the output of the following code?
for i in range(3):
print(i)
"0 1 2"
"1 2 3"
"0 1 2 3"
"Error"
Q19
Q19 Pseudocode:
Set x = 10;
While x > 0,
decrement x by 1,
print x
Prints numbers from 10 to 1
Prints numbers from 1 to 10
Prints numbers from 9 to 0
Infinite loop
Q20
Q20 Pseudocode:
For numbers 1 to 5,
print number
if it's odd
Prints 1 3 5
Prints 2 4
Prints all numbers 1 to 5
No output
Q21
Q21 Identify the error:
for i in range(5)
print(i)
Missing colon after range(5)
Missing parentheses around print
Syntax error in range
No error
Q22
Q22 Find the mistake:
while True:
print("Looping");
break
Infinite loop
No error
The loop will never break
Incorrect use of print statement
Q23
Q23 What is the main difference between a list and a tuple in Python?
Syntax
Data type
Mutability
Method of declaration
Q24
Q24 How do you access the last element of a list named myList?
myList[0]
myList[-1]
myList[len(myList)]
myList[-2]
Q25
Q25 In Python, how can you combine two lists, list1 and list2?
list1 + list2
list1.append(list2)
list1.combine(list2)
list1.extend(list2)
Q26
Q26 What does myList[::-1] do?
Reverses myList
Copies myList
Removes the last element from myList
Sorts myList in descending order
Q27
Q27 Identify the error:
myList = [1, 2, 3);
myList.append(4)
Syntax error with the list declaration
append() method is used incorrectly
No error
Lists cannot contain integers
Q28
Q28 How do you access the value associated with a key 'k' in a dictionary 'd'?
d('k')
d[k]
d.get('k')
All of the above
Q29
Q29 Find the mistake:
d = {'a': 1, 'b': 2};
print(d.get('c', 'Not Found'))
Syntax error in the dictionary
get() method used incorrectly
Key 'c' doesn't exist
No error
Q30
Q30 In Python, what is a module?
A data type
A built-in function
A file with definitions
A code block

