PCAP Exam QuestionsBrowse all questions from this exam

PCAP Exam - Question 47


How many stars (*) does the following snippet print?

Show Answer
Correct Answer: D

D

Discussion

5 comments
Sign in to comment
cgranadilloOption: D
Jan 26, 2021

I just run this script using this console: https://www.programiz.com/python-programming/online-compiler/ Result was 4 starts Answer is D

aroheraOption: D
Mar 23, 2022

It will be D as first the value is 3 so a star will be printed, then one for 2 and 1 each, then the value will be 0 so it will go in the else statement and print one start, so total 4 stars

pypaulOption: C
Nov 11, 2020

C. Will print 3 stars

sadako11
Nov 24, 2020

D. 4 stars. Please before answering try running the code first. Maybe u are forgetting that after the while loop finishes the else: print("*") will execute.

SanjiDiableJambeOption: A
Jan 19, 2021

i dont know whats wrong with these answers but its A. '+=', '-=' , '*=' , '/=' are not supported in python

arohera
Mar 23, 2022

they all are supported in python

macxszOption: D
May 3, 2022

answer: D. four