Class 33 Artifacts
- Question 1 is false because the
if
is not a looping statement.
- Question 3 is false because it is the arguments named in an invocation.
- Question 7 is false because the return value of
f(x)
could be for example, "wahoo".
- Question 10 is false because there is no variable
a
anywhere in the function definition of f()
.
- The output for the code snippets in Questions 12-15 is 1 because a Python function cannot change the value of argument due to its pass by value copy style of initializing parameters.
- The output for Question 16 code snippet is 1112 because the
x
is updated by the return value of the function t()
invocation.
- The output for Question 17 code snippet is [1112, 1, 4] because the function invocation
u( x )
resets the the value of the first element of the list being manipulated.
- The output for Question 18 code snippet is [1, 100] because the function invocation
f( x )
appends 100 to the end of the list being manipulated.
- The output for Question 19 code snippet is [1] because the body of function
f()
resets the parameter to now point to a the list [100]. That resetting makes it independent of the list that was passed as an argument.
- Question 20 is false because the function exits the for loop with a return to end its first iteration. Thus, paying no attention to what the values of other list elements are.
- Question 21 is true because function
f()
returns a 2-element sequence that represents a reversing of the parameter values. That sequence is used to update a
and b
. Note, it is not the function that changed a
and b
it is that its return value was assigned to a
and b
.
- Question 22 code snippet outputs just 1. It does so because at the end of the first iteration
i
is now 2, and there is no 2 in the list [3, 1, 4, 1].
- As my official UVA email id is jpc, my personal implementation of function
id()
is
- A possible solution to function
ear()
is
- A possible solution to function
one()
is
- A possible solution to function
le()
is
- A possible solution to function
ike()
is
- A possible solution to function
ction()
is