Exam Questions and Answers10
Which of the following Python 3 instructions will produce the output Hello World?
Print("Hello World")
print "Hello World"
print "Hello World"
print("Hello World") - ANSWERS-print("Hello World")
What character(s) is used at the start of a line in Python to indicate that what follows should be
treated as a comment? - ANSWERS-#
Which of the following is a type in Python?
int
bool
list
All of the above - ANSWERS-All of the above
A fragment of code that causes a data type to be evaluated? - ANSWERS-Expression
A single unit of code that the Python interpreter can execute? - ANSWERS-Statement
What is the output of the following code in Python 3?
, print(1 and 0) - ANSWERS-0
If we have just 1 + 1 what are the outcome in command prompt (Shell Mode) and script? -
ANSWERS-2 and *blank*
This control structure in Python keeps executing a code block while the test is True? - ANSWERS-
While loop
Python keyword used to create a user function? - ANSWERS-def
This control structure in Python executes a code block for a specified number of times? -
ANSWERS-For loop
What will be the result of the following Python 3 statement? temperature = "3" + "5" -
ANSWERS-' 35 '
What will be the output of the following code in Python 3?
number = 6
number = number + 4
lucky_number = 10 * number
print(lucky_number/number) - ANSWERS-10
What is the output of the following code in Python 3?
print("Ozymandius"[2:4]) - ANSWERS-ym