← Back to the Introduction to Computer Science outline The Course Maker
← Introduction to Computer Science outline
Week 2 · Quiz

Week 2 Quiz

Introduction to Computer Science Free sample edition
The student view of the 10-question quiz: each question and its options as they appear in Canvas. The answer key and the feedback ship only inside the course's .imscc (Classic QTI); they are not shown on this public page.
  1. The reading log reads 30 pages a day. What does the last line of this program print?

    goal = 300
    pages_read = 45
    pages_left = goal - pages_read
    print(pages_left // 30)

    Select one.

    • 8.5
    • 9
    • 8
    • 15
  2. Same reading log, different operator. What does the last line of this program print?

    goal = 300
    pages_read = 45
    pages_left = goal - pages_read
    print(pages_left % 30)

    Select one.

    • 15
    • 8
    • 0.5
    • 8.5
  3. Trace each name line by line. What does this program print?

    x = 5
    y = x
    x = 10
    print(y)

    Select one.

    • 10
    • 5
    • 15
    • x
  4. Using operator precedence, what does this line print?

    print(2 * 3 ** 2)

    Select one.

    • 36
    • 12
    • 64
    • 18
  5. What happens when this one-line program runs?

    print("5" + 3)

    Select one.

    • It prints 8
    • Nothing prints, and the last line names TypeError
    • It prints 53
    • Nothing prints, and the last line names SyntaxError
  6. What does this line print?

    print(int(3.9))

    Select one.

    • 4
    • 3.9
    • 3
    • 4.0
  7. What does this line print?

    print(round(2.5), round(3.5))

    Select one.

    • 2 4
    • 3 4
    • 2 3
    • 3 3
  8. Which of these values have the type float? Select every value that does.

    Select every option that applies.

    • 8.5
    • 255
    • "8.5" (with the quotation marks)
    • 5.0
    • True
  9. A chatbot tells you that print(round(2.5)) displays 3, because halves always round up. What is the best next step?

    Select one.

    • Accept the claim, since it matches the rounding rule from school
    • Ask the chatbot again until it gives the same reply twice
    • Switch to a different chatbot with a more confident reply
    • Run the line in a Python runner and compare its output with the claim
  10. This program stops, and the last line of its error message names NameError, because Python is case-sensitive and the name Pages was never assigned.

    pages = 255
    print(Pages)

    True or false.

    • True
    • False

Built with The Course Maker · samples.thecoursemaker.com