
5.10.1: Functions and Parameters Quiz
Quiz
•
Computers
•
10th Grade
•
Practice Problem
•
Easy
Dawn Madden
Used 8+ times
FREE Resource
Enhance your content in a minute
26 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In the following code: size = 20 x = 200 y = 300 ball = Circle(size) circle.set_position(x, y) What is the meaning of the x variable?
The x coordinate of the left side of a box that would hold the circle
The x coordinate of the right edge of the circle
The radius of the circle
The x position of the center circle
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The following program should draw a circle on the screen def draw_circle(x, y): circle = Circle(100) circle.set_position(x, y) But when we run this code, we don’t see the circle. What is missing?
Since we are trying to create a circle, we need to use the create_circle command.
The code will have an error since you need to define the color.
You need to add the circle with the circle.add() command.
You need to add the circle with the add(circle) command.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
We want to position a Circle on our screen to be at a random position, but we want to keep the entire shape on the screen. Which of the following will accomplish this given the following function? (Assume SIZE, HEIGHT, and WIDTH are properly defined) def draw_circle(x, y, radius): circle = Circle(radius) circle.set_position(x, y) add(circle)
x = random.randint(0, HEIGHT) y = random.randint(0, WIDTH) draw_circle(x, y, SIZE)
x = random.randint(SIZE, WIDTH - SIZE) y = random.randint(SIZE, HEIGHT - SIZE) draw_circle(x, y, SIZE)
x = random.randint(0, HEIGHT) y = random.randint(0, WIDTH) draw_circle(SIZE, y, SIZE)
x = random.randint(HEIGHT, SIZE) y = random.randint(WIDTH, SIZE) draw_circle(x, y, SIZE)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Why do we write functions? I. Make our code easier to understand by giving a readable name to a group of instructions II. Avoid writing repeated code III. Make our code reusable
I and III
I only
I and II
I, II, and III
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In the following function print_three_times: def print_three_times(word): print(word) print(word) print(word) What is the parameter of the function?
print_three_times
def
word
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following program? def sum_to(num): sum = 0 for i in range(num + 1): sum = sum + i return sum x = 5 sum_to(x) print(x)
5
15
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is printed by the following program? def print_numbers(two, one, zero): print(two) print(one) print(zero) zero = 1 one = 0 two = 2 print_numbers(zero, one, two)
2 1 0
0 1 2
ZERO ONE TWO
two one zero
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
28 questions
MAWD 1.01 B
Quiz
•
KG - University
21 questions
Video Production 2
Quiz
•
9th - 12th Grade
21 questions
Network devices and monitoring
Quiz
•
9th Grade - University
22 questions
AS Data Types and Programming Constructs
Quiz
•
10th - 12th Grade
21 questions
Y3 Unit 1
Quiz
•
3rd Grade - University
26 questions
Soccer Rules
Quiz
•
7th - 12th Grade
21 questions
Computer Program
Quiz
•
10th - 12th Grade
25 questions
Database Management System
Quiz
•
10th Grade
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
