FROM QUIZ 2 19. What is a magic number? a. an unexplained number that appears in the code~ b. a number that fixes an error c. a type in Python d. a number that is the output of an imported function that you didn't write 21. After main starts running, what is the number of the first line of code that executes? ANS. convert_to_celsius() 22. After main starts running, what is the number of the second line of code that executes? ANS. input_string**=**input('What is the Fahrenheit temperature?**') 23. After main starts running, what is the number of the third line of code that executes? ANS. fahrenheit = float(input_string) 33. What is the name of the function that causes the program to pause and wait for the user to type some input? ANS. input ANS. input() 34. What is the name of the function that converts that input from a string (i.e., a sequence of characters) to a floating-point number (i.e., a number that has a decimal point)? ANS. float ANS. float() 35. Given the following assignment statement

a=b

What side of the assignment is the variable that is assigned to? a. the left side~ b. the right side 32. Given the following function definition:

def one(two)

what is the name of the function? ANS. one 52. Anne typed the following equation into her python console .1 + .1 + .1. The output was 0.30000000000000004. What caused this? a. round-off error~ b. not assigning to a variable c. an incorrect specification d. none of the above D. Watch the video: Input-Compute-Output Programs. 20. Where does execution traditionally begin? ANS. **main** 24. On what line is the convert_to_celsius function called(i.e., invoked, made to run)? ANS. **main** 25. On what line is the convert_to_celsius function defined(i.e., where are the statements that execute when the function is called)? ANS. **after**main** 27. What is the purpose of doc-comments? a. To explain the purpose of functions or other large sections of code~ b. To protect the code under copyright laws c. To explain the purpose of a very small section of code (usually 1-3 lines) d. All of these 29. What is the purpose of in-line comments? a. To explain the purpose of functions or other large sections of code b. To protect the code under copyright laws c. To explain the purpose of a very small section of code (usually 1-3 lines)~ d. All of the above 45. What is the value of 2 * 4? ANS. 8 46. What is the value of 2 ** 4? ANS. 16 47. What is the value of 17/5? ANS. 3.4 48. What is the value of 17%5? ANS. 2 49. What is the value of 17//5? ANS. 3 50. The following statement does not make sense (as a standalone statement). Show a more sensible version of the statement.

2 * 4

ANS. **=**2*****4 51. What line of code must be executed before you can execute

y = math.sin(0.357)

? ANS. import math D. Watch the video: Preview of Session 2 Exercise. There are no quiz questions for this video. The "quiz" is that in the Session 2 class, you will be asked to do the things that are in this video. If you have seen the video first and heard our explanation, you will most likely find that exercise much easier to do. But there is a lot to do in preparation for Session 2, so watching this video is optional. 56. In your example file m2e_hello_and_goodbye.py how many times does the word Ciao appear in the program's code? ANS. one ANS. One ANS. 1 57. In your example file m2e_hello_and_goodbye.py how many times does the word Ciao appear when you run (execute) the program's code? ANS. Two ANS. two ANS. 2 FROM QUIZ 3: 3. True or false: A debugger lets you set a breakpoint and run the program to that point, pausing the execution at the breakpoint. a. True~ b. False 4. True or false: A debugger lets you step through a program, line by line. a. True~ b. False 5. True or false: A debugger lets you see the values of the variables in your program and how they change as you step through program. a. True~ b. False D. Examine the code snippet below:
6. At what lines have breakpoints been set? a. 21 b. 22 c. 30~ d. 36~ e. 37 7. At what line is the program currently paused? a. 21 b. 22 c. 30 d. 36 e. 37~ 8. At the point that the program is paused, which is true: a. The program just executed line 37 b. The program is just about to execute line 37~ D. The Step Into button runs the next statement in the program.
9. How is the Step Over button different (in what it does) from Step Into?
a. Step Over follows the computer to the definitions of any functions that are being called b. Step Over is the same as Step Into c. Step Over runs the next statement in the current function, skipping the details of any function calls in the statement~ d. Step Over goes back to the function that called the current function 10. How is the Step Return button different (in what it does) from Step Into?
a. Step Return follows the computer to the definitions of any functions that are being called b. Step Return is the same as Step Into c. Step Return runs the next statement in the current function, skipping the details of any function calls in the statement d. Step Return goes back to the function that called the current function~ 1. Using this code snippet:

imagine that the given range expressions are placed in the red box. Match the range expression with the values that i takes on throughout the execution of the loop. M. range(3)->0, 1, 2 M. range(1, 5)->1, 2, 3, 4 M. range(2, 12, 2)->2, 4, 6, 8, 10 M. range(12, 2, -2)->12, 10, 8, 6, 4 M. range(2, 5)->2, 3, 4 M. range(5, 2)->no values M. range(5, 2, -1)->5, 4, 3 M. ->5, 4, 3, 2 M. ->2, 4, 6, 8 M. ->1, 2, 3 4. Consider the following problem: A row of red and white tiles needs to be placed along a wall. Given a tile width T and wall width W, your task is to compute the number of whole tiles needed, the remaining space (as a fraction of tile), and whether the first and last whole tile will be the same color. As an example, with tiles 3 inches wide and a wall 22 inches wide we would need 7 whole tiles and .33 of a tile would be left uncovered. The first and last tile would be the same color. Do a by-hand calculation (using reasonable numbers that you choose) that solves this problem (for the particular numbers you choose). Then, write a formula for the general solution based on your by-hand calculation. From quiz 5 8. Choose the correct options to produce a function that returns the product 3 * 6 * 9 * ... * 3n. M. Line 1 -> def multiply_n(n): M. Line 2 ->  total = 1 M. Line 3 ->  for i in range(n+1): M. Line 4 ->   total = total * 3 * i M. Line 5 ->  return total M. ->   total = 3 * i M. ->   total = total + 3 M. ->  for i in range(n): M. -> def multiply_n():