Tracy the Turtle- Unit 1 Computer science

Ace your homework & exams now with Quizwiz!

Which comparison operator means 'is not equal to'?

!=

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

"""

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

#

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

0

What is the default starting value of i in a for loop?

0

What will the values of i be at each iteration of the loop below? 1. for i in range(3):

0, 1, 2

What is the best way to write a program that uses parameters to draw a square with sides that are 50 pixels long?

1. def make_square(length): 2. for i in range(4): 3. forward(length) 4. left(90) 5. make_square(50)

What would be the radius of the circle output from the following code? radius=20 if radius<10: circle(radius*2) elif radius % 2 ==): circle(radius/2) else: circle(radius)

10 pixels

If the following code was run, how far would Tracy move? length = 25 length = length * 2 if length !=50: forward(length) forward(100)

100 pixels

What will the values of i be at each iteration of the loop below? for i in range(2, 10, 2):

2, 4, 6, 8

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): circle(25) forward(50)

3 lines

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)

3, 4, and 5

What will be the output of the code below? penup() backward(150) for i in range(10, 50 ,10): forward(i * 2) pendown() circle(i) penup()

4 circles increasing in size

What are the dimensions of Tracy's world?

400 pixels x 400 pixels

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?

8 times

If Tracy is facing right, which of the following commands can be used to turn her to face up? A. left(90) B. turn(up) C. right(-90) D. setposition(90)

A and C

What two things must be included in your function definition?

A function name and commands to be performed

Which commands would move Tracy forward 100 pixels? A. forward(100) B. backward(-100) C. forward(-100)

A only

Which of the following does the clear command do? A. Clears the screen of any markings left by Tracy B. Turns Tracy to face right C. Sends Tracy to position (0,0)

A only

What will happen when this code is run? radius=20 while radius<50: circle(radius)

An infinite loop will occur.

How many parameters can we use in each function?

As many as we need

Where does Tracy always start in the grid world?

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

Top Down Design makes it easier to solve a problem by:

Breaking the problem down into smaller parts

How is an infinite loop created?

By using a condition that will never become false in a while loop

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

Each function only contains one command

Tracy always starts facing which direction?

East

Which of the following is an example of an if/else statement scenario?

If it is raining, bring an umbrella. If not, wear sunglasses.

Which of the following statements is true about control structures?

If/else statements can be used inside for loops.

Which of the following is NOT a reason for loops are useful when writing code?

Loops let us make shapes of multiple sizes

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 programs

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

The bottom of the circle

If you want three circles to be drawn next to each other (as seen in the image below), 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 are parameters useful?

They allow us to tailor functions to be used in multiple situations

Why do we use if statements?

To have Tracy make decisions based on conditional statements

Why do we use while loops?

To repeat code when the number of times to repeat is unknown

Why do certain words change color in Python?

To show that they are recognized as key words

If we write an if statement and the condition is false, what does Tracy do?

Tracy skips the commands under the if statement

What will happen when the value of i reaches 5 in the loop below? 1. for i in range(5): 2. left(i) 3. 4.right(90)

Tracy will turn 90 degrees to the right

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 of the following is NOT an example of using Top Down Design?

Using descriptive names for variables

Comments are:

Written for humans to read and understand

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 program 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)

What would be the output of the following command? circle(50,180,3)

half of a hexagon

How would we write an if statement where Tracy will put the pen down if a variable called count was positive?

if count > 0: pendown()

Which of the following if/else statements using a variable called 'count' are written correctly?

if count > 10: forward(100) else: forward(50)

Which of the names below follow all naming rules?

make_square

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

pentagon

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?: "))

Which is the proper way to call the function three_circles?

three_circles()

What is the limit of conditions that can be used in an if/else statement?

unlimited

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: ")


Related study sets

Chapter 2: Stars and the Moon (RQs)

View Set

STUPID ASS MARINE FOOKIN BIO MIDTERM

View Set

Ch.3A Exam - Life Insurance Policies: Provisions, Options and Riders

View Set

Quiz 12, Chapter 12, Python CS 119

View Set

Custom: NUR 204 ATI Health Promotion Ch. 16-31

View Set

module 3 comfort fibromyalgia and sleep disorder

View Set

Chapter 4 International Business

View Set

SSE 200 Foundations of Economics Chapter 5-6 (Test 3)

View Set