1.
- See answer A above
- See answer B above
- See answer C above
- See answer D above
- See answer E above
Q1: Assuming that the following declaration has been made, which of the following code segments correctly interchanges the value of
arr[0]
and arr[5]
?arr = [5, 12, -22, 6, 11, 0, 26, 42, 99, 75];
# ----
# A
arr[0] = 5
arr[5] = 0
# ----
# B
arr[0] = arr[5]
arr[5] = arr[0]
# ----
# C
k = arr[5]
arr[0] = arr[5]
arr[5] = k
# ----
# D
k = arr[0]
arr[0] = arr[5]
arr[5] = k
# ----
# E
k = arr[5]
arr[5] = arr[0]
arr[0] = arr[5]