Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Tynker Python 101 Unit Test

Total questions: 50

Worksheet time: 25mins

Name
Class
Date
1.

What do you know about text-based programming languages (e.g., JavaScript, Python)? Have you ever used a text-based programming language?

4 lines
2.

How would you call a function named “my_function”?

a)

Call my_function()

b)

my_function

c)

my_function))

d)

my_function()

3.

You are not able to call the same function twice in a row.

a)

True

b)

False

4.

The parentheses at the end of a function call are optional.

a)

True

b)

False

5.

A programming language that is widely used in web development, game development, and scientific research. It is known for being highly readable and uncluttered, using whitespace indentation instead of curly braces or keywords.

(a)  

6.

Write sentences to answer questions

Why is it important that programmers follow the same conventions for naming things in code?

4 lines
7.

Write sentences to answer questions

What is an algorithm? How does solving a puzzle in Tynker require creating an algorithm?

4 lines
8.

The set of rules that govern how a language is structured.

(a)  

9.

Write sentences to answer questions

What happens if you don’t follow the rules in English (for example, by not capitalizing the first word of a sentence or using a double negative) versus when you don’t follow the rules of Python (for example, by naming an identifier with a reserved word)?

4 lines
10.

An instruction that you give the computer.

(a)  

11.

A unique name that you can refer to later.

(a)  

12.

Identifiers are only allowed to start with an underscore or letter.

a)

True

b)

False

13.

In Python, an identifier may begin with an underscore or a letter. Which of the following is a valid identifier? Select all that apply.

a)

dollar_sign

b)

NUM_COUNT

c)

_total

d)

2_count

14.

A naming convention in Python and other languages. Variable and function names (identifiers) cannot have spaces in them

(a)  

15.

What will display when you Play these commands?


# The next line is commented out and won't run

# turn_right()

a)

The next line is commented out and won't run

b)

turn_right()

c)

both lines

d)

Nothing

16.

What will display when you Play these commands?


print("Hello")


# print("Hello there")

a)

Hello

b)

Hello there

c)

both lines

d)

Nothing

17.

What will display after you Play this code?

'''

The rain in Spain

Stays mainly in the Plain

'''

print("My Fair Lady")

a)

The rain in Spain

Stays mainly in the Plain

b)

My Fair Lady

c)

both lines

d)

Nothing

18.

Make the character jump over a gap and land on the other side.

a)

jump_over();

b)

jump_up()

c)

jump()

d)

Jump()

19.

Launch an arrow that moves 5 blocks in the direction the character is facing.

a)

Fire();

b)

fire();

c)

fire_forward()

d)

fire()

20.

Turn the character to the right.

a)

turn_right()

b)

turn_right();

c)

turnRight();

d)

turnRight()

21.

Move the character one step forward.

a)

forward();

b)

Forward()

c)

forward()

d)

forward_()

22.

Turn the character to the left.

a)

turn_left();

b)

turn_left()

c)

turnLeft();

d)

turnLeft()

23.

Which of the following is a valid function call?

a)

forwad)

b)

tu-left()

c)

forward()

d)

forward(;

24.

In Python, an identifier may begin with an underscore or a letter. Which of the following is a valid identifier? Select all that apply.

a)

_total

b)

2_count

c)

NUM_COUNT

d)

dollar_sign

25.

You can replace the parentheses on a function call with square brackets.

a)

True

b)

False

26.

'''Which of the following is the correct way to start a multi-line comment?

a)

'''

b)

/*

c)

#

d)

//

27.

What is the error in this code?

What is the error in this code?

''' This function does something '''

def foo() :

print("hello world") ''' prin

a)

The single line comment must use # instead of '''

b)

The end of the multi-line comment cannot be on its own line

c)

The beginning and end of the multi line comments are incorrect

d)

All answers are errors in the code

28.

When would you use an "if-else" statement over an "if" statement?

a)

When you want to stop running code once the condition is false

b)

When you want to run different code if a condition is false

c)

When you want to run code and then check if the condition is true after

d)

They have the exact same function

29.

There is no difference between an "if" statement and an "if-else" statement.

a)

True

b)

False

30.

When running this code, what will the character do if there is an enemy?

if not enemy_in_sight() :

fire()

a)

fire

b)

nothing

c)

walk forward

d)

jump

31.
This checks whether a condition is true before each time it executes the code inside of it.
a)
"While" Loop
b)
"During" Loop
c)
"Before" Loop
d)
"Fruit" Loop
32.
The set of rules that govern how a programming language is structured. 
a)
Syntax
b)
Python
c)
Command
d)
Identifier
33.
When you declare a function, variable, or data structure, you need to give it a name called a(n):
a)
Python
b)
Syntax
c)
Command
d)
Identifier
34.
This lets you execute a code a predetermined number of times. 
a)
Loop
b)
"For" Loop
c)
Indentation
d)
"Nested" Loop
35.
This executes the code inside it once before checking whether the condition is true for each subsequent iteration. 
a)
"While" Loop
b)
"Do-while" Loop
c)
"Break" Statement
d)
Infinite Loop
36.
This loop will never stp iterating. 
a)
Infinite Loop
b)
"Break" Statement
c)
"While" Loop
d)
"Do-while" Loop
37.
Putting a _ into a name, such as player_scores, is a naming convention called:
a)
python_case
b)
cd_case
c)
snake_case
d)
pillow_case
38.
A sequence that is repeated until programmed to stop. 
a)
Sequencing
b)
Loops
c)
Costume
d)
Animation
39.
Placing elements in a particular order. 
a)
Sequencing
b)
Loops
c)
Costume
d)
Animation
40.
Different poses for characters used in animation. 
a)
Animation
b)
Loops
c)
Sequencing
d)
Costume
41.
The rapid display of a sequence of costumes to depict motion. 
a)
Animation
b)
Loops
c)
Sequencing
d)
Beachball
42.
A computer programming convention that is used to compare alternatives to determine if they are true or false. The "if then" statement is one of these. 
a)
for loop
b)
if then statement
c)
conditional statement
d)
prepositional phrase
43.
Writing instructions that tell a computer what to do. 
a)
Coding
b)
skiing
c)
composition
d)
math
44.
A(n) ______ is just any object that is part of your program other than the stage. 
a)
actor
b)
stage
c)
event
d)
costume
45.

What function do you use to create a new Turtle object?

a)

turtle.Screen()

b)

turtle.Turtle()

c)

turtle.penup()

d)

turtle.goto()

46.

Which of the following code sets the screen's color to red?

a)

screen.color("red")

b)

screen.make("red")

c)

screen.hide("red")

d)

screen.bgcolor("red")

47.

How would you move an object forward 3 times?

a)

forward() forward() forward()

b)

forward() * 3

c)

Call_forward() 3 times

d)

forward() {3}

48.

"For" loops can increment upwards or downwards.

a)

True

b)

False

49.

Why should you indent your code?

a)

In Python, the program’s execution changes based on whether you indent or not

b)

Code that is not indented properly will produce syntax errors

c)

It is much easier to read indented code

d)

All of the above

50.

Which "for" loop will move your character 5 times?

a)

for i in range(1,5) : forward()

b)

for i in range(5) : forward()

c)

for i in range(1,3) : forward()

d)

for i in range(2,5) : forward()