What is the output of the following code snippet


Asked by admin @ in Computer Science viewed by 433 People


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

Answered by admin @



Q6 answer is 15

Q7 answer is Hello print

Q8 answer is C

Q9 answer is 27

Q10 answer is hello print


Similar Questions

What will be the output of following code

Asked by admin @ in Computer Science viewed by 419 persons

What will be the output of the following code? print( (3 < 1) and (4/0 > 1))1.False2.True3.Run-time error4.None of the above​

What is the output of the following code

Asked by admin @ in Computer Science viewed by 358 persons

What is the output of the following code? dict 1={}dict 1["x"]=[5]print (dict 1["x"][5])a) 5b) [5]c) 0d) The code generates an error​

What will be output of the following c code

Asked by admin @ in Computer Science viewed by 360 persons

Q.16:What will be the output of the following C code? #include void main() { int x = 4, y, z; y =- -X, Z = X--; printf("%d%d%d", x, y, z); …

What would be the output of the following code

Asked by admin @ in Computer Science viewed by 358 persons

What would be the output of the following code.explain..a=2+5/8

What will be the output of the following code

Asked by admin @ in Computer Science viewed by 294 persons

What will be the output of the following code? print( (3 < 1) and (4/0 > 1))1.False2.True3.Run-time error4.None of the above​

Write the html code to generate the following output

Asked by admin @ in Computer Science viewed by 380 persons

Write html code to generate the following output​

What does the following piece of code do

Asked by admin @ in Computer Science viewed by 330 persons

What does the following piece of code do? 1 public Object function()2 {3 if(isEmpty)4 return -999;5 else6 {7Object high;8high = q[front); …

Which of the following html code is valid

Asked by admin @ in Computer Science viewed by 382 persons

Which of the following HTML code is valid OR OR OR

Which of the following is an output device

Asked by admin @ in Computer Science viewed by 409 persons

Which of the following is an output device​

What is the output of the following 4 5

Asked by admin @ in Computer Science viewed by 306 persons

What is the output of the following : 4//5 What is the output of the following : 4//5 ? 1.12.0.83.04.8​

What will be the output of the following pseudocode

Asked by admin @ in Computer Science viewed by 322 persons

What would be the output of the following pseudocode? 1) Integer i, j, k 2) Set k = 6 3) For (each i from 1 to 1) 4) For (each …

What would be the output of the following program

Asked by admin @ in Computer Science viewed by 340 persons

What would be the output of the following program? main(){int i=4;switch(i).{default:printf("\n A mouse is an elephant built by the Japanese");case 1:printf(" Breeding …

What will be the output of below python code

Asked by admin @ in Computer Science viewed by 380 persons

What will be the output of below Python code? str1="Information" print(str1[2:8]) formatformatioormaormat​

Which of the following is not purely output device

Asked by admin @ in Computer Science viewed by 362 persons

Which of the following is not purely output device? A) Printer B) Speaker C) Plotter D) Screen

What is wrong with the following code

Asked by admin @ in Computer Science viewed by 316 persons

What is wrong with the following code

Most viewed questions in Computer Science


A programmer mistakenly writes gor instead of for

Asked by admin @ in Computer Science viewed by 19030 persons


Domestic data entry operator ncert book class 9 solutions

Asked by admin @ in Computer Science viewed by 15815 persons


Information technology code 402 class 9 solutions chapter 1

Asked by admin @ in Computer Science viewed by 10977 persons



Ncert solutions for class 8 computer chapter 1 computer system

Asked by admin @ in Computer Science viewed by 10407 persons


A scrum team works on a 4 weeks sprint

Asked by admin @ in Computer Science viewed by 8723 persons


Which of the following occupies more memory in c

Asked by admin @ in Computer Science viewed by 8145 persons



A database of motor vehicles has the base entity

Asked by admin @ in Computer Science viewed by 7845 persons


The network architecture can be termed as a mcq

Asked by admin @ in Computer Science viewed by 6492 persons


Cat5 and cat6 cabling refer to which reference model layer

Asked by admin @ in Computer Science viewed by 5795 persons



Class 7 computer chapter 3 questions and answers

Asked by admin @ in Computer Science viewed by 5696 persons


Choose the correct options about usability and user experience

Asked by admin @ in Computer Science viewed by 5479 persons


Which advocates daily team meetings for coordination and integration

Asked by admin @ in Computer Science viewed by 4986 persons



Which three security features match the database security level

Asked by admin @ in Computer Science viewed by 4976 persons


Which of the dbms package is not available

Asked by admin @ in Computer Science viewed by 4688 persons


________ aid a business grow and attain its objectives

Asked by admin @ in Computer Science viewed by 4492 persons