ExamVeda
Login
Home
31
What will be the output of the following Python code snippet?
['hello', 'morning'][bool('')]
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
32
What will be the output of the following Python code?
if (9 < 0) and (0 < -9):
    print("hello")
elif (9 > 0) or False:
    print("good")
else:
    print("bad")
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
33
What will be the output of the following Python expression?
4^12
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
34
Which of the following expressions can be used to multiply a given number 'a' by 4?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
35
What is the result of (10 >> 1) & 3 ?
Discuss
Answer & Solution
Answer: Option A
Solution:
The >> and & operators are evaluated from left to right.
36
What will be the output of the following Python code snippet?
bool(‘False’)
bool()
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
37
What is the result of 7 ^ 7 ?
Discuss
Answer & Solution
Answer: Option A
Solution:
The XOR operation with the same number results in 0.
38
What will be the output of the following Python code if a=10 and b =20?
a=10
b=20
a=a^b
b=a^b
a=a^b
print(a,b)
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
39
What is the result of 12 ^ (7 << 1) ?
Discuss
Answer & Solution
Answer: Option B
Solution:
Parentheses are used to indicate the order of operations.
40
What is the result of ~5 ?
Discuss
Answer & Solution
Answer: Option B
Solution:
The ~ operator performs bitwise NOT, inverting the bits of the number.