edited by
164 views
0 votes
0 votes

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

Q.17 What is the output of the following part of python program?
\[
\begin{array}{l}
\mathrm{s}=\text { "india" } \\
\mathrm{l}=0
\end{array}
\]
for $\mathrm{x}$ in $\mathrm{s}$ :
\[
\begin{array}{l}
\text { if(x!="i"): } \\
\mathrm{l}=\mathrm{l}+1
\end{array}
\]
else:
pass
print(1)
Ans
1. 5
$\times 2.6$
3. 3
$\times 4.1$
Question ID : 630680278530
Option 1 ID : 6306801082405
Option 2 ID : $\mathbf{6 3 0 6 8 0 1 0 8 2 4 0 7}$
Option 3 ID : $\mathbf{6 3 0 6 8 0 1 0 8 2 4 0 6}$
Option 4 ID : 6306801082408
Status : Answered
Chosen Option : 4

edited by

1 Answer

0 votes
0 votes
here for(x in s) work as for loop here they count the no of character which are not equal to i.

first(x=0) if condition fail so else condition will run which is pass  when x=1 if condition true due to i!=n it increment in l so it will count all char which are not equal to i

Related questions

435
views
1 answers
0 votes
admin asked Jul 31, 2023
435 views
Q.18 Which of the following function in python is used to read keyboard input?Ans1. scanf2. input3. gets4. $\operatorname{cin}$Question ID ... 3 ID : 6306801082419Option 4 ID : 6306801082420Status : AnsweredChosen Option : 2
198
views
1 answers
0 votes
admin asked Jul 31, 2023
198 views
Q.75 What is the output of the following part of Python program?c=0 while(c<=2): c=c+1 print("Hi")Ans1. Hi2. $\mathrm{Hi}$3. $\mathrm{Hi} \mathrm{Hi} $ ... : $\mathbf{6 3 0 6 8 0 1 0 8 2 4 1 0}$Status : AnsweredChosen Option : 3
102
views
0 answers
0 votes
admin asked Jul 31, 2023
102 views
Q.1 Which statement is FALSE regarding Programmable Logic Controller?Ans1. PLC is a specialized Programmable device which is used to control machines and ... : 6306801082179Option 4 ID : 6306801082180Status : Not AnsweredChosen Option : --
133
views
0 answers
0 votes
admin asked Jul 31, 2023
133 views
Q.2 Which probability distribution is most widely used to model quantization noise in pulse code modulation?Ans1. Poisson2. Bernoulli3. Uniform4. ... ID : 6306801082321Option 4 ID : 6306801082322Status : AnsweredChosen Option : 1