Question 142

What is the output of print([1, 2, 3, 4, 5][1:4])?

  1. A[1, 2, 3, 4]
  2. B[1, 2, 3]
  3. C[2, 3, 4, 5]
  4. D[2, 3, 4]
Show answerHide answer

Correct answer: (D) [2, 3, 4]

Explanation

Slicing includes the start index and excludes the end index.

From DSSSB TGT Computer Science Full Mock Test 2

This is question 142 of DSSSB TGT Computer Science Full Mock Test 2. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.