Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam PCAP All Questions

View all questions & answers for the PCAP exam

Exam PCAP topic 1 question 10 discussion

Actual exam question from Python Institute's PCAP
Question #: 10
Topic #: 1
[All PCAP Questions]

What is the expected output of the following snippet?

  • A. 3
  • B. 1
  • C. 2
  • D. the code is erroneous
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
locloc91
Highly Voted 5 years, 3 months ago
Since the else is indented incorrectly, the code will be erroneous!
upvoted 18 times
...
46a1b89
Most Recent 1 month ago
A is correct
upvoted 1 times
...
megan_mai
1 month, 1 week ago
Selected Answer: D
else in indented wrongly
upvoted 1 times
...
JeyTlenJey
3 months, 4 weeks ago
Selected Answer: A
There are many screens with indented issue - I ignore them. I would go for : Correct A
upvoted 1 times
...
mplopez
1 year, 4 months ago
Selected Answer: D
The "else" part is not correctly indented
upvoted 1 times
...
Ello2023
1 year, 6 months ago
Selected Answer: D
There are 2 mistakes Firstly, there is missed quotes Secondly, the else is not indented correctly
upvoted 1 times
...
Ello2023
1 year, 6 months ago
Selected Answer: D
Just tested this code and the "else:" has the wrong indentation and therefore, it never worked.
upvoted 1 times
...
varshu_0708
1 year, 6 months ago
Selected Answer: D
"else" indentation is not correct. so the answer is D. if the indentation is correct, the ans will be 3
upvoted 1 times
...
ivanbicalho
1 year, 9 months ago
Selected Answer: D
The indentation is not correct
upvoted 1 times
...
naveenbv80
1 year, 11 months ago
If the indentation is correct then answer is 3 a=2 if a>0: a+=1 else: a-=1 print(a) If the indentation is not correct, the answer is "the code will be erroneous" a=2 if a>0: a+=1 else: a-=1 print(a)
upvoted 4 times
...
N9
2 years, 2 months ago
Selected Answer: D
code is not indented properly. Output : line number <number> invalid syntax else: ^^^^
upvoted 1 times
...
PremJaguar
2 years, 4 months ago
The code should be erroniouse
upvoted 2 times
...
Jiansy90
2 years, 5 months ago
Answer is D, There is indentation mistake.
upvoted 1 times
...
palagus
2 years, 6 months ago
Selected Answer: D
The code is erroneous.
upvoted 2 times
...
666_m
2 years, 6 months ago
follow the indentation of the question, the answer is D
upvoted 1 times
...
macxsz
2 years, 6 months ago
indentation is incorrect: D. the code is erroneous
upvoted 1 times
...
gherulloa
2 years, 7 months ago
Selected Answer: D
Option D: if ran as in the question, it throws "invalid syntax" error
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...