MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is the output when following code is executed?names = [’Amir’, ‘Bear’, ‘Charlton’, ‘Daman’] print(names[-1][-1])
A
n
B
D
C
Daman
D
Error
Explanation: 

Detailed explanation-1: -Explanation: We use the function append to add an element to the list. 7.

Detailed explanation-2: -3. Which of the following Python statements will result in the output: 6? Explanation: The output that is required is 6, that is, row 2, item 3. This position is represented by the statement: A[1][2].

There is 1 question to complete.