New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Python Institute PCEP-30-02 Exam - Topic 4 Question 34 Discussion

Actual exam question for Python Institute's PCEP-30-02 exam
Question #: 34
Topic #: 4
[All PCEP-30-02 Questions]

What is the expected output of the following code?

Show Suggested Answer Hide Answer
Suggested Answer: C

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.


Contribute your Thoughts:

0/2000 characters
Melissia
3 months ago
The code looks fine, so it shouldn't be erroneous.
upvoted 0 times
...
Amalia
3 months ago
I agree, "ppt" seems too simple for this code.
upvoted 0 times
...
Delila
3 months ago
Wait, is it really that long? Sounds weird.
upvoted 0 times
...
Shawna
4 months ago
Definitely not, it's "pizzapastafolpetti".
upvoted 0 times
...
Cheryll
4 months ago
I think the output is "ppt".
upvoted 0 times
...
Tamar
4 months ago
I vaguely recall that the output could be a number, but I can't remember if it was 213 or something else.
upvoted 0 times
...
Beckie
4 months ago
I'm leaning towards option A because I feel like there might be a syntax error in the code.
upvoted 0 times
...
An
4 months ago
I think I saw a similar question where the output was a combination of strings. Could it be option D?
upvoted 0 times
...
Lashaunda
5 months ago
I remember something about string concatenation, but I'm not sure how it applies here.
upvoted 0 times
...
Ezekiel
5 months ago
I'm feeling pretty confident about this one. The code seems straightforward, and I believe I know the expected output.
upvoted 0 times
...
Nada
5 months ago
Okay, I think I've got a handle on this. Let me walk through the logic and see if I can determine the correct answer.
upvoted 0 times
...
Lynelle
5 months ago
Whoa, this is a tough one. I'm a bit confused by the syntax, but I'll give it my best shot and try to reason through it.
upvoted 0 times
...
Audria
5 months ago
Ah, I think I see what's going on here. Let me work through this methodically and see if I can figure out the expected output.
upvoted 0 times
...
Isaiah
5 months ago
Hmm, this looks like a tricky one. I'll need to carefully read through the code and think it through step-by-step.
upvoted 0 times
...
Noemi
10 months ago
This question is so easy, even a Python newbie could figure it out. I bet the developers are *star*-struck that we're struggling with this.
upvoted 0 times
...
Armanda
10 months ago
I agree with C. * *. The image clearly shows two stars being printed.
upvoted 0 times
Desmond
8 months ago
User3: Yes, it's definitely C) * *
upvoted 0 times
...
Quentin
8 months ago
User2: I agree, the image shows two stars being printed.
upvoted 0 times
...
Jin
9 months ago
User1: I think the answer is C) * *
upvoted 0 times
...
...
Nicolette
10 months ago
Hmm, I think it's going to be C. * *. The code looks pretty straightforward.
upvoted 0 times
Lenora
9 months ago
I'm leaning towards B. * * *
upvoted 0 times
...
Talia
10 months ago
I think it's D. Just one star will be printed.
upvoted 0 times
...
Ahmed
10 months ago
I agree, it should be C. * *
upvoted 0 times
...
...
Frederica
10 months ago
It looks like it's printing some stars, so I'm going to go with B. * * *
upvoted 0 times
...
King
11 months ago
I'm not sure, but I think it might be D) *
upvoted 0 times
...
Levi
11 months ago
The code will definitely output something, it can't just produce no output. A is definitely wrong.
upvoted 0 times
Dalene
10 months ago
Definitely not A), I'm going with B) * * * as well
upvoted 0 times
...
Lauran
10 months ago
Yeah, it seems like the code will print * * *
upvoted 0 times
...
Salome
10 months ago
I agree, it looks like the code will output * * *
upvoted 0 times
...
Denae
10 months ago
I think the output will be B) * * *
upvoted 0 times
...
...
Chantay
11 months ago
I believe the correct answer is C) * *
upvoted 0 times
...
Luz
11 months ago
I think the expected output is B) * * *
upvoted 0 times
...

Save Cancel