Logo

Python Questions Set 21:

Quiz Mode

Is python case sensitive

1
2

Solution:

Which of these is not a core data type in Python?

1
2
3
4

Solution:

Which of the following is not a declaration of the dictionary? 

1
2
3
4

Solution:

 

What will be the output of the following Python code?

data = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]

print(data[1][0][0])

1
2

Solution:

What will be the output of the following Python code?


x = 'abcd'

for i in x:

    print(i)

    x = x.upper()


1
2
3
4

Solution:

 

What will be the output of the following Python code?


 d = {0: 'a', 1: 'b', 2: 'c'}

 for i in d:   

  print(i) 

1
2
3
4

Solution:

Is the following Python code valid?

>>> a=frozenset([5,6,7])
>>> a
>>> a.add(5)

1
2
3
4

Solution:

 

What Is The Output Of The Following Code Snippet?

def func():
   text = 'Welcome'
   name = (lambda x:text + ' ' + x)
   return name

msg = func()
print(msg('All'))

1
2
3

Solution:

 

What will be the output of the following Python code snippet?

my_string = "hello world"
k = [(i.upper(), len(i)) for i in my_string]
print(k)

1
2

Solution:

What is the output of the following Python code?

from abc import ABC, abstractmethod
class Sport(ABC):
@abstractmethod
def total(self):
pass
class Cricket(Sport):
def __init__(self, score1, score2):
self.score1 = score1
self.score2 = score2
def total(self):
return self.score1 + self.score2
series = Cricket(50, 60)
print(series.total())

1
2
3
4

Solution: