Python Final Exam - July2023
Python Final Exam - July2023
INSTRUCTIONS
INFORMATION
● The total mark for this paper is 65.
● The number of marks for each question or part question is shown in brackets [ ].
programming?
A. True B. False
A. Quotient B. Divisor
a=7
if a>4: print("Greater")
A. Greater B. 7 C. 4 D. Lesser
1. Consider the following code segment and identify what will be the output of
given Python code? Explain what the if statement does from the given code below
give the variables values for illustration. [5 marks]
2. What will be the output of the following Python code?. And Explain the Logic of
the if statement. [5 marks]
num = 10
if num > 0:
print("Positive number")
elif num == 0:
print("Zero")
else:
print("Negative number")
3. Is it TRUE that in Python, an else statement comes right after the block after 'if'?
if yes explain your answer with the help of the syntax. [5 marks]
4. The following synatx is used to define what kind of sequence. And distinguish it
with a LIST. Give a syntax. [10 marks]
d={
<key>: <value>,
<key>: <value>,
.
.
.
<key>: <value>
}
Section C
(30) marks, Answer TWO Questions from section C
5. Write a Python program to check whether the given integer is a multiple of 2 [15
marks]
6. Write a Python code that calculates a grade of a Student, when a mark is entered
by the user in the system. [15 marks]
7. Given a rectangle below, write a python program that allows a user to enter a and
b and calculates the diameter of a rectangle. [15 marks]