WorksheetsPython output based questions
Total questions: 20
Worksheet time: 10mins
Name
Class
Date
1.
What is syntax?
a)
Syntax is the word used to describe an error
b)
Syntax is the rules of the programming language
c)
It is used to read information
d)
It is used to output information
2.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
3.
Which Python command is used to output information to the screen?
a)
read
b)
output
c)
print
d)
display
4.
What will the output be from the following code?
print(Hello world!)
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
5.
What will the output be from the following code?
print("Hello world!")
print("Hello world!")
a)
SyntaxError
b)
Hello world!
c)
"Hello world!"
d)
print(Hello world!)
6.
What will the output be from the following code?
Print("Hello world!")
Print("Hello world!")
a)
NameError
b)
Hello world!
c)
"Hello world"
d)
Print(Hello world!)
7.
What will the output be from the following code?
print(3+4)
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
8.
What will the output be from the following code?
print("3+4")
print("3+4")
a)
7
b)
3+4
c)
34
d)
SyntaxError
9.
What will the output be from the following code?
print(3*4)
print(3*4)
a)
34
b)
7
c)
12
d)
3*4
10.
What will the output be from the following code?
print(3*4+5)
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
11.
Predict the output from the following code:
print("3*4+5")
a)
SyntaxErrror
b)
17
c)
3*4+5
d)
12
12.
What will the output be from the following code?
print(9/3)
print(9/3)
a)
3
b)
3.0
c)
9/3
d)
SyntaxError
13.
What will the output be from the following code?
print(9/3*2+4-5)
print(9/3*2+4-5)
a)
19
b)
5.0
c)
0.5
d)
5
14.
What will the output be from the following code?
print("Hello" + "world!")
print("Hello" + "world!")
a)
Hello world!
b)
Helloworld!
c)
SyntaxError
d)
"Hello" "world!"
15.
What will the output be from the following code?
print("Hello" + "world" + "today")
print("Hello" + "world" + "today")
a)
Helloworldtoday
b)
Hello world today
c)
"Hello" "world" "today"
d)
SyntaxError
16.
What will the output be from the following code?
print("Hello" + 2 + "world")
print("Hello" + 2 + "world")
a)
Hello 2 world
b)
Hello2world
c)
TypeError
d)
HelloHelloworld
17.
What will the output be from the following code?
print("Hello world!" * 2)
print("Hello world!" * 2)
a)
TypeError
b)
Hello world world!
c)
Hello world!Hello world!
d)
Hello world! * 2
18.
What will the output be from the following code?
print("Hello world!" * 2 * "Hello world!")
print("Hello world!" * 2 * "Hello world!")
a)
TypeError
b)
Hello world! Hello world! Hello world! Hello world!
c)
Hello Hello World! World!
d)
Hello world! Hello world!
19.
What will the output be from the following code?
print("Hello world!\nHello world!")
print("Hello world!\nHello world!")
a)
Hello world! Hello world!
b)
Hello world!
Hello world!
Hello world!
c)
SyntaxError
d)
Hello world!
20.
What will the output be from the following code?
print("Hello" + str(2) + "world!")
print("Hello" + str(2) + "world!")
a)
Hello world! Hello world!
b)
Hello2world!
c)
Hello Hello world! world!
d)
SyntaxError
100 %
