Loading...

My Learning Pad Login

Welcome

PCEP™ – Certified Entry-Level Python Programmer (Exam PCEP-30-02)

Mock Exam Paper 4

Instructions

Questions

Module 1: Computer Programming and Python Fundamentals

Question 1
What does it mean that Python is an interpreted language?
A) It requires compilation before execution
B) It runs code line by line without compilation
C) It converts code to another language
D) It only runs on specific hardware

Question 2
What will the following code print?

print(0b1110)  

A) 14
B) 10
C) 12
D) Error

Question 3
Which is a Python keyword?
A) loop
B) not
C) begin
D) end

Question 4
What will print(4 ^ 6) output?
A) 2
B) 4
C) 6
D) 10

Question 5
What is the purpose of a single-line comment in Python?
A) To execute a command
B) To add explanatory notes ignored by Python
C) To define a variable
D) To separate code blocks

Module 2: Data Types, Evaluations, and Basic I/O Operations

Question 6
What is the data type of "123"?
A) int
B) float
C) str
D) bool

Question 7
What will the following code print?

x = 8  
x *= 2  
print(x)  

A) 8
B) 16
C) 10
D) Error

Question 8
What is the output of:

print("Hello"[-2])  

A) o
B) l
C) H
D) Error

Question 9
What will print(int(5.8) + float("1.2")) output?
A) 7.0
B) 6.2
C) 7
D) Error

Question 10
What is the result of "Go" + "!" * 2?
A) Go!!
B) Go!
C) GoGo
D) Error

Question 11
Which variable name is invalid?
A) data_point
B) dataPoint
C) data-point
D) _data

Module 3: Control Flow – Conditional Blocks and Loops

Question 12
What will the following code print?

x = 12  
if x < 10:  
    print("Low")  
elif x < 15:  
    print("Medium")  
else:  
    print("High")  

A) Low
B) Medium
C) High
D) Error

Question 13
What is the output of:

for i in range(0, 8, 3):  
    print(i, end=" ")  

A) 0 3 6
B) 0 1 2 3 4 5 6 7
C) 3 6
D) 0 3 6 9

Question 14
What will the following code print?

x = 10  
while x > 7:  
    print(x)  
    x -= 3  

A) 10 7
B) 10 8
C) 10 7 4
D) 9 6

Question 15
What is the output of:

for i in range(6):  
    if i % 3 == 0:  
        continue  
    print(i)  

A) 0 3
B) 1 2 4 5
C) 0 1 2 3 4 5
D) Error

Question 16
What does 2 > 1 or 3 < 2 evaluate to?
A) True
B) False
C) None
D) Error

Question 17
What is the output of:

for i in range(2):  
    for j in range(2):  
        print(j + 1, end=" ")  

A) 1 2
B) 1 2 1 2
C) 2 3
D) 1 1 2 2

Question 18
What will the following code print?

x = 3  
while x < 7:  
    x += 2  
    print(x, end=" ")  

A) 3 5 7
B) 5 7
C) 3 4 5 6
D) 5 7 9

Question 19
What does the break statement do in a loop?
A) Skips the current iteration
B) Stops the loop completely
C) Repeats the loop
D) Restarts the loop

Question 20
Which condition evaluates to True?
A) 3 <= 2
B) 4 != 4
C) 5 > 3
D) 2 >= 3

Module 4: Functions, Tuples, Dictionaries, and Data Processing

Question 21
What will the following code print?

def triple(num):  
    return num * 3  
print(triple(3))  

A) 9
B) 6
C) 3
D) Error

Question 22
What is the output of:

tup = (5, 10, 15)  
print(tup[0:2])  

A) (5, 10)
B) (10, 15)
C) (5, 15)
D) Error

Question 23
What will the following code print?

d = {"key1": 100, "key2": 200}  
print(d.get("key3", 0))  

A) 100
B) 200
C) 0
D) Error

Question 24
What is the output of:

def change(x):  
    x = 20  
num = 5  
change(num)  
print(num)  

A) 20
B) 5
C) None
D) Error

Question 25
What will the following code print?

lst = [3, 1, 4]  
lst.sort()  
print(lst[2])  

A) 1
B) 3
C) 4
D) Error

Question 26
What is the output of:

tup = (1, 2, 2, 3)  
print(tup.count(2))  

A) 1
B) 2
C) 3
D) Error

Question 27
What will the following code print?

d = {"a": 1}  
d["b"] = 3  
print(d.values())  

A) [1]
B) [1, 3]
C) [3]
D) Error

Question 28
What is the output of:

def welcome(name, greeting="Hi"):  
    return greeting + " " + name  
print(welcome("Bob"))  

A) Hi Bob
B) Bob Hi
C) HiBob
D) Error

Question 29
What will the following code print?

lst = [2, 3, 4]  
lst.pop(1)  
print(lst)  

A) [2, 4]
B) [3, 4]
C) [2, 3]
D) Error

Question 30
What will [x * 2 for x in range(4) if x % 2 == 0] produce?
A) [0, 4]
B) [0, 2, 4, 6]
C) [2, 6]
D) Error