Font size
WorksheetsPython_12BG
Total questions: 21
Worksheet time: 33mins
What would the output be for the program if the user enters 50 and 25?
60
75
16
error
Which of the following best describes the order in which these lines are processed in Python?
4, 1, 2
4, 2, 1
1, 2, 3, 4
3, 1, 2
What will be the output of this program if the user enters "Welcome" and then " World!!"?
WelcomeWorld!!
Welcome World!!
WELCOME WORLD!!
all of these
What Python keyword is used to indicate that a code segment is a function definition?(Only the keyword)
(a)
What is the function header in the Python code above?
(a)
What does the following code do? myAge = str (myAge)
Converts the variable myAge to a string
Converts the variable myAge to a integer
Converts the variable myAge from string
What will the output be from the following code?
print("Welcome\nHello world!")
Welcome\n Hello world!
Welcome
Hello world!
SyntaxError
Hello world!
What will the output be from the following code?
print("Hello" + str(32) + "Python")
(a)
Python identifies blocks of code by
BEGIN and END keywords
{ and }
indentation
guessing
What will the output be from the following code?
print("Peace" * 2)
TypeError
Peace2
PeacePeace
Peace* 2
Which is an assignment operator?
+=
=+
==
!=
Which is a relational operator?
AND
=
==
non of these
What is the value of the expression 170 / 50?
3
3.4
3.0
What is the output of the following code :
print 9//2
4
4.5
4.0
'4'
Which is the correct operator for power(x^y) in Python?
(a)
What is the answer of this expression, 27 % 4 is?
(a)
x = 5
print(x > 3 and x > 10)
True
False
x = 14
print(x > 10 or x < 3)
True
False
x = 5
y = 3
print(x == y)
True
False
x = 5
x%=3
print(x)
What will be the output?
2.0
2
2.5
error
Write an assignment statement that stores the remainder obtained from dividing 100 and 4 in the variable mod
(a)
