wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming Sandbox Week 1

Total questions: 71

Worksheet time: 1hrs 20mins

Name
Class
Date
1.

When Python runs a program, which direction does it read the code? Mark only one oval.

a)

Bottom to top

b)

Top to bottom

c)

Left to right only

d)

It reads all lines at once

2.

What does the print() function do in Python?

4 lines
3.

Fill in the blank: The (a)   function asks the user a question and waits for them to type an answer.

4.

What is a variable in Python? Mark only one oval.

a)

A type of loop

b)

A place to store information

c)

A way to ask questions

d)

A math problem

5.

Code example:
color = input("What is your favorite color? ")

print("I like", color, "too!")

What will happen when this program runs?

4 lines
6.

Write a line of code that asks the user "What is your name?" and stores their answer in a variable called name.

4 lines
7.

What does print() do? Mark only one oval.

a)

Shows text on the screen

b)

Asks the user a question

c)

Stores information

8.

What does input() do? Mark only one oval.

a)

Shows text on the screen

b)

Asks the user a question

c)

Stores information

9.

What does a Variable do? Mark only one oval.

a)

Shows text on the screen

b)

Asks the user a question

c)

Stores information

10.

Why is it helpful to use formatting like titles, spacing, and labels in your programs?

4 lines
11.

Write a short program (2–3 lines) that asks the user for their favorite animal and then prints a message using their answer.

4 lines
12.

True or False: In the Creative Coding Sandbox activities, there is only one correct way to solve each practice problem. Mark only one oval.

a)

True

b)

False

13.

Look at this program idea: "Ask the user to choose between being a wizard or a scientist, then print a message that matches their choice." What would you need to use to make this program work? Choose all that apply.

a)

input() to ask the question

b)

A variable to store the answer

c)

print() to show the response

d)

A calculator

14.

Describe one thing you could add to a "Silly Story Generator" program to make it more fun or interesting.

4 lines
15.

Coding Time — The Friendly Greeter: Create a program that asks for the user's name and prints a friendly greeting. Try to make it sound welcoming or funny. Bonus idea: Add a second question (favorite color, animal, or food). Paste your code and output here.

4 lines
16.

Why should you think about regarding formatting your code?

a)

How formatting makes your program easier to read

b)

How to hide text from the user

c)

How to remove all spacing

d)

How to avoid labels

17.

According to the listed requirements for the program where the experience matters, which items must your program include? Select all that apply.

a)

Clear instructions

b)

Friendly language

c)

Organized output

d)

A strong opening and closing message

e)

Random keyboard shortcuts

18.

In the instruction to "Design for the User," what is the primary focus of the program?

a)

User experience

b)

Algorithm efficiency

c)

Data storage capacity

d)

Network security policies

19.

What is the function of the code:

amount = int(input("Enter a conversion into pounds:))

currency = input ("press 1 for indian rupees, 2 for Chinese yuan or 0 to exit:")

a)

to find the total amount of currency altogether

b)

to calculate and convert the exchange rates.

20.

The variable num is what type?

a)

str

b)

int

c)

float

d)

num

21.

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’

22.

In python the ' BOOLEAN data type' can be defined as...?

a)

holds alphanumerical data

b)

holds whole numbers

c)

holds a number with a decimal point

d)

holds either true or false

23.

What is the data type return for this code: print(type(3.0))

a)

<class 'int'>

b)

<class 'str'>

c)

<class 'float'>

d)

<class 'bool'>

24.

If my_variable = "lunch", what is the data type of my_variable?

a)

integer

b)

word

c)

string

d)

boolean

25.

What is the data type of the value "True" in Python?

a)

int

b)

str

c)

bool

d)

float

26.

What programming language are we learning/ using?

a)

Python

b)

Scratch

c)

Java

d)

C++

27.

In Python, what is output?

a)

Built-in tools, such as print

b)

Text in parentheses

c)

The name of a variable

d)

The result of the code, what is seen when it runs

28.

How would you create a program to display "Hello World!"?

4 lines
29.

Which of the following is the correct way to display the value of a variable called score in Python?

a)

print(score)

b)

display(score)

c)

output(score)

d)

show(score)

30.

What will be the output of the following code?
name = input("Enter your name: ")
print("Hello, " + name)

a)

It will print 'Hello, ' followed by whatever the user types.

b)

It will print only 'Hello, name'.

c)

It will show an error.

d)

It will print 'Enter your name: Hello, name'.

31.

Which statement correctly assigns the value 10 to a variable called age in Python?

a)

age = 10

b)

int age = 10

c)

10 = age

d)

age : 10

32.

How does Python handle the division of a number by zero when using integers?

a)

It returns a ZeroDivisionError.

b)

It returns zero as the result.

c)

It converts the division to a float division and returns infinity.

d)

It prompts the user to enter a non-zero divisor.

33.

What is Python?

a)

text based programming language

b)

Monty Python

c)

spreadsheet

d)

a cow

34.

Computational thinking is the process of

a)

touching grass

b)

finding the problem, breaking it down and finding a solution using computer science principles like decomposition, pattern recognition, abstraction, and algorithmic thinking to formulate problems and design solutions.

c)

watching a movie

d)

farming aura

35.

The syntax in Python is one of the main advantages over other high level programming languages.

