CBSE Class 11 Informatics Practices
Question 23 of 40
Practice Paper — Question 5
Back to all questions['USA', 'China', 'Russia']
['Australia', 'USA', 'China']
In the given Python code, Country[2:5] returns ["USA", "China", "Russia"], slicing from index 2 up to index 4. Then, Country[-5:-2] retrieves a sublist starting from index -5 up to index -3. This results in ["Australia", "USA", "China"].
The indexing table is:
| Element | Positive Index | Negative Index |
|---|---|---|
| "India" | 0 | -6 |
| "Australia" | 1 | -5 |
| "USA" | 2 | -4 |
| "China" | 3 | -3 |
| "Russia" | 4 | -2 |
| "Ukraine" | 5 | -1 |