• edited by
394 views
0 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

1 Answer

0 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
Position:
Show:

Related questions

0 0 votes
1 1 answer
774
774 views
admin asked Jul 31, 2023
774 views
Q.18 Which of the following function in python is used to read keyboard input?Ans1. scanf2. input3. gets4. $\operatorname{cin}$Question ID : 630680278533Option 1 ID : 630...
0 0 votes
1 1 answer
419
419 views
admin asked Jul 31, 2023
419 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} $4. $\mathrm{Hi}$$\m...
0 0 votes
0 0 answers
315
315 views
admin asked Jul 31, 2023
315 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 processes.2. Use...
0 0 votes
0 0 answers
324
324 views
admin asked Jul 31, 2023
324 views
Q.2 Which probability distribution is most widely used to model quantization noise in pulse code modulation?Ans1. Poisson2. Bernoulli3. Uniform4. GaussianQuestion ID : 63...