Computational Thinking Quiz 12/20

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What two things must be included in your function definition?

A function name and commands to be performed

What is the correct way to ask a user for a color and store the answer as a variable?

user_color = input("Give a color: ")

Comments are:

written for humans to read and understand

If Tracy started facing right, which direction would she be facing after we ran the following code? 1. left(90) 2. left(90) 3. right(90)

Up

Which is the proper way to call the function three_circles?

three_circles()

What punctuation is needed to begin a multi-line comment?

" " "

What symbol is used at the beginning of an in-line comment?

#

Tracy always starts facing which direction?

East

NOT a reason for loops are useful when writing code:

Loops let us make shapes of multiple sizes

If Tracy is facing right, which of the following commands can be used to turn her to face up?

left(90) turn(up)

Which of the names below follow all naming rules?

make_square

If you want Tracy to move forward 100 pixels without making a line, what set of commands should you write?

penup( ) forward(100)

How would I collect a number from the user to use for the radius of a circle?

radius = int(input("What is the radius?: "))

If you wanted Tracy to complete her command immediately, which speed value would you use?

0

How far does Tracy need to move from the starting position to reach the right side of the canvas?

200 pixels

The following loop draws 3 circles on the screen. If I wanted to alter this loop to draw 10 circles, how many lines would my code be? 1. for i in range(3): 2. circle(25) 3. forward(50)

3 lines

If Tracy starts at the left edge of the canvas and moves forward 50 pixels, how many times will this code need to be repeated to have Tracy reach the right edge of the canvas?

4 times

What are the dimensions of Tracy's world?

400 pixels by 400 pixels

Where does Tracy always start in the grid world?

At the (0, 0) coordinate in the middle of the canvas.

Which of the following is NOT a way functions make our code more readable?

Each function only contains one command

What would be the output of the following command? circle(50,360,5)

It draws a pentagon

Which lines of the code below will be repeated 4 times? 1. penup() 2.for i in range(4): 3. pendown() 4. circle(25) 5. forward(50) 6.backward(200)

Lines 3, 4, and 5

When Tracy is facing right, from what location does she start drawing her circle?

She starts from the bottom of the circle.

If I use the command right(180), which way will Tracy turn?

She will turn around

Variables allow us to:

Store information to use in our code

If you want three circles to be drawn next to each other, after drawing the first circle, how far would you need to move Tracy before drawing the next circle?

The circle's diameter

What is true of Tracy's color command?

The color name must be in quotation marks

When using the circle( ) command, what value do we put inside the parentheses?

The radius of the circle.

The name 'color' cannot be used for our variable because:

The word 'color' is already used as a Tracy command

Why do certain words change color in Python?

To show that they are recognized as key words

What is the correct way to draw a circle that is filled in?

begin_fill() circle(20) end_fill()

How would I change Tracy's trail to a yellow line with a thickness of 10 pixels?

color("yellow") pensize(10)

Which code will have Tracy move forward 10, then turn left and move forward 20?

distance = 10 forward(distance) left(90) distance = distance * 2 forward(distance)

The setposition() command moves Tracy to a coordinate and:

does not turn her

If I am creating a function that is going to draw 2 squares, which of the following would be the best name option?

draw_squares

How would I tell Tracy to move forward 100 pixels?

forward(100)

Which commands would move Tracy forward 100 pixels?

forward(100) backward(-100)


Ensembles d'études connexes

Fraction to Decimal, Mixed Number

View Set

CS 465: Computer Security, Week 1

View Set

ch 19 the Child with a Gastrointestinal Alteration

View Set

Chapter 29: The Experience of Loss, Death and Grief

View Set

Lesson 5 "The Decline of Feudalism"

View Set

all lecture quiz and module quiz 2-8

View Set

Lesson 23: Chapter 23 Covalent Bonding and Intermolecular Interactions

View Set

Biology Test 2 (Ch. 5, 6, & 7) DSM Questions

View Set