NIELIT O Level Exam

<p>What does the following slice return?</p><pre><span style="font-size: 14px;">s = [0,1,2,3,4,5]<br></span><span style="font-size: 14px;">print(s[1:5:2])</span></pre>

What does the following slice return?

s = [0,1,2,3,4,5]
print(s[1:5:2])


निम्न slice का result क्या होगा?

s = [0,1,2,3,4,5]
print(s[1:5:2])

A. [1, 3]

B. [2, 4]

C. [1, 2, 3, 4]

D. [0, 2, 4]




Correct Answer is :

A. [1, 3]



Explanation

It starts at index 1, stops before index 5 and moves with step 2.



Slice index 1 से शुरू होती है, index 5 से पहले रुकती है और step 2 लेती है; इसलिए [1,3] मिलता है।

Latest Current Affairs 2026 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad