IT 116: Introduction to Scripting
Quiz 2 Answers

  1. What is the result of the following calculation in Python's interactive mode?
    7 / 2
    3.5
  2. What is the result of the following calculation in Python's interactive mode?
    7 // 2
    3
  3. What is the result of the following calculation in Python's interactive mode?
    7 % 2
    1
  4. What is the result of the following calculation in Python's interactive mode?
    7 ** 2
    49
  5. What is the result of the following calculation in Python's interactive mode?
    (2 + 3) * 5
    25
  6. What arithmetic operators have the highest precedence?
    **
  7. What would you type at the end of a line if you wanted to continue a Python statement to the next line?
    \ (backslash)
  8. Write a Python expression that concatenates the string "Name = " with the variable student_name.
    "Name = " + student_name
  9. Write a Python expression that concatenates the string "Rate = " with the variable rate which is of type float.
    "Rate = " + str(rate)
  10. Write a single print statement, without using triple quotes, which prints
    Line 1
    Line 2
    Line 3
    print("Line 1\nLine 2\nLine 3")