CBSE Class 11 Computer Science Question 72 of 91

String Manipulation — Question 17

Back to all questions
17
Question

Question 8c

Find the errors. Find the line numbers causing errors.

  1. S = "PURA VIDA"
  2. S1 = S * 2
  3. S2 = S1[-19] + S1[-20]
  4. S3 = S1[-19 :]

Answer

The error is in line 3. S1[-19] and S1[-20] are trying to access out of bound indexes.

Answer