11.10. Exam Questions for Chapters 9 to 11
The following questions test what you have learned in chapters 9 to 11. Click the “Start” button when you are ready to begin the exam. Click the “Pause” button to pause the exam (you will not be able to see the questions when the exam is paused). It will show how much time you have used, but you have unlimited time. Click on the “Finish Exam” button at the end when you are done. The number correct, number wrong, and number skipped will be displayed at the bottom of the page. Feedback for each answer will also be shown as well as your answer.
You will not be able to change your answers after you hit the “Finish Exam” button.
Given the following code, what will be printed?
newString = "!"
phrase = "We're off to see the Wizard!"
for letter in phrase:
newString = letter + newString + letter
- !We're off to see the Wizard!
- This would be true if it was newString = newString + letter
- !draziW eht ees ot ffo er'eW!
- This would be true if it was newString = letter + newString
- We're off to see the Wizard!!draziW eht ees ot ffo er'eW
- This would be true if it was newString = letter + newString in the loop and you printed phrase + newString
- !draziW eht ees ot ffo er'eW!We're off to see the Wizard!
- This code adds each letter to the front and back of the string which will print the reverse of the string ! and the string.
If we would like to draw a decagon (10 sided figure), what should the values of X and Y be in the code below?
from turtle import * # use the turtle library
space = Screen() # create a turtle space
zoe = Turtle() # create a turtle named zoe
zoe.setheading(90) # point due north
for sides in range(X): # repeat the indented lines X times
zoe.forward(50) # move forward by 50 units
zoe.right(Y) # And turn each one by Y
- X = 5 and Y = 72
- This would be true if you were trying to draw a 5 sided figure.
- X = 36 and Y = 10
- This would be true if you were trying to draw a 36 sided figure.
- X = 10 and Y = 36
- The value of X is 10 to make a 10 sided figure and the amount to turn is 360 / 10 = 36.
- X = 12 and Y = 30
- This would be true if you were trying to draw a 12 sided figure.
You have attempted
activities on this page