Exit Chapter 01 Β· 🐍 Python Revision Tour I β€” Quiz

Playing as a guest? to earn XP and track your progress.

Question 1 of 50 0 correct so far

🐍 Python Revision Tour I Quiz

Q1.

Which of the following is used to define a block of code in Python?

Explanation

Python uses indentation instead of braces to define code blocks.

Q2.

What is the output of print(type(10))?

Explanation

10 is an integer, so its type is int.

Q3.

Which of the following is NOT a Python keyword?

Explanation

β€˜variable’ is not a keyword.

Q4.

Which function is used to take input from the user in Python?

Explanation

input() is used to take user input as a string.

Q5.

Which of the following is an immutable type?

Explanation

Strings in Python cannot be changed after creation.

Q6.

What is the output of print(3 * 'Hi')?

Explanation

String multiplication repeats the string.

Q7.

Which operator has the highest precedence?

Explanation

Exponentiation has the highest precedence.

Q8.

What is the result of 10 // 3?

Explanation

// performs floor division.

Q9.

Which of the following is NOT a valid variable name?

Explanation

Variable names cannot begin with a digit.

Q10.

What is the data type of the value returned by input()?

Explanation

input() always returns a string.

Q11.

Which of the following is a Python delimiter?

Explanation

Colon is used in loops and condition blocks.

Q12.

What will be the output?

x = 5
x += 3
print(x)
Explanation

+= adds and assigns.

Q13.

What is the output of:

print(type(3.0))
Explanation

3.0 is a floating-point number.

Q14.

Which statement is used for decision-making?

Explanation

if is the decision-making statement.

Q15.

What is the output?

print('A' < 'a')
Explanation

ASCII value of 'A' is smaller than 'a'.

Q16.

Which loop is best suited when the number of iterations is known?

Explanation

for loop is used when the count is known.

Q17.

What will be the output?

for i in range(1,4):
    print(i)
Explanation

range(1,4) produces 1,2,3.

Q18.

Which statement terminates a loop?

Explanation

break exits the loop immediately.

Q19.

Which statement skips the current iteration?

Explanation

continue skips to next iteration.

Q20.

What does pass do in Python?

Explanation

pass is a null statement.

Q21.

What is the output?

x = '5'
y = 2
print(x * y)
Explanation

String multiplied by 2 repeats twice: '55'.

Q22.

Which of the following is mutable?

Explanation

List elements can be modified.

Q23.

Which operator checks equality?

Explanation

== compares values.

Q24.

Which of the following is NOT an arithmetic operator?

Explanation

and is a logical operator.

Q25.

What is the output of print(10 % 3)?

Explanation

% gives remainder.

Q26.

What is the output?

x = True
y = False
print(x and y)
Explanation

True AND False β†’ False.

Q27.

What is the return type of range()?

Explanation

range() returns a range object.

Q28.

Which of the following will cause an error?

Explanation

Variables cannot start with digits.

Q29.

Which one is a logical operator?

Explanation

and, or, not are logical operators.

Q30.

What is the output?

print(2 ** 3 ** 1)
Explanation

Exponentiation is right associative: 31 = 3; 23 = 8.

Q31.

Which of these is NOT a token?

Explanation

Program is not a token.

Q32.

Which function converts string to integer?

Explanation

int() converts a string to integer.

Q33.

Which symbol marks a comment?

Explanation

is used for comments.

Q34.

What does this print?

print(len('Python'))
Explanation

Python has 6 characters.

Q35.

Which of the following is a valid string literal?

Explanation

Strings must be inside quotes.

Q36.

Output?

for i in range(3):
    print("Hi")
Explanation

Loop runs 3 times.

Q37.

Which statement is used for looping until a condition becomes false?

Explanation

while runs until condition becomes false.

Q38.

Which of the following is TRUE?

Explanation

Tuples cannot be changed.

Q39.

Output?

x = 5
y = 2
print(x/y)
Explanation

/ always performs float division.

Q40.

Which operator is used for logical NOT?

Explanation

Python uses the word 'not'.

Q41.

Output?

print('5' + '5')
Explanation

String concatenation: '55'.

Q42.

Which is TRUE about pass?

Explanation

pass is a null statement.

Q43.

Which method displays output on screen?

Explanation

print() displays output.

Q44.

Output?

print(bool(0))
Explanation

0 is treated as False.

Q45.

Which of the following is a comparison operator?

Explanation

== checks equality.

Q46.

Output?

print(type([1,2,3]))
Explanation

Square brackets create a list.

Q47.

Which feature makes Python easy to debug?

Explanation

Interpreted languages run code line by line.

Q48.

Output?

for i in range(1,3):
    print(i*i)
Explanation

11 and 22.

Q49.

Which of these belongs to flow control?

Explanation

if controls decision flow.

Q50.

Which one is TRUE about Python?

Explanation

Python strictly uses indentation for block structure.