Unit 6 CS Essentials
(Select all that apply) We use FOR loops instead of WHILE loops when: You do not know how many times you want the loop to run. When there is a definite starting and ending point. You know how many times you want the loop to run. When you need to ask the user for input.
When there is a definite starting and ending point. You know how many times you want the loop to run.
Consider the following code: canvas.draw_polygon([(200, 200), (300, 200),(300, 300),(200, 300)], 3, "Black", "Gray") canvas.draw_circle((250, 250), 50, 3, "Black", "White") Which is the correct drawing?
White circle, dark grey background
Consider the following command: canvas.draw_circle((A1, A2), B, C, D) Which represents the radius? D B A1 C A2
B
Check ALL of the correct answers. What would the following for loop print? for i in range(2, 4): print(i) 1 2 4 3
2,3
In the following circle command, the radius is _____________. canvas.draw_circle((140, 100), 50, 15, "Black") 140 15 100 50
50
Consider the following command: canvas.draw_circle((A1, A2), B, C, D) Which represents the line thickness? D B A1 C A2
C
Consider the following command: canvas.draw_circle((A1, A2), B, C, D) Which represents the line color? B D C A2 A1
D
The following statement draws a ______________ line. canvas.draw_line ((140, 140), (100, 100), 4, "Black") Vertical Line A box. Horizontal Diagonal Line
Diagonal Line
Which color is created by: RGB (255, 0, 0) Green Red Blue Yellow
Red
Colors in graphics are represented by a ____________ data type. String Float Random Integer
String
What is wrong with: canvas.draw_line( (300, 400), 5, "Yellow") There should be a second color You cannot assign color using "Yellow" There is not a second point The 5 should be a 1
There is not a second point
Which of the following is NOT true about for loops: They are used to replace counting while loops. They are used to replace user input while loops. They are less likely to result an infinite loop. They are loops with the count variable built in.
They are used to replace user input while loops.
What is returned by the code: range (20, 100, 30) ? [20, 30, 40, 50, 60, 70, 80, 90, 100] [20, 50, 80] [30, 50, 70, 90] [20, 50, 80, 110]
[20, 50, 80]
What is returned by the code: range (5, 100, 25) ? [100, 125, 150, 175, 200] [5, 30, 55, 80] [5, 30, 55, 80, 105, 130] [25, 50, 75]
[5, 30, 55, 80]
Which of the following is drawn by: for x in range(100, 140, 10): canvas.draw_polygon ([(x, x), (x + 20, x), (x + 20, x + 20), (x, x + 20)], 2, "Black", "White")
a stack of papers
Which of the following will output: a black circle with black filling canvas.draw_circle((150, 150), 50, 1, "Black", "Black") canvas.draw_circle((150, 150), 50, 0, "Black") canvas.draw_circle((150, 150), 50, 1, "Black") canvas.draw_circle((150, 150), 50, 1, "Black", "White")
canvas.draw_circle((150, 150), 50, 1, "Black", "Black")
Write two lines of code to draw the following circles centered at 600,600. The radius of the smallest circle is 200. There are 50 points between the larger circle and the smaller circle. Which of the following draw these circles? canvas.draw_circle((600, 600), 200, 3, "Black") canvas.draw_circle((650, 650), 250, 3, "Black") canvas.draw_circle((600, 600), 200, 3, "Black") canvas.draw_circle((600, 600), 250, 3, "Black") canvas.draw_circle((600, 600), 200, 3, "Black") canvas.draw_circle((650, 650), 200, 3, "Black") canvas.draw_circle((200, 250), 600, 3, "Black") canvas.draw_circle((200, 250), 650, 3, "Black")
canvas.draw_circle((600, 600), 200, 3, "Black") canvas.draw_circle((600, 600), 250, 3, "Black")
Which of the following will print a vertical line? canvas.draw_line((140, 140), (100, 100), 4, "Black") canvas.draw_line((140, 140), (100, 140), 4, "Black") canvas.draw_line((100, 140), (100, 40), 4, "Black") canvas.draw_line((100, 140), (100, 140), 4, "Black")
canvas.draw_line((100, 140), (100, 40), 4, "Black")
Which of the following correctly draws a point on the screen? canvas.draw_point(123, 125) canvas.draw_pixel((123, 125), "Red") canvas.draw_pixel(123, 125) canvas.draw_point((123, 125), "Red")
canvas.draw_point((123, 125), "Red")
Which of the following will output a box? canvas.draw_polygon([(50, 50),(150, 150)], 1, "Black") canvas.draw_polygon([(150, 50),(150, 150),(50, 150),(50, 50)], 1, "Black") canvas.draw_polygon([(150, 150),(50, 150),(50, 50)], 1, "Black") canvas.draw_polygon([(150, 50),(50, 150),(50, 50),(150, 150)], 1, "Black")
canvas.draw_polygon([(150, 50),(150, 150),(50, 150),(50, 50)], 1, "Black")
What of the commands below would be most helpful if you were trying to create a face shape for your emoticon? draw_line draw_box draw_circle draw_point
draw_circle
Which command correctly draws strings on the screen? draw_word draw_font draw_string draw_text
draw_text
Which command tells the for loop what to count by? range count variable elif step
range