6. What is the output of the following code snippet?
a=5
for i in range(10)
a=a+1
a. 15
b. 5
c. 0
d. Error
7. What happens when the following code is executed?
n=5
if(n>1):
print("Hello")
a. Hello gets printed
b. Nothing gets printed
c. An error is thrown
d. None of the above
8. What is the output of the following snippet?
s=0
for s in range(5):
print(s)
A. 0
1
2
3
4
B. 0
1
2
3
C. 01234
D. 012345
9. What is the value stored in the variable answer at the end of executing the following snippet?
answer=1
n=0
while(n<3):
answer=answer*3
n=n+1
a. 81
b. 27
c. 91
d. 9
10. What happens when the following code is executed?
n=5
if(n%5==0):
print("Hello")
a. Hello gets printed
b. Nothing gets printed
c. Hello gets printed twice
d. An error is thrown
Answers
Answered by
3
Q6 answer is 15
Q7 answer is Hello print
Q8 answer is C
Q9 answer is 27
Q10 answer is hello print
Answered by
2
"6. The output of the following code snippet a=5 for i in range(10) a=a+1is 15
7. If we execute n=5 if(n>1): print(""Hello""), we can get the output as Hello print
8. The output of this snippet s=0 for s in range(5): print(s) is option C. 01234
9. The value stored in the variable answer at the end of executing the following snippet is 27.
10. If we print n=5 if(n%5==0): print(""Hello""), we can get the output as hello print
"
Similar questions