Lists MCQ Practice

Question 1 of 10

days=["Mon","Tue","Wed"]. DISPLAY (days[1])?

  1. A. Wed
  2. B. 1
  3. C. Mon
  4. D. Tue

Question 2 of 10

stack=[9,8,7]. APPEND(stack,6) then REMOVE(stack,2). Final?

  1. A. [9, 8, 6]
  2. B. [8, 7, 6]
  3. C. [9, 8, 7, 6]
  4. D. [9, 7, 6]

Question 3 of 10

grid=["a","b","c","d","e"]. INSERT(grid,3,"z") then REMOVE(grid,5). Remains?

  1. A. ["a", "b", "z", "c", "e"]
  2. B. ["a", "b", "z", "c", "d"]
  3. C. ["a", "b", "c", "z", "e"]
  4. D. ["a", "b", "z", "d", "e"]

Question 4 of 10

vals=[2,4,6]. REMOVE(vals,1) twice. LENGTH?

  1. A. 0
  2. B. 1
  3. C. 2
  4. D. 3

Question 5 of 10

L=[11,12,13,14]. INSERT(L,4,0) then INSERT(L,1,-1). Final?

  1. A. [11, 12, 13, 0, 14, -1]
  2. B. [-1, 0, 11, 12, 13, 14]
  3. C. [-1, 11, 12, 13, 0, 14]
  4. D. [-1, 11, 12, 0, 13, 14]

Question 6 of 10

names has LENGTH 5. Valid indexes?

  1. A. 1 through 6
  2. B. Only 0
  3. C. 0 through 4
  4. D. 1 through 5

Question 7 of 10

cart=["pear","fig","date"]. cart[3] โ† cart[1]. cart?

  1. A. ["pear", "fig", "pear"]
  2. B. ["date", "fig", "date"]
  3. C. ["pear", "pear", "date"]
  4. D. ["fig", "fig", "date"]

Question 8 of 10

seq=[1,1,1]. REMOVE(seq,2) then APPEND 2 then APPEND 3. Final list and length?

  1. A. [1, 1, 2] with length 3
  2. B. [1, 1, 2, 3] with length 4
  3. C. [1, 1, 1, 2, 3] with length 5
  4. D. [1, 2, 3] with length 3

Question 9 of 10

row=[7,8,9,10]. After INSERT(row,2,8), how many times does 8 appear?

  1. A. 4
  2. B. 1
  3. C. 2
  4. D. 3

Question 10 of 10

Which decreases LENGTH by exactly 1?

  1. A. Assigning list[i] โ† x
  2. B. APPEND
  3. C. INSERT
  4. D. REMOVE