edited by
177 views
0 votes
0 votes

IB JIO Grade-2 Tech 2023 part-2-75

Q.75 What is the output of the following part of Python program?

c=0
while(c<=2):
    c=c+1
    print("Hi")



Ans
1. Hi
2. $\mathrm{Hi}$
3. $\mathrm{Hi} \mathrm{Hi} $
4. $\mathrm{Hi}$
$\mathrm{Hi}$
Question ID : 630680278531
Option 1 ID : $\mathbf{6 3 0 6 8 0 1 0 8 2 4 0 9}$
Option 2 ID : 6306801082411
Option 3 ID : 6306801082412
Option 4 ID : $\mathbf{6 3 0 6 8 0 1 0 8 2 4 1 0}$
Status : Answered
Chosen Option : 3

edited by

1 Answer

1 votes
1 votes
while loop runs $3$ times, each time variable $c$ is incremented by $1$. if we see the indentation sign both the statements are from a single block only, so every time when $c$ is incremented each time the print function prints the message.

So the output is  $\text{HiHiHi}$

Option $(2)$ is correct.

Related questions

0 votes
0 votes
1 answer
2
0 votes
0 votes
0 answers
4