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 of the following piece of code?a={1:"A", 2:"B", 3:"C"}print(a.get(1, 4))
A
“A”
B
True
C
4
D
Error
Explanation: 

Detailed explanation-1: -What type of data is: a=[(1, 1), (2, 4), (3, 9)]? Explanation: The variable a has tuples enclosed in a list making it a list of tuples. 9.

Detailed explanation-2: -What will be the output of the following Python code? Explanation: The function s1|s2 as well as the function s1. union(s2) returns a union of the two sets s1 and s2. Hence the output of both of these functions is: 1, 2, 3, 4, 5, 6, 8.

Detailed explanation-3: -What will be the output of the following Python function? Explanation: The function max() is being used to find the maximum value from among-3, -4 and false. Since false amounts to the value zero, hence we are left with min(0, 2, 7) Hence the output is 0 (false).

Detailed explanation-4: -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.