5.10.1: Functions and Parameters Quiz

5.10.1: Functions and Parameters Quiz

10th Grade

26 Qs

quiz-placeholder

Similar activities

Ensamblado de PC y BIOS

Ensamblado de PC y BIOS

10th - 12th Grade

22 Qs

PAS JACOB SEM 1

PAS JACOB SEM 1

10th Grade

21 Qs

AMSI Python Quiz

AMSI Python Quiz

9th - 12th Grade

21 Qs

одномерные массивы

одномерные массивы

10th Grade

22 Qs

Computer System

Computer System

9th - 11th Grade

21 Qs

Social Media and the Internet Safety

Social Media and the Internet Safety

1st - 11th Grade

21 Qs

Penegnalan Komputer X KM 11

Penegnalan Komputer X KM 11

10th Grade

21 Qs

The Future of Your Job in the Age of AI (Video 6)

The Future of Your Job in the Age of AI (Video 6)

10th Grade

21 Qs

5.10.1: Functions and Parameters Quiz

5.10.1: Functions and Parameters Quiz

Assessment

Quiz

Computers

10th Grade

Practice Problem

Easy

Created by

Dawn Madden

Used 8+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

print

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

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers