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 executey = 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: