MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

ALGORITHMS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
This expression:x = 5y = 6x = x + 2y = x*2print(y)evaluates to 12
A
True
B
False
C
Either A or B
D
None of the above
Explanation: 

Detailed explanation-1: -What will be the output of the following Python expression if x=15 and y=12? Explanation: The symbol ‘&’ represents bitwise AND. This gives 1 if both the bits are equal to 1, else it gives 0. The binary form of 15 is 1111 and that of 12 is 1100.

Detailed explanation-2: -6. What will be the value of the following Python expression? Explanation: The output of bin(10-2) = 0b1000 and that of bin(12^4) is ob1000. Hence the output of the above expression is: 0b10000b1000.

Detailed explanation-3: -Expert-Verified Answer The code will definitely return a Boolean value(True or False). For the expression to be True, the two statements must be True. The AND gate returns True if the whole statement is True. (10 >= 5*2) is True because 10 is equals to 5 × 2 = 10.

There is 1 question to complete.