click below
click below
Normal Size Small Size show me how
Quiz 2
COP1000C into comp prog blended 621782
Question | Answer | |
---|---|---|
In Python, getting information from the user is done with a special expression called | input | |
In the software development process, which is the task you should do first? | analyze the problem | |
Which of the following is not a correct Python statement? | x, y = 3 | |
What is the output from the following program? for x in range(1,4): print(x**2) | 1 4 9 | |
What is the output generated from the following loop? for i in range(4): print("hi") | hi hi hi hi | |
Most simple computer programs follow the basic pattern defined by the acronym IPO. What does IPO mean with regards to programming? | Input, process, output. | |
The fragment for i in range(10): is an example of | a counted loop | |
If you want to convert from gallons to liters, which of the following expressions is correct given that one liter is 1.05669 quarts and there are four quarts in a gallon? | Question 8 options: liters = gallons * 4.0 / 1.05669 | |
Which of the following is not a valid Python statement? Question 9 options: 3 + 4 = x x = 3 + 4 print(1x1) x = eval(input(1enter x: 1)) | a | |
Which of the following is not a legal identifier? 2spam | Question 10 options: spam spam4U spAm 2spam | |
Which of the following should you use when you want to output the value of the variable x to the screen? | Question 2 options: x print x x = eval(input(1enter x: 1)) print(x) | print(x) |
Which of the following is used in Python to execute statements multiple times? | Question 3 options: for print input def | for |
What does an assignment statement do? | Question 4 options: It asks the user to enter a value for the assignment's expression. It outputs the result of the statement's expression to the screen. It represents an algebraic equation that the computer solves. | It causes the computer to store the result of the statement's expression in memory so you can use the result in a later Python statement. |
Which of the following is a legal identifier? | Question 5 options: three_points fieldGoal% 3_points three points | Question 5 options: three_points |
What is the output generated from the following loop? for i in range(4): print("hi") | Question 6 options: 1 2 3 4 hihihihi hi hi hi hi hi hi hi hi | hi hi hi hi |
When you want to have the user of your program enter a number, which of the following should you use? | Question 1 options: input() eval(input()) answer print() input(eval()) |