a)

True

b)

False

36.

Which of the following is true about Python code?


a)

Punctuation is not important

b)

It is used in every computer program

c)

Math is never involved

d)


Capitalization matters because it is case sensitive

37.

What symbol is used in python to assign values to a variable?

a)


equals =

b)

plus + 

c)

forward slash /

d)

asterisk *

38.

Which of the following is a valid variable name in Python?

a)

value_2

b)

value-2

c)

2value

d)

value 2

39.

Which function is used to get input from the user in Python?

a)

output()

b)

input()

c)

read()

d)

scan()

40.

Based on the following code, what gets printed to the screen?

greeting = 7

name = "Bob"

greeting = "Hello"

print(greeting)



(a)  

41.

Suppose you have variable x = 4 and y = 2. What will get printed to the screen when this is executed?

print(x / y)

a)

error

b)

farm

c)

x / y

d)

2.0

42.

Which choice below correctly prints out the value of the variable?

city = "Searcy"

a)

print(cat)

b)

print("city")

c)

print(0)

d)

print(city)

43.

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

a)

True

b)

False

44.

To create a newline at the end of prompt, you can use which of the following expressions?

a)

\n

b)

duh

c)

no

d)

break

45.

What will be the output of the following code?

print(5 * 3)

a)

53

b)

error

c)

15

d)

8

46.

If you want to add two numbers entered by the user, which code would you use?

a)

sum = print() + print()

b)

sum = input() + input()

c)

sum = int(input()) + int(input())

d)

sum = str(input()) + str(input()

47.

Which of the following will print 'Python is fun!' to the screen?

a)

print('Python is fun!')

b)

output('Python is fun!')

c)

show('Python is fun!')

d)

display('Python is fun!')

48.

Which of the following statements will create a variable named score with the value 10?

a)

score -> 10

b)

score == 10

c)

score: 10

d)

score = 10

49.

Which of the following is NOT a valid data type in Python?

a)

int

b)

bool

c)

float

d)

char

50.

What will be the output of the following code?
print(type(42.0))

a)

<class 'str'>

b)

<class 'float'>

c)

<class 'bool'>

d)

<class 'int'>

51.

Which symbol is used to start a comment in Python?

a)

--

b)

/*

c)

#

d)

//

52.

What will print?
def sayHi():
    print("hi there")

sayHi()

a)

nothing

b)

sayHi()

c)

an error message

d)

hi there

53.

Which function is called to display a message on the screen?

a)

input

b)

int

c)

print

d)

chr

54.

What will be the output of the following code?
print(5 * 2)

a)

10

b)

7

c)

25

d)

error

55.

Which data type would you use to store a person's age in Python?

a)

int

b)

str

c)

bool

d)

float

56.

What is the variable when setting a thermometer?

a)

How many people are in the room

b)

The room you are in

c)


The temperature

d)

None

57.

A computer program is best described as a series of ___________.

a)


Instructions

b)

Questions

c)

Answers

d)

Numbers

58.

What is another term for a mistake in a computer program? 

a)

Bug

b)

Cow

c)

Cat

d)

Dog

59.

What is wrong with the following "code" for opening a bottle?
1. Grip cap with index finger and thumb
2. Remove cap
3. Twist counter-clock-wise until seal is broken

a)

too many steps

b)

bad

c)

wrong

d)

instructions are out of sequence

60.

Write a Python program that asks the user for two numbers and prints their sum.

Example Input/Output:

Enter first number: 5

Enter second number: 7

The sum is 12

4 lines
61.

Write a Python program that asks the user for a number and prints its multiplication table up to 10.

Example Input/Output:

Enter a number: 3

3 x 1 = 3

3 x 2 = 6

...

3 x 10 = 30

4 lines
62.

Write a Python program that asks the user for a number and prints its square.

Example Input/Output:

Enter a number: 4

The square of 4 is 16

4 lines
63.

Write a Python program that asks the user for three numbers and prints their average.

Example Input/Output:

Enter first number: 5

Enter second number: 10

Enter third number: 15

The average is 10.0

4 lines
64.

Write a Python program that asks the user for principal, rate, and time, then calculates simple interest using the formula in the attached image.

Example Input/Output:

Enter principal: 1000

Enter rate: 5

Enter time (years): 2

Simple Interest is 100.0

4 lines
65.

Which statement will cause an error?

a)

print("2" + 3)

b)

print(2 * 3)

c)

print(2 * "3")

d)

print("2" * 3)

66.

Which symbol represents multiplication?

a)

*

b)

/

c)

+

d)

**

67.

Which code would display 'Hello World'

a)

Print("Hello World")

b)

print("Hello World")

c)

print(Hello World)

d)

print=("hello world")

68.

What does the following Python code display?


print("Hello")

print("World")


a)

Hello

World

b)

HelloWorld

c)

Hello World

d)

Hello


World

69.

x = 5

y = 6

print("x*y")


The code above displays the following:

a)

11

b)

x*y

c)

Syntax Error

d)

30

70.

x = 5

y = 6

print(x*y)


The code above displays the following:

a)

11

b)

x*y

c)

Syntax Error

d)

30

71.

A line of text that Python won't try to run as code

a)

comment

b)

modulo

c)

variable

d)

boolean