Logo

Python Questions Set 38:

Quiz Mode

What does the following code evaluate to?

round(1.5) – round(-0.5)

1
2
3

Solution:

Which operator is used for the intersection of two sets in Python?

1
2
3
4

Solution:

 

Evaluate the expression given below if A = 16 and B = 15.

A % B // A

1
2
3
4

Solution:

What is the output of the given code?


a=11

b=4


print(b>>10)

print(a <<2)

1
2
3
4

Solution:

In Django, templates are by default written in which language?

1
2
3
4

Solution:

 

What will be the output of the following Python code?


 x = [12.1, 34.0]

 print(len(' '.join(list(map(str, x))))) 

1
2
3
4

Solution:

Find the output of the following code:


string = "hello world welcome to Abekus"

str = string.title()

print(str)

1
2
3
4
5

Solution:

 

What will be the output of the following Python code?

numberGames = {}

numberGames[(1,2,4)] = 8

numberGames[(4,2,1)] = 10

numberGames[(1,2)] = 12

sum = 0

for k in numberGames:

   sum += numberGames[k]

print len(numberGames) + sum

1
2
3
4

Solution:

Find the output of the following code.


l1=[1,2,6]

l2=[2,8,1]

l=[(x,y) for x in l1 for y in l2 if x!=y]

print(l)

1
2
3
4

Solution:

Find the output of the following:

a=['DARK','STRANGER','GOT','SACRED','MONEY']
a.remove('MONEY')
b=a
print(b)
c=a.pop()
d=a
if(c=='DARK'):
print(d)
else:
    a.remove('GOT')
    e=a
print(e)

1
2
3
4

Solution: