wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Int to Comp Sci Python Quiz 1

Total questions: 23

Worksheet time: 12mins

Name
Class
Date
1.

What output would be returned when the following code is run?


print(6 x 3)

a)

6 x 3

b)

syntax error

c)

18

d)

concatenation error

2.

What is the word (command) used to display numbers and text on the screen?

a)

print

b)

input

c)

output

d)

conversion

3.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
4.

A syntax error means your code has a 'text-based' mistake or you used symbols/operations incorrectly

a)

True

b)

False

5.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

"Dave"

c)

name

d)

(name)

6.

What will be the output?

name = "Dave"

greeting = "Good morning " + name

print (greeting)

a)

"Good morning Dave"

b)

Good morning Dave

c)

Good morning name

d)

Good morning "Dave"

7.
What will the output be from the following code?
print("Hello" + str(2) + "world!")
a)
Hello world! Hello world!
b)
Hello2world!
c)
Hello Hello world! world!
d)
SyntaxError
8.

What does the following code do? myAge = int (myAge)

a)

Converts the variable myAge to a string

b)

Converts the variable myAge to a integer

c)

Converts the variable myAge from a integer to a string

d)

Converts the variable myAge to an operator

9.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
10.
What does the term 'debug' mean?
a)
Identify errors and fix them.
b)
Making a calculation
c)
A set of instructions
d)
Looking at code
11.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
12.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
13.

What output would be returned when the following code is run?


name = "NicK"

print(name * 3)

a)

syntax error

b)

Nick*3

c)

concatenation error

d)

NickNickNick

14.

If the desired output is:

Which number value meal would you like to order? (user enters 2)

I would like to order a number 2 meal

Does the print statement need to be changed to one of 3 answer choices or can it remain as it is displayed below?


num = input("Which number value meal would you like to order?) 2

print("I would like a number " + num + " meal")

a)

print ("I would like a number + num")

b)

print("I would like a number " + str(num) + " meal"))

c)

print("I would like a number " + int(num) + " meal))

d)

The print statement can remain the same

15.
a data type than can have one of two values: True or False
a)
boolean
b)
variable
c)
modulo
d)
interpreter
16.
To create a variable named new_var and assign it a value of 81 divided by 9, which statement would you use?
a)
new_var = 81 \ 9
b)
new_var = "81 / 9"
c)
new_var = "81 \ 9"
d)
new_var = 81 / 9
17.
Which of the following is a float?
a)
new_var = 1234
b)
new_var = True
c)
new_var = 1.234
d)
new_var = "True"
18.

How would you output new_var = 123 as a text string?

a)

print str(new_var)

b)

print new_var(str)

c)

print (str)new_var

d)

print (new_var).str()

19.

What output will the console show, if 15 and 30 are entered by the user?

a)

Syntax error

b)

The sum of the two numbers - 45

c)

The concatenation of the two numbers - 1530

d)

Complier error

20.

What output will display if 15 then 20 is entered by the user?

a)

"num1 + num2"

b)

1520

c)

35

21.

What will the output be if the user enters 15 then 30?

a)

15.0 30.0

b)

15.0 + 30.0

c)

1530

d)

45.0

22.
In python the ' INTEGER data type' can be defined as...?
a)
holds alphanumeric data as text
b)
holds whole numbers
c)
holds numbers with a decimal point
d)
holds either ‘true’ or ‘false’
23.

What is the output of this program?


number1 = 90

number2 = 10


print("Hello")

a)

100

b)

Hello

c)

100 Hello

d)

Hello 100