Mid2 2 PDF
Mid2 2 PDF
71.43% My Score
65.85%Average Score
(15/21) (13.82/21)
QUESTION POINTS
CORRECT INCORRECT PARTIAL CREDIT You (Peers)
Which of the statements below is true about the following code (Choose ALL that apply):
1 Original Order: 17 0/1
(0.39/1)
X A: The function named fu accepts two arguments
> B: The function named fu accepts three arguments
X C: We know that the function named fu returns a value
> D: We don't know wheater the function named fu returns a value or not
X E: Line 3 is defining the function named fu
Global variables can help programmers to understand a program easier
2 Original Order: 14 1/1
(0.79/1)
X True
> False
Which function executes the statements it contains, and then it returns a value back to the statement that called it
3 1/1
Original Order: 19 (0.49/1)
> A: A non-void function
X B: A void function
X C: A function with no arguments
X D: A function with arguments
X E: None of the above
To create a function in Python, we have to include the keyword __1__ and function __2__, followed by __3__ and
4 __4__ 1/1
Original Order: 7 (0.89/1)
Answer 1: def
Answer 2: name
Answer 3: parentheses
Answer 4: colon
A local variable defined inside a function, can also be accessed by other functions
5 Original Order: 5 1/1
(0.86/1)
X True
> False
Different functions may have local variables with the same name.
6 Original Order: 3 1/1
(0.92/1)
> True
X False
What would be the output of the following code. Consider the commas in the answers as a new line.
7 Original Order: 4 1/1
(0.61/1)
> A: 5, 3, 6
X B: 3, 5, 6
X C: 5, 3, 4
X D: None of the above
Select the correct statement for the following code.
8 Original Order: 6 1/1
(0.84/1)
> A: The program will run for ever (infinite loop)
> B: The program will terminate in finite time
X C: The program will not print anything
X D: There is a syntax error
X E: None of the above
What would be the output of the following code. Consider the comma in the answers as a new line.
9 Original Order: 15 1/1
(0.83/1)
> A: 6, 1
X B: 1, 6
X C: 3, 1
X D: Syntax error
X E: None of the above
The range function is used in While loops
10 Original Order: 13 1/1
(0.80/1)
X True
> False
What would be the output of the following code. Consider the commas in the answers as a new line.
11 Original Order: 16 0/1
(0.49/1)
X A: 5, 7, 9
X B: 2.5, 3.5, 4.5
X C: 1, 1, 1
X D: Syntax error
> E: None of the above
What would be the output of the following code given that the user inputs 1 three times (1, 1, 1). Consider the
12 commas in the answers as a new line. 1/1
Original Order: 18 (0.55/1)
> A: hi, hi, hi
X B: hi, hi, hi, bye
X C: hi, bye
X D: Syntax error
X E: None of the above
What would be the output of the following code. Consider the commas in the answers as a new line.
13 Original Order: 8 1/1
(0.54/1)
X A: 0, 1
X B: 0, 1, 2
X C: 1, 1
> D: Infinite loop
X E: None of the above
What would be the output of the following code. Consider the commas in the answers as a new line.
14 Original Order: 1 1/1
(0.63/1)
X A: 10
X B: 10, 11
X C: 11
X D: Syntax error
> E: None of the above
What would be the output of the following code.
15 Original Order: 2 0/1
(0.66/1)
> A: 1 0 1 1 2 0 2 1
X B: 0 1 1 0 2 1 2 2
X C: 0 0 0 1 2 0 2 1
X D: Syntax error
X E: None of the above
What would be the output of the following code. Consider the commas in the answers as a new line.
16 Original Order: 12 0/1
(0.25/1)
X A: 1
X B: 3
> C: Syntax error
X D: 2
X E: None of the above
What would be the output of the following code. Consider the commas in the answers as a new line.
17 Original Order: 11 1/1
(0.78/1)
> A: a
X B: 3
X C: 2
X D: Syntax error
X E: None of the above
What would be the output of the following code. Consider the commas in the answers as a new line.
18 Original Order: 21 1/1
(0.69/1)
> A: 2
X B: 3
X C: 2, 3
X D: 3, 2
X E: None of the above
What would be the output of the following code. Consider the commas in the answers as a new line.
19 Original Order: 9 0/1
(0.55/1)
> A: 4, 16, 36
X B: 4, 8, 16, 32
X C: 4, 8
X D: 2, 4, 8
X E: None of the above
What would be the output of the following code, assuming the user enters 2. Consider the commas in the answers
20 as a new line. 0/1
Original Order: 10 (0.52/1)
> A: 2, 1, 4
X B: 2, 1, 3
X C: 0, 1, 2
X D: 0, 1, 2, 3
X E: Syntax error
X F: None of the above
What would be the output of the following code. Consider the commas in the answers as a new line.
21 Original Order: 20 1/1
(0.74/1)
> A: 12, 13
X B: 12, 13 14
X C: 12, 13, 14, 15
X D: 12, 12
X E: None of the above