Python Operators

Question 1

What is the output of the following code : 

Python3

print 9//2
Cross

4.5

Cross

4.0

Tick

4

Cross

Error



Question 1-Explanation: 

The ‘//’ operator in Python returns the integer part of the floating number.

Question 2
Which function overloads the >> operator?
Cross
more()
Cross
gt()
Cross
ge()
Tick
None of the above


Question 2-Explanation: 
rshift() overloads the >> operator
Question 3
Which operator is overloaded by the or() function?
Cross
||
Tick
|
Cross
//
Cross
/


Question 3-Explanation: 
or() function overloads the bitwise OR operator
Question 4

What is the output of the following program : 

Python3

i = 0
while i < 3:
       print i
       i++
       print i+1

Cross

0 2 1 3 2 4

Cross

0 1 2 3 4 5

Tick

Error

Cross

1 0 2 4 3 5



Question 4-Explanation: 

There is no operator ++ in Python

There are 4 questions to complete.

  • Last Updated : 07 Mar, 2018

Share your thoughts in the comments
Similar Reads