Practice Free PCEP-30-02 Exam Online Questions
Question #91
How many stars will the following snippet print to the monitor?
x = 16 while x > 0: print (‘*’) x //= 2
- A . one
- B . three
- C . The code will enter an in fi nite loop.
- D . fi ve
Correct Answer: D
Question #92
What is the expected output of the following code?

- A . 2
- B . 4
- C . 5
- D . 3
Correct Answer: B
Question #93
What is the expected output of the following code?

- A . 2
- B . The code is erroneous.
- C . 0
- D . 1
Correct Answer: A
Question #94
What is the expected output of the following code?
Print (len([i for i in range(0, -2)]))
- A . 1
- B . 3
- C . 2
- D . 0
Correct Answer: D
Question #95
What is the expected output of the following code?
x = 2
y = 6
x += 2 3
x //= y // 2 // 3
print(x)
- A . 9
- B . 10
- C . 0
- D . 11
Correct Answer: B
Question #96
The pyc fi le contains …
- A . a Python interpreter.
- B . Python source code.
- C . compiled Python bytecode.
- D . a Python compiler.
Correct Answer: C
Question #97
What is the expected output of the following code?

- A . 1
- B . 2
- C . 4
- D . 3
Correct Answer: A
Question #98
What is the expected output of the following code?
print (2 3 2 1)
- A . 64
- B . 16
- C . 128.0
- D . The code is erroneous.
- E . 16.0
- F . 512
Correct Answer: F
Question #99
What is the best de fi nition of a script?
- A . It’s a text le that contains sequences of zeroes and ones
- B . It’s a text le that contains instructions which make up a Python program
- C . It’s an error message generated by the interpreter
- D . It’s an error message generated by the compiler
Correct Answer: B
Question #100
How many hashes (+) does the code output to the screen?

- A . one
- B . zero (the code outputs nothing)
- C . five
- D . three
Correct Answer: C
C
Explanation:
The code snippet that you have sent is a loop that checks if a variable “floor” is less than or equal to 0 and prints a string accordingly.
The code is as follows:
floor = 5 while floor > 0: print(“+”) floor = floor – 1
The code starts with assigning the value 5 to the variable “floor”. Then, it enters a while loop that repeats as long as the condition “floor > 0” is true. Inside the loop, the code prints a “+” symbol to the screen, and then subtracts 1 from the value of “floor”. The loop ends when “floor” becomes 0 or negative, and the code exits.
The code outputs five “+” symbols to the screen, one for each iteration of the loop.
Therefore, the correct answer is C. five.
Reference: [Python Institute – Entry-Level Python Programmer Certification]
C
Explanation:
The code snippet that you have sent is a loop that checks if a variable “floor” is less than or equal to 0 and prints a string accordingly.
The code is as follows:
floor = 5 while floor > 0: print(“+”) floor = floor – 1
The code starts with assigning the value 5 to the variable “floor”. Then, it enters a while loop that repeats as long as the condition “floor > 0” is true. Inside the loop, the code prints a “+” symbol to the screen, and then subtracts 1 from the value of “floor”. The loop ends when “floor” becomes 0 or negative, and the code exits.
The code outputs five “+” symbols to the screen, one for each iteration of the loop.
Therefore, the correct answer is C. five.
Reference: [Python Institute – Entry-Level Python Programmer Certification]
