NEW
Font size
WorksheetsPython Quiz#1_24March2020
Total questions: 30
Worksheet time: 19mins
Who is the father of Python Programming Language?
Dennis Ritchie
James Arthur Gosling
Guido van Rossum
Bjarne Stroustrup
What is the output of the following code :
print( 9 // 2)
4.5
4.0
4
Error
What is the output of the following program :
021324
012345
Error
102435
What is the output of the following code?
for value in range (1,5):
print(value)
Error
12345
1234
2345
What will be the output of the following?
HelloHi
Hello
Hi
Error
What should come in the blank if we want to print HI! 6 times? for i in range(_____): print(“HI!”)
1,5
1,6
5
1,7
If you want to check if the age is equal to or greater than 18, what should come in the blank: if age___18: print(“You can vote.”)
<
>!
<=
>=
What will be the output of the following code:
None of the following
Error
Even
Odd
if statement along with an else statement in Python is called ______ statement.
elseif
ifelse
elif
elsif
What will be the output of the following? (3 < 1) and (4/0 > 1)
False
True
Run Time Error
None of these
In the following statement, which operation will be evaluated first according to the order of precedence of operators in Python? (3*20+5)-16/4
(3*20+5)
16/4
20+5
3*20
Can a break statement be used to exit a while loop?
True
False
What will be the output of the following program?
3
2
3
2
Error
What does the following Python code do?
Print all integers from 1 to n
Print all integers from 1 to n-1
Print all integers from 2 to n
Print all integers from 2 to n+1
What will the output of the following Python program ?
13
10
6
9
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?
i//2 == 0
i%2 != 0
i//2 != 0
i%2 == 0
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 ???? for the code to work correctly?
i%2 == 1
i = i + 2
i = 1 + i * 2
i = i * 2
Which of the following symbols is used to make single line comments in Python?
#
@
'''
&
Which of the following is not a valid identifier?
A_
_A
1a
_1
What is the output of following statement?
sum = 10 + '10'
1010
20
Error
10'10'
What will be the output of the following statement if the user has entered 20 as the input of x ?
x=input("Enter number")
print(10 + x)
30
1020
Error
20
What will be the output of the following statement?
print( 15 + 20 / 5 + 3 * 2 - 1)
19.0
19
12.0
24.0
What will be the output of the following program?
a = 7
b = 4
c = 2
print(a // b / c)
0.85
0
0.5
0.0
Which of the following have the highest precedence in an expression?
Addition
Multiplication
Exponent
Parenthesis
What will be the output, if the data 5 is shifted towards the left by 2 bits?
20
10
1
25
What is the output of the following Python program ?
3 5 7 9 11
1 3 5 7 9
The program will go into an infinite loop, printing 1 1 1 …
The program will go into an infinite loop, printing nothing
What is the output of following Code?
4 3 Loop ended.
5 4 3 Loop ended.
4 3
Loop ended.
Find the output?
4 3 1 0 Loop ended.
4 3 2 1 0 Loop ended.
4 3 Loop ended.
4 3 1 Loop ended.
Which of the following is false statement in python?
int(10)==10
int(10.0)==10
int('10')==10
None of these
What will be the output of the following code?
abcd
0 1 2 3
1 2 3 4
a b c d
