wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Chapter 7

Total questions: 42

Worksheet time: 42mins

Name
Class
Date
1.

is integer a number

a)

true

b)

false

2.

chose which is a floating point

a)

14

b)

15.5

3.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

4.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
5.
Which statement correctly assigns the string "Tanner" to the variable name?
a)
name  = print( "Tanner")
b)
input("Tanner")
c)
name = "Tanner"
d)
name = input("Tanner")
6.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
7.

What is the output from the following code?

print ("hello world")

a)
Hello World
b)
hello world
c)
print hello world
8.

The punctuation requirements for printing a string in Python are:

a)

( ) , ! and " "

b)

( ) and !

c)

( ) and " "

d)

" " and !

9.

name=input("What is your name? ")

print("Your name is " , name)

What will be displayed if the user types in "Bob"?

a)

Your name is name

b)

name

c)

Bob

d)

Your name is Bob

10.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
11.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
12.

What extension is used by python file?

a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
13.
What button do you press to compile (run) your program so that it runs in the shell?
a)
F3
b)
F5
c)
F7
d)
F9
14.

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

a)

Converts the var (variable) myAge to a string

b)

Converts the var (variable) myAge to a integer

c)

Converts the var (variable) myAge from a integer to a string

d)

Converts the var (variable) myAge to if statement

15.

What result will display in the shell if 15 and 20 is entered by the user?

a)

"num1 + num2"

b)

1520

c)

35

16.

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

17.

Python language was developed in what year?

a)

1985

b)

2001

c)

1991

d)

1820

18.

Who developed Python Programming Language?

a)

Wick van Rossum

b)

Rasmus Lerdorf

c)

Guido van Rossum

d)

My dad

19.

The output of the program

x = 4

x = "Sally"

print(x)

a)

four

b)

Saly

c)

Sally

20.

Code for

b is greater than a

a)

a = 33

b = 200


if b > a:

print("b is greater than a")

b)

a = 33

b = 200


if b < a:

print("b is greater than a")

c)

a = 330

b = 200


if b > a:

print("b is greater than a")

21.

Code for

257

Hello, World!

a)

x = 257

y = "Hello, World!"


print(y)

print(x)

b)

x = 257

y = "Hello, World!"


print(x)

print(y)

c)

x = 257

y = Hello, World!


print x

print y

22.

Code for

Five is greater than two!

a)

if 5 > 2:

print("Five is greater than two!")

b)

if 5 = 2:

print("Five is greater than two!")

c)

if 5 > 2: Print("Five is greater than two!")

23.
What does the print function do in python?
a)
It's a variable.
b)
It can input data.
c)

It displays an output

d)
It loops the code.
24.

What does the = = symbol mean in Python?

a)

Equal to or shows equality

b)

Not Equal

c)

Code that will be skipped

d)

End of clause

25.
What will be printed to the screen?
a)
Nothing
b)
Success
c)
Failure
d)
Success
 Failure
26.
What will be printed to the screen?
a)
Success
b)
Failure
c)
Part of the way there!
d)
Nothing
27.
What will be printed to the screen?
a)
Failure
b)
Part of the way there!
c)
Success
d)
Nothing
28.
What will be printed to the screen?
a)
Nothing
b)
Success
c)
Part of the way there!
d)
Failure
29.

In the provided code, what is the final value for alarm?

a)

6

b)

7

c)

8

d)

9

30.

Which of the following is not a Relational Operator?

a)

<=

b)

==

c)

=

d)

!=

31.

Which code means not equal to?

a)

==

b)

<=

c)

>

d)

!=

32.
Which statement will check to see if a is equal to b?
a)
if a == b
b)
if a = b:
c)
if a != b:
d)
if a == b:
33.

What is the output?

a)

more than 7

b)

more than 23

c)

spam

d)

7

34.

This is a catch-all for every other situation besides the one where the condition is true.

a)

then

b)

do

c)

else

d)

if

35.

What is output when the code runs?

a)

A

b)

B

c)

C

d)

D

36.

What is output when the code runs?

a)

End

b)

Even

c)

Larger Than 10

d)

No output is produced

37.

What is output when the code runs?

a)

Hi!

b)

Hi!

Have A Nice Day

c)

Good Afternoon

d)

Good Afternoon

Have A Nice Day

38.

These operators are used with numeric values to perform common mathematical operations.

a)

Python Assignment Operators

b)

Python Arithmetic Operators

c)

Python Comparison Operators

d)

Python Logical Operators

39.

Example of valid variable name

a)

12Name

b)

name$

c)

total-mark

d)

total_marks

40.

Which one of these is floor division?

a)

/

b)

//

c)

%

d)

#

41.

Which of the following operators is the correct option for power(ab)?

a)

a ^ b

b)

a**b

c)

a^^b

d)

a ^ * b

42.

How handsome is Mr Aryo?

a)

On a scale of one to handsome, Mr. Aryo is setting the scale ablaze with his sheer hotness!

b)

If being handsome were an Olympic sport, Mr. Aryo would definitely win the gold medal – and probably break the scale in the process!

c)

Forget about global warming; Mr. Aryo's hotness is the real cause of rising temperatures!

d)

Move over, Greek gods! Mr. Aryo's level of handsomeness is what legends are made of!