in Others edited by
154 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

in Others edited by
by
154 views

1 Answer

1 vote
1 vote
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

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true