1

Operators

Question 1
What is the output of the following code :
print 9//2
A
4.5
B
4.0
C
4
D
Error
Operators    
Discuss it


Question 1 Explanation: 
The ‘//’ operator in Python returns the integer part of the floating number.
Question 2
Which function overloads the >> operator?
A
more()
B
gt()
C
ge()
D
None of the above
Operators    
Discuss it


Question 2 Explanation: 
rshift() overloads the >> operator
Question 3
Which operator is overloaded by the or() function?
A
||
B
|
C
//
D
/
Operators    
Discuss it


Question 3 Explanation: 
or() function overloads the bitwise OR operator
Question 4
What is the output of the following program :
i = 0
while i < 3:
       print i
       i++
       print i+1

A
0 2 1 3 2 4
B
0 1 2 3 4 5
C
Error
D
1 0 2 4 3 5
Operators    
Discuss it


Question 4 Explanation: 
There is no operator ++ in Python
There are 4 questions to complete.
1

GATE CS Corner


See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.