HOME
MCQ
THEORY QUESTION
PRACTICAL QUESTION
CONTACT US
Programming and Problem Solving Through Python Language Theory Question
Operators, Expressions and Python Statements- Set 3
What will be the output of the following expression ?
x = 4 print(x<<2)
4
16
6
2
Show Answer
Answer : B
Explain : In this use left shit (convert 4 into binary 0100 which become 010000- convert it into value - 16.)
What will be the output of the following expression ?
print (7//2)
print (-7//2)
3 -3
3 -4
4 -4
3 3
Show Answer
Answer : B
Explain :
What will be the output of the following pseudocode, where ʌ represent XOR operation ?
Integer a, b, c
Set b = 4, a = 3
c = a ^ b
Print c
4
3
5
7
Show Answer
Answer : D
Explain : Solve this using XOR operator.
What will be the output of the following ?
Integer a, b
Set a = 9, b = 5
a = a mod (a - 3)
b = b mod (b – 3)
Print a + b
4
8
9
6
Show Answer
Answer : A
Explain : a=9 % 6 = 3 and b=5%2 = 1. print(a+b)=print(3+1)=4.
What is the output of the following code ?
print(bool(0), bool(3.14159), bool(23), bool(1.0+1j))
True True False True
False True False True
False False False True
False True True True
Show Answer
Answer : D
Explain : bool(0) value is False, and every - True.
Which of the following operators has the highest precedence ?
&
*
not
+
Show Answer
Answer : B
Explain : The highest precedence in these - * (multiplication).
Let us assume 4 is 100 in binary and 11 is 1011. What is the output of the following bitwise operators ?
a = 4
b = 11
print(a | b)
print(a >> 2)
15 or 1
14 or 1
16 or 2
17 or 2
Show Answer
Answer : A
Explain : Use Or and right shit operator.
What will be the output of the following pseudo code, where ʌ represent XOR operation ?
Integer a, b, c
Set b = 5, a = 1
c = a ^ b
Print c
4
3
5
7
Show Answer
Answer : A
Explain : Use XOR operation, first convert into binary and then perform xor operation.
What is the output of the following code ?
a = 15
b = 6
print(a and b)
print(a or b)
True True
False False
6 15
15 6
Show Answer
Answer : C
Explain : Use and and or operator (Do it yourself).
What is the output of print((-3)** 2) ?
-6
-9
6
9
Show Answer
Answer : D
Explain : ** is used for exponent. So -3**2=9.
What will be the output of the following Python code ? min(max(False,-3,-4), 2,7)
-4
-3
2
False
Show Answer
Answer : D
Explain : Value of False will be treated as 0.
What is the output of the following code ?
a = 50
b = a= a*5
print(b)
250
10
50
Syntax error
Show Answer
Answer : A
Explain : b=25=50*5=250
Next Set
1
2
Quick Jumps Links :
Select Chapter
Introduction to Programming
Algorithm and Flowcharts to solve problems
Introduction to Python
Operators, Expressions and Python Statements
Conditional and Iterative statements
Strings In Python
Tuple In Python
List In Python
Dictionary In Python
Functions
File Processing
Modules
NumPy Basics
Theory Question :
Information Technology Tools and Network Basics
Web Designing and Publishing
Problem Solving Through Python Language
Internet of Things and its Applications
Practical Question :
Information Technology Tools and Network Basics
Web Designing and Publishing
Problem Solving Through Python Language
Internet of Things and its Applications
MCQ Links
Information Technology Tools and Network Basics
Web Designing and Publishing
Problem Solving Through Python Language
Internet of Things and its Applications