LATEST PYTHON CERTIFICATION
EXAM OFFERED BY PYTHON
INSTITUTE | Q&A WITH
RATIONALES
PCEP-30-02 Exam
Block 1: Computer Programming and Python
Fundamentals (18%)
1. What is the output of the following code?
python
print()
print(type(4 // 2.0))
A) 2 <class 'int'>
B) 2.0 <class 'float'>
C) 2 <class 'float'>
D) 2.0 <class 'int'>
Correct answer: B
Rationale: returns a float (2.0). 4 // 2.0 performs floor division on a float,
returning a float (2.0).
,2. Which of the following are valid Python keywords? (Select two.)
A) def
B) function
C) import
D) include
Correct answer: A, C
Rationale: def is used to define functions, and import is used to import
modules. function and include are not Python keywords.
3. What is the result of 0b1111 in decimal?
A) 8
B) 12
C) 15
D) 16
Correct answer: C
Rationale: 0b1111 is binary for 15 (8 + 4 + 2 + 1).
4. What is the output of the following code?
python
x = 5
y = 2
print(x ** y)
A) 7
B) 10
,C) 25
D) 32
Correct answer: C
Rationale: ** is the exponentiation operator. 5 ** 2 = 25.
5. Which of the following variable names is NOT valid in Python?
A) _my_var
B) myVar2
C) 2myVar
D) my_var
Correct answer: C
Rationale: Variable names cannot start with a digit.
6. What is the output of the following code?
python
print(3 * "abc")
A) abcabcabc
B) abc abc abc
C) 3abc
D) Error
Correct answer: A
Rationale: The * operator repeats strings. 3 * "abc" produces "abcabcabc".
, 7. Which operator is used for floor division in Python?
A) /
B) %
C) //
D) **
Correct answer: C
Rationale: // performs floor division, returning the integer part of the quotient.
8. What is the result of 5 % 2?
A) 2.5
B) 2
C) 1
D) 0
Correct answer: C
Rationale: % is the modulo operator, returning the remainder of the division. 5 % 2
= 1.
9. Which of the following statements about Python indentation is TRUE?
A) Indentation is optional
B) Indentation defines blocks of code
C) Indentation is only for readability
D) Indentation uses curly braces
EXAM OFFERED BY PYTHON
INSTITUTE | Q&A WITH
RATIONALES
PCEP-30-02 Exam
Block 1: Computer Programming and Python
Fundamentals (18%)
1. What is the output of the following code?
python
print()
print(type(4 // 2.0))
A) 2 <class 'int'>
B) 2.0 <class 'float'>
C) 2 <class 'float'>
D) 2.0 <class 'int'>
Correct answer: B
Rationale: returns a float (2.0). 4 // 2.0 performs floor division on a float,
returning a float (2.0).
,2. Which of the following are valid Python keywords? (Select two.)
A) def
B) function
C) import
D) include
Correct answer: A, C
Rationale: def is used to define functions, and import is used to import
modules. function and include are not Python keywords.
3. What is the result of 0b1111 in decimal?
A) 8
B) 12
C) 15
D) 16
Correct answer: C
Rationale: 0b1111 is binary for 15 (8 + 4 + 2 + 1).
4. What is the output of the following code?
python
x = 5
y = 2
print(x ** y)
A) 7
B) 10
,C) 25
D) 32
Correct answer: C
Rationale: ** is the exponentiation operator. 5 ** 2 = 25.
5. Which of the following variable names is NOT valid in Python?
A) _my_var
B) myVar2
C) 2myVar
D) my_var
Correct answer: C
Rationale: Variable names cannot start with a digit.
6. What is the output of the following code?
python
print(3 * "abc")
A) abcabcabc
B) abc abc abc
C) 3abc
D) Error
Correct answer: A
Rationale: The * operator repeats strings. 3 * "abc" produces "abcabcabc".
, 7. Which operator is used for floor division in Python?
A) /
B) %
C) //
D) **
Correct answer: C
Rationale: // performs floor division, returning the integer part of the quotient.
8. What is the result of 5 % 2?
A) 2.5
B) 2
C) 1
D) 0
Correct answer: C
Rationale: % is the modulo operator, returning the remainder of the division. 5 % 2
= 1.
9. Which of the following statements about Python indentation is TRUE?
A) Indentation is optional
B) Indentation defines blocks of code
C) Indentation is only for readability
D) Indentation uses curly braces