CBSE Class 11 Computer Science Question 46 of 91

String Manipulation — Question 6

Back to all questions
6
Question

Question 6

Given a string S = "CARPE DIEM". If n is length/2 (length is the length of the given string), then what would following return?

(a) S[: n]
(b) S[n :]
(c) S[n : n]
(d) S[1 : n]
(e) S[n : length - 1]

Answer

(a) CARPE
(b) DIEM
(c) (Empty String)
(d) ARPE
(e) DIE

Answer