wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Ozaria Python Code Practice Quiz

Total questions: 75

Worksheet time: 44mins

Name
Class
Date
1.

What is the purpose of using variables in Python?

a)

To store and manipulate data

b)

To confuse the programmer

c)

To slow down the program

d)

To make the code longer

2.

What is the output of the following code snippet? x = 5 if x > 3: print('x is greater than 3') else: print('x is less than or equal to 3')

a)

x is equal to 3

b)

x is less than 3

c)

x is greater than 3

d)

x is greater than or equal to 3

3.

What is the purpose of using a function in Python?

a)

To encapsulate a set of instructions that can be reused and called multiple times within a program.

b)

To confuse other programmers

c)

To slow down the program execution

d)

To make the code longer and more complicated

4.

What is the output of the following code snippet? try: x = 10 / 0 except ZeroDivisionError: print('Cannot divide by zero')

a)

The result is 0

b)

Error: Division by zero

c)

Division by zero is not allowed

d)

Cannot divide by zero

5.

What is the correct way to write an if statement that checks if a variable 'age' is greater than 18 in Python?

a)

if age >= 18:

b)

if age > 18:

c)

if age == 18:

d)

if age < 18:

6.
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
7.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
8.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

9.
What is Python?
a)
text based programming language
b)
word processor 
c)
spreadsheet
d)
block based programming language
10.

What is Algorithm?

a)

Fixing bugs

b)

Functions

c)

A sequence of instructions

d)

Game design

11.

Fixing errors in programming is called ...

a)

Optimization

b)

Debugging

c)

Looping

d)

Cleaning

12.

A command that lets us repeat an action multiple times in your code

a)

Algorithm

b)

Loop

c)

Variable

d)

Method

13.

Which line of code is used to make a loop?

a)

for i in range(5)

b)

# Code normally executes in the order it's written.

c)

hero.build("upArrow")

d)

a = "door"

14.

Find the object in the following code:

helper.build("upArrow")

a)

helper

b)

build()

c)

upArrow

d)

hero

15.

Find the argument in the following code:

hero.moveUp(4)

a)

hero

b)

moveUp()

c)

4

d)

Up()

16.

Find the method in the following code:

hero.use("door")

a)

hero

b)

use()

c)

door

d)

" "

17.

Which python operator means 'less than or equal to'?

a)

>=

b)

>

c)

<

d)

<=

18.

Python uses indentation to block code into chunks

a)

True

b)

False

19.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
20.
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")
21.

What is the term for a set of rules for how things are spelled and formatted in code so the computer can understand it?

a)

debugging

b)

syntax

c)

loop

d)

decoding

22.

What is a loop in programming?

a)

a syntax that directs a program to repeat over and over again until a specific number is reached

b)

a syntax that directs a program to skip over a specific piece of code

c)

a syntax that directs a program wait until a condition is met for a specific subset to be activated

d)

the best type of cereal when it is flavored with fruit and sold by a toucan

23.

How can you format programming text to show it is part of a loop in Python?

a)

bold

b)

italicize

c)

indent

d)

circle

24.

What are Strings?

a)

a type of data that represents text. In both Python and JavaScript, strings are represented by text inside quotes.

b)

A character or thing that can perform actions.

c)

the rules for correct spelling, grammar, and punctuation in a programming language.

d)

An action performed by an object.

25.

What is an Object?

a)

A character or thing that can perform actions.

b)

Data about or belonging to an object.

c)

A programming structure used to repeat actions without the player needing to write the same lines of code over and over.

d)

a type of data that represents text.

26.

What do For Loops do?

a)

A programming structure used to repeat actions without the player needing to write the same lines of code over and over.

b)

Data about or belonging to an object.

c)

Repeat a block of code while a certain condition is true.

d)

Repeat a block of code a certain number of times.

27.

What do While Loops do?

a)

A programming structure used to repeat actions without the player needing to write the same lines of code over and over.

b)

Repeat a block of code a certain number of times.

c)

Repeat a block of code while a certain condition is true.

d)

An action performed by an object.

28.

write code to build their own apps and games

a)

Developers

b)

Sequence

c)

Code

29.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
30.

the order in which the command are given.

a)

Code

b)

Commands

c)

Sequence

31.

an error in your code

a)

Bug

b)

Debugging

c)

Sequence

32.

Determine the next line of code:

hero.moveRight(2)

hero.moveUp()

a)

hero.say("open sesame")

b)

hero.moveUp()

c)

hero.use("door")

d)

hero.jumpUp()

33.

The following 10 lines of code can be shortened to...

hero.moveDown()

hero.moveRight()

hero.moveRight()

hero.moveDown()

hero.moveUp()

hero.moveUp()

hero.moveLeft()

hero.moveDown()

hero.moveLeft()

hero.moveLeft()

a)

7 lines

b)

5 lines

c)

6 liens

d)

impossible to condense

34.

What language will you use to talk to the Acodus?

a)

Programming

b)

English

c)

Computer

d)

None of the above

35.

Which of these is a method?

a)

use

b)

hi

c)

Vega

d)

Mouse

36.

Which of these is an appropriate comment for a subgoal in this scenario?*

a)

#sneak across the traps


b)

#sneak through the grass


c)

jump through the grass


d)

#use jump on the traps


37.

Which is not an appropriate subgoal for this level?

a)

#jump across the river and pits


b)

#sneak through the grasses


c)

move across the grass slowly


d)

#get passed the enemy by not being detected


38.

What is the type of error(s), and error(s) are present in this code?

a)

logic, not moving the right directions

b)

logic, not enough moves in arguments

c)

syntax and logic, missing a parenthesis and period

d)

syntax and logic, object and a method is not typed correctly and missing parenthesis and period

e)

syntax, misspelled words and objects

39.

How many subgoals/comment codes should you have at minimum here?

a)

1

b)

2

c)

3

d)

4

40.

What is the correct value of the variable "steps" that should be used in this scenario?

a)

1

b)

2

c)

3

d)

4

e)

5

41.

When a file is sent across networks, it is broken down and sent in smaller pieces, known as...

a)

binary code

b)

pixels

c)

packets

d)

images

42.

The rules that allow different devices to communicate and share information is known as...

a)

data

b)

protocols

c)

networks

d)

HTTP

43.

Which of the following best describes a network?

a)

two or more computers that are connected with one another for the purpose of communicating electronically

b)

an internet service provider

c)

a method of transferring data using encoding schemes

d)

none of the above

44.

What is the least number of lines of code needed in order to reach the red flag?

a)

1

b)

2

c)

3

d)

4

45.

Which code doesn't exist in Ozaria?

a)

hero.build("rightArrow")

b)

hero.jumpLeft()

c)

hero.attack("Treg")

d)

hero.moveDown()

46.

How many lines of code have bugs?


hero.moveLeg()

hero,moveDown()

hero.move()

hero.use("door")

a)

1

b)

2

c)

3

d)

4

e)

No errors

47.

What is the minimum lines of code needed to collect all the gems?

a)

3

b)

4

c)

6

d)

10

48.

for index in range(___):

helper.moveUp()

helper.moveLeft()

a)

4

b)

2

c)

5

d)

8

49.

Is it possible to reach the lever using 3 lines of code only?

a)

Yes

b)

No

50.

Find the argument in the following code:

hero.moveUp(4)

a)

hero

b)

moveUp()

c)

4

d)

Up()

51.

Find the method in the following code:

hero.use("door")

a)

hero

b)

use()

c)

door

d)

" "

52.

helper.moveDown(2)

helper.build("rightArrow")

helper.moveRight()

helper.build"downArrow"

Does this code above have an error(s)?

a)

Yes

b)

No

53.

How many lines of code is needed to build a path to the crystal battery?

a)

4

b)

5

c)

8

d)

10

54.

How many down arrows you should build in this task?

a)

3

b)

4

c)

6

d)

None of them

55.

This term is used to describe code that tells the computer to perform a task if certain actions are possible or not.

a)

debugging

b)

conditional

c)

variable

d)

cheetos

56.

telling a computer what to do.

a)

Command

b)

Code

c)

Developers

57.

A sequence of instructions that can be used to solve a problem or set of problems

a)

Algorithm

b)

Condition

c)

Syntax

58.

a command that lets us repeat an action multiple times in your code

a)

Decomposition

b)

Coding

c)

Loop

59.

a set of rules for how things are spelled and formatted in code so that the computer can understand it

a)

Syntax

b)

Sequence

c)

Loop

60.

What is a logical error?

a)

the wrong direction or human error

b)

a misspelling or wrong format of the code

c)

the code doesn't work

61.

Code Bank

a)

 a method that changes the look of your player

b)

a method that changes the look of your background

c)

A play to find more information about the different method and tools you can use while you code.

d)

a method that changes the size of your games map

62.

Helper.setBackgroud(“crystal”):

a)

 a method that changes the look of your player

b)

a method that changes the look of your background

c)

A play to find more information about the different method and tools you can use while you code.

d)

a method that changes the size of your games map

63.

helper.setPlayer(“turtle”)

a)

 a method that changes the look of your player

b)

a method that changes the look of your background

c)

A play to find more information about the different method and tools you can use while you code.

d)

a method that changes the size of your games map

64.

helper.setMapSize(“small”)

a)

 a method that changes the look of your player

b)

a method that changes the look of your background

c)

A play to find more information about the different method and tools you can use while you code.

d)

a method that changes the size of your games map

65.

Assigns IP addresses to user devices as they access the network

a)

SMTP

b)

DHCP

c)

DNS

d)

HTTPS

66.

We can reassign variable values by retyping the variable name and setting it equal to another value. This value in this example is called a...

a)

name

b)

integer

c)

number

d)

string

67.

In conditionals we use comparators, which of these is NOT a valid comparator we use?

a)

=

b)

>=

c)

<

d)

*

68.

Which method is going to be important to use for this level?

a)

hero.sneak()

b)

getDistanceTo(enemy)

c)

hero.UseEarthPit(enemy)

d)

hero.jumpRight()

69.

You would use castEarthPit(enemy) on an enemy that is...

a)

< 3 distance

b)

=2 distance

c)

>2 distance

d)

< 5 distance

70.

Which of these is not an input device in a computing system

a)

monitor

b)

keyboard

c)

mouse

d)

microphone

71.

To properly exit a loop, you must...

a)

type "end.loop"

b)

indent the line of code again

c)

unindent the next line of code

d)

hit enter twice

72.

a for loop will end when...

a)

a certain condition is met

b)

the argument value has been met

c)

the character is on a specific marker location

d)

the hero moves up

73.

A loop inside of another loop is referred to as...

a)

compound loop

b)

loopdy loop

c)

quantum loop

d)

a nested loop

74.

pseudocode is the process of...

a)

writing your first draft of code and checking for bugs

b)

writing out your code in plain text to plan it out

c)

writing your code out after you've checked it for errors

d)

writing out the opposite code

75.

Using the Caesar Cipher method, decode this: ghexj

a)

mouse

b)

modem

c)

apple

d)

debug