Python Programming Quiz 4th Week Quiz Solution 2020

 Python Programming Quiz – 4th 

Week Quiz Solution


Important Notes:- 

Hello Dosto Please Subscribe Our Youtube channel  Because Copyright Problem In this post ( python / css / Al / nptel ) So please i humble Request Subscribe Our channel or social Networks ( than we are all are connect To each and every person ) These are Our youtube channel My Youtube Channel .. only 321 subscribe in my youtube  channel .(  channel ko subscribe kar lo kyuki kabhi bhi website band ho sakti hai sar post 2019 se ho rhe hai or answer sare senior ke dwara batye hue hai ) . youtube channel ko jaldi se share karo tak jada subscribe ho jaye to copyright ka koi problem na ho .. thanks 



[1] How do you declare a dictionary in python ?


 (a): dict = {“key”:”value”}

(b): dict [“key”:”value”]

(c): Dict = {“key” – “value”}

(d): Dict = [“key”:”value”]


Answer: (a) dict = {“key”:”value”}



Reason :- In Python, a Dictionary can be created by placing sequence of elements within curly {} braces, separated by 'comma'. Dictionary holds a pair of values, one being the Key and the other corresponding pair element being its Key:value . the answer is

 dict = {“key”:”value”}





[2] What will be the output of the following code dict = { x:x for x in range(1,2) } print(dict)


(a): {}

(b): {x:x,x:x,x:x}

(c): {1: 1, 2: 2}

(d): None of the above


Answer:(c) {1: 1, 2: 2}


Reason :-  the output of the following code dict = { x:x for x in range(1,2) } print(dict) , answer is 

(c) {1: 1, 2: 2} . 





[3] In python 3.x, Which of the statement is true for following code: age = input (“Please enter your age”)


(a): age will be integer type

(b): it removes trailing spaces

(c): age variable's type will be Whatever type is given to it

(d): None of the above


Answer: (d): None of the above


Reason:- In python 3.x is true for following code: age = input (“Please enter your age”) , so it is age variable's type  and the answer is none of the above .



[4] What will be the output of the following program


int =5

while int >=-1:

print (int)

int = int -1


(a): 4 3 2

(b): 5 4 3 2

(c): 5 4 3

(d): 5 4 3 2 1


Answer:(b) 5 4 3 2 


Reason :- the output of the following program it is option (b) 5 4 3 2 .because this is program code .



[5] What will be the output of the following program .


int =3


while int >=2:


    print (int)


    int = 1


(a): 3

(b): 2

(c): 3 2

(d): Error in code


Answer:(c) 3 2


Reason:- the output of program is option (c)  3 2 because print (int) is the first integer of 3 , ( int ) = 3 , and while int is >=2 so the value of  output is 3 ,2  .

Post a Comment

7 Comments