0% found this document useful (0 votes)
2 views3 pages

Python Quiz

The document is a question paper covering topics from units 1.1 to 1.3, focusing on pseudocode, Python syntax, and programming concepts. It includes multiple-choice questions with an answer key and explanations for each question. The paper is designed to assess understanding of programming fundamentals within a 45-minute timeframe.

Uploaded by

csstudenteek
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Python Quiz

The document is a question paper covering topics from units 1.1 to 1.3, focusing on pseudocode, Python syntax, and programming concepts. It includes multiple-choice questions with an answer key and explanations for each question. The paper is designed to assess understanding of programming fundamentals within a 45-minute timeframe.

Uploaded by

csstudenteek
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Question Paper: Units 1.1 – 1.

3 Time: 45 minutes
Total Marks: 30 /09/2026
Section A:
Multiple Choice Questions (7 questions x 1 mark = 7 marks)
1. What is the primary purpose of pseudocode?
a) To write a final, executable program
b) To design and plan algorithms in a language-independent way
c) To replace flowcharts entirely
d) To debug errors in Python code
2. Which of the following is a valid example of an INPUT statement in
pseudocode?
a) Name = INPUT
b) INPUT “Enter your name”, name
c) READ name
d) All of the above
3. In Python, how is the code block inside an ‘if’ statement defined?
a) Using curly braces ‘{}’
b) Using the ‘ENDIF’ keyword
c) Using indentation
d) Using square brackets ‘[]’
4. In a linear search, what happens if the item being searched for is not in the
list?
a) The algorithm restarts from the beginning
b) The algorithm stops and reports that item was not found
c) The algorithm skips to the last item
d) The algorithm picks a random item
5. What

1. Which of the following is a valid variable name in Python?


A) 2_total_score
B) total-score
C) total_score
D) total score
2. What data type will Python assign to the variable age = "14"?
A) Integer (int)
B) String (str)
C) Float (float)
D) Boolean (bool)
3. Which operator is used to calculate the remainder of a division in Python?
A) /
B) //
C) %
D) **
4. Look at the following code block: [1]
python
score = 45
if score >= 50:
print("Pass")
else:
print("Try again")
Use code with caution.
What will this program output when executed?
A) Pass
B) Try again
C) score
D) Error [1]
5. How many times will the following for loop print the word "Hello"?
python
for i in range(1, 4):
print("Hello")
Use code with caution.
A) 1 time
B) 2 times
C) 3 times
D) 4 times [1]
6. Which line of code correctly takes an input from the user as a number
(integer)?
A) user_num = input("Enter a number: ")
B) user_num = int(input("Enter a number: "))
C) user_num = print("Enter a number: ")
D) user_num = input(int("Enter a number: "))
7. What keyword is used to add a final condition if the first if statement is
false, but before resort to else?
A) elseif
B) else if
C) elif
D) ifnot [1]
8. What is the main purpose of indentation in Python?
A) To make the code look colorful
B) To tell Python which lines belong inside a loop or a condition
C) To make the program run faster
D) To leave a comment for other programmers

Answer Key & Explanations


1. C) total_score
 Explanation: Python variables cannot start with a number (A), cannot
contain hyphens (B), and cannot contain spaces (D). They can contain
letters, numbers, and underscores. [1, 2, 3, 4, 5]
2. B) String (str)
 Explanation: Because the number 14 is enclosed inside quotation marks
"14", Python treats it as text (a string) rather than a mathematical
number. [1, 2]
3. C) %
 Explanation: The % symbol is the modulo operator, which calculates the
remainder (e.g., 5 % 2 leaves a remainder of 1). / is for division, // is for
floor division, and ** is for exponents. [1, 2, 3, 4, 5]
4. B) Try again
 Explanation: The variable score holds 45. The condition checks if 45 is
greater than or equal to 50 (score >= 50), which is false. Therefore, the
program skips the if block and runs the else block. [1, 2, 3]
5. C) 3 times
 Explanation: The function range(1, 4) generates numbers starting at 1
and stops before 4 (generating 1, 2, and 3). This means the loop runs
exactly 3 times. [1, 2]
6. B) user_num = int(input("Enter a number: ")) [1, 2, 3, 4, 5]
 Explanation: The input() function always captures data as text (a string).
Wrapping it inside int() converts that text into an integer so you can do
math with it. [1, 2, 3, 4, 5]
7. C) elif
 Explanation: Python combines "else if" into a single, specific keyword:
elif. [1, 2]
8. B) To tell Python which lines belong inside a loop or a condition
 Explanation: Python does not use curly brackets {} to group code blocks
like other languages. It relies strictly on spaces or tabs (indentation) to
see what code sits inside a loop, function, or if statement. [1, 2, 3, 4]
If you would like to expand on this, let me know:
 Do you want questions on lists or functions?
 Are you prepping for a specific exam term?
 Should I make the questions harder with code debugging?

You might also like