wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

grade 8

Total questions: 80

Worksheet time: 1hrs 6mins

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.

chose a string

a)

"tim"

b)

"tim

c)

'tim'

d)

"tim

e)

tim

4.

in python does it matter if we type ' and " together

a)

true

b)

false

5.

in python does i t matter if we right "and" this together and 'and' together

a)

true

b)

false

6.

is boolean a data type or a condition

a)

data type only

b)

data type and condition only

c)

condition only

7.

where is python used

a)

web aplications

b)

data science

c)

mobile apps

d)

GUI applications

8.

is boolean true or false

a)

true only

b)

false only

c)

true and false only

9.

Quel est le type de a : a="33"

a)

Integer

b)

Float

c)

String

d)

Boolean

10.

Quel est le type de a : a=33

a)

Integer

b)

Float

c)

String

d)

Boolean

11.

Quel est le type de a : a=33.0

a)

Integer

b)

Float

c)

String

d)

Boolean

12.
a)

b + a

b)

Salut

c)

lutSa

d)

ERROR

13.
a)

48

b)

48.0

c)

ERROR

d)

12*4

14.
a)

48.0

b)

ERROR

c)

48

d)

12*4.0

15.
a)

5

b)

32

c)

ERROR

d)

3 + "2"

16.
a)

60

b)

23

c)

35

d)

27

17.
a)

a

b)

4

c)

3

d)

b

18.
a)

Majeur

b)

Rien

c)

Mineur

d)

ERROR

19.

Python is a

a)

text language

b)

database language

c)

programming language

20.

Python has a simple syntax similar to the

a)

coding language

b)

english language

c)

spanish language

21.

Code for Hello, World!

a)

print Hello, World!

b)

print("Hello, World!)

c)

print("Hello, World!")

22.

Insert the missing part of the code below to output

_________________ "My name is ".

a)

Print

b)

PRINT

c)

print

23.

Python language use

a)

upper case letters

b)

lower case letters

c)

upper and lower case letters

24.

The output of the program

x = 4

x = "Sally"

print(x)

a)

four

b)

Saly

c)

Sally

25.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
26.
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
27.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
28.
What is the name of the programming language we are learning?
a)
Scratch
b)
Python
c)
Pie thin
d)
Scribble
29.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
30.
What is the name of the environment in Python that write your programs and then test them out?
a)
Shell
b)
Window
c)
IDLE
d)
CLI
31.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
32.

The punctuation requirements for printing a string in Python are:

a)

( ) , ! and " "

b)

( ) and !

c)

( ) and " "

d)

" " and !

33.
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.
34.
What will the output be from the following code?
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
35.
What will the output be from the following code?
Print("Hello world!")
a)
NameError
b)
Hello world!
c)
"Hello world"
d)
Print(Hello world!)
36.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
37.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

38.

Which of these codes is correct for creating a list of numbers?

a)

num = ('10','29','37','109')

b)

num = ['10','29','37','109']

c)

num == ('10','29','37','109')

d)

num = ['10 29 37 109']

39.

What is the index number for 'Spain'?

['England','Brazil','Spain','France']

a)

0

b)

1

c)

2

d)

3

40.

What is used to separate elements in a list?

a)

Bracket

b)

Comma

c)

Full Stop

d)

Space

41.

What brackets are used to create a list?

a)

()

b)

[]

42.

What does the '#' allow you to do?

a)

Repeat code

b)

Comment on code

c)

Print code

d)

End code

43.

Which of these operators means EQUAL TO?

a)

'='

b)

'=>'

c)

'<='

d)

'=='

44.

List items have an index number. In the following list, which item has the index number of 3?

["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

"John"

b)

"Harry"

c)

"Jesse"

45.

Which of these is the correct code for creating a list of names?

a)

nameList = John, Harry, Jesse, John, Harry, Harry

b)

nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")

c)

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

d)

nameList = [John, Harry, Jesse, John, Harry, Harry]

46.

Is this the correct code for a list?

register = {"Sam", "Pheobe", Georgia", Richard"}

a)

Yes

b)

No

47.

What is the index of “grape” in the list

[“apple”, “grape”, “orange”, “watermelon”]?

a)

0

b)

1

c)

2

d)

3

48.

What is the output of program below?


bicycles = ['trek', 'cannondale', 'redline', 'specialized']

print(bicycles[-1])

a)

trek

b)

cannondale

c)

redline

d)

specialized

49.
What is the position of the name "Robert" in the following list:
a)
0
b)
1
c)
2
d)
3
50.
Each item in a list has an "address" or index. The first index in a Python list is what?
a)
0
b)
1
c)
a
d)
A
51.
If you want to create an empty list called colours, which of the following pieces of code is correct?
a)
colours = [ ]
b)
colours = ( )
c)
colours = { }
d)
colors = [ ]
52.
What output will this code produce?
a)
red
b)
['blue', 'green', 'red']
c)
['red', 'green', 'blue']
d)
error
53.

Which of these is the correct code for creating a list of names?

a)

nameList = John, Harry, Jesse, John, Harry, Harry

b)

nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")

c)

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

d)

nameList = [John, Harry, Jesse, John, Harry, Harry]

54.

List items have an index number. In the following list, which item has the index number of 3?

["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

"John"

b)

"Harry"

c)

"Jesse"

55.

Which of these pieces of code would return the name "Harry" from the following list?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList()

b)

nameList[1]

c)

NameList(4)

d)

nameList["4"]

56.

Which of these is a list?

a)

fruit = ["pineapples", "mangoes", "bananas"]

b)

fruit = "pineapples", "mangoes", "bananas"

c)

fruit = {"pineapples", "mangoes", "bananas"}

d)

fruit = ("pineapples", "mangoes", "bananas")

57.

If you want to create an empty list called islands, which of the following pieces of code is correct?

a)

islands = { }

b)

islands = ( )

c)

islands = [ ]

d)

islands = < >

58.

Each item in a list has an "address" or index. The first index in a Python list is what?

a)

1

b)

0

c)

a

d)

A

59.

What is the index of the name 'Paula' in the following list:

names = ["Paul","Phillip","Paula","Phillipa"]

a)

0

b)

1

c)

2

d)

3

60.

What is the output of program below?


mariana_islands = ['Guam', 'Saipan', 'Tinian', 'Rota']

print(mariana_islands[-1])

a)

Guam

b)

Saipan

c)

Tinian

d)

Rota

61.

What is the output of program below?


mariana_islands = ['Saipan', 'Tinian', 'Rota']

mariana_islands[0] = 'Guam'

print(mariana_islands)

a)

['Saipan', 'Tinian', 'Rota']

b)

['Guam', 'Tinian', 'Rota']

c)

['Saipan', 'Tinian', 'Rota', 'Guam']

d)

['Guam', 'Saipan', 'Tinian', 'Rota']

62.

What is the output of program below?


mariana_islands = ['Guam', 'Saipan', 'Tinian', 'Rota']

print(mariana_islands[1])

a)

Guam

b)

Saipan

c)

Tinian

d)

Rota

63.

What is the output of the program below?


mariana_islands = ['Guam', 'Saipan', 'Tinian', 'Rota']

cmni = mariana_islands[1:]

len(cmni)

a)

1

b)

2

c)

3

d)

4

64.

Which of these is the correct code for creating a list of names?

a)

nameList = John, Harry, Jesse, John, Harry, Harry

b)

nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")

c)

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

d)

nameList = [John, Harry, Jesse, John, Harry, Harry]

65.

List items have an index number. In the following list, which item has the index number of 3?

["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

"John"

b)

"Harry"

c)

"Jesse"

66.

Which of these pieces of code would return the name "Harry" from the following list?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList()

b)

nameList[1]

c)

NameList(4)

d)

nameList["4"]

67.

The list needs one more name added to the end - "Felipe". Which piece of code below would do this?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList.append(Felipe)

b)

append(nameList,"Felipe")

c)

nameList.append["Felipe",7]

d)

nameList.append("Felipe")

68.

What would this code show on the screen?

a)

7

b)

6

c)

5

d)

4

e)

An error

69.

What would this code show in the shell?

a)

3

b)

2

c)

1

d)

0

e)

An error

70.

The list needs one more name added to the end - "Felipe". Which piece of code below would do this?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList.append(Felipe)

b)

append(nameList,"Felipe")

c)

nameList.append["Felipe",7]

d)

nameList.append("Felipe")

71.
What output will this code produce?
a)
blue
b)
green
c)
red
d)
error
72.

What is the output of program below?


bicycles = ['trek', 'cannondale', 'redline', 'specialized']

print(bicycles[-1])

a)

trek

b)

cannondale

c)

redline

d)

specialized

73.

Which method is used to add a value at a specified position in the list?

a)

append

b)

extend

c)

insert

d)

pop

74.

Which symbols are used to open and close a list?

a)

( ) round brackets

b)

( ) curly brackets

c)

[ ] square brackets

d)

" " speech marks

75.

To add an item to the end of a list we use

a)

fruit.add("strawberries")

b)

fruit.append("strawberries")

c)

append(fruit("strawberries")

d)

("strawberries").append[fruit]

76.

To insert an item in the first position of a list we use

a)

fruit.append("strawberries, 1")

b)

fruit.insert("strawberries",0)

c)

fruit.insert(1, "strawberries")

d)

fruit.insert(0, "strawberries")

77.

List items have an index number. In the following list, which item has the index number of 3?

["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

"John"

b)

"Harry"

c)

"Jesse"

78.

Which of these pieces of code would return the name "Harry" from the following list?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList()

b)

nameList[1]

c)

NameList(4)

d)

nameList["4"]

79.

The list needs one more name added to the end - "Felipe". Which piece of code below would do this?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList.append(Felipe)

b)

append(nameList,"Felipe")

c)

nameList.append["Felipe",7]

d)

nameList.append("Felipe")

80.

Is this the correct code for a list?

register = {"Sam", "Pheobe", Georgia", Richard"}

a)

Yes

b)

No