Python Programming Quiz – 5th
Week Quiz Solution 2020-2021
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] What does the following Python3 code do? (using python 3.X version)
n = int(input(‘Enter a number?’))
i = 1
while i <= n:
i = i+1
print (i)
- (a): Print all integers from 1 to n
- (b): Print all integers from 1 to n-1
- (c): Print all integers from 2 to n
- (d): Print all integers from 2 to n+1
[2] What will the output of the following Python3 program (using python 3.X version)?
n = 13
sum = 0
while (n > 1):
n = n//2
sum = sum + n
print(sum)
- (a): 13
- (b): 10
- (c): 6
- (d): 9
Answer: (b) 10
Reason:-the output of the following Python3 program (using python 3.X version) , so i know that Python 3 is more consistent language. Python 3 is the present and future of the language. and i run this code and the output of 10 ,
[3] What will the output of the following Python3 program? If the program has error, select the option ERROR (using python 3.X version)
n,p = 9,1
while (n >= 1):
n,p = n//2,n*p
print(int(p))
- (a): 8
- (b): 102
- (c): 9, 36, 72, 72
- (d): Error
[4] The following code should print all positive even numbers less than or equal to N. N is taken as input from the user. What should replace the ???? for the code to work correctly?(using python 3.X version)
N = int(input(‘Enter N:’))
i = 1
while ( i < N ) :
if ( ???? ):
print(i)
i = i + 1
- (a): i//2 == 0
- (b): i%2 != 0
- (c): i//2 != 0
- (d): i%2 == 0
Answer: (d) i%2 == 0
Reason:- when the following code should print all positive even numbers less than or equal to N. N is taken as input from the user. i%2 == 0 should replace the code for the code to work correctly (using python 3.X version) , because it is while & if statement .
[5] The following code should print all positive odd numbers less than or equal to N. N is taken as input from the user. What should replace the X for the code to work correctly? (using python 3.X version)
N = int(input(‘Enter N:’))
i = 1
while ( i < N ) :
print(i)
X
- (a): i%2 == 1
- (b): i = i + 2
- (c): i = 1 + i * 2
- (d): i = i * 2
9 Comments
Thanks bhai
ReplyDeleteWelcome bro
DeleteWeek 6 update kar do bhai
ReplyDeleteHm bhai jald He
Delete,week 6 for python jaldi kar
Deletedo
Thanks brother
ReplyDelete6th bhi upload kr dena
6th bhi aplod kr do bro
ReplyDelete6th upload karo bhai jaldi
ReplyDeleteMan please upload good reasons. Your reasons are very poor.
ReplyDelete