Logo

Python Questions Set 81:

Quiz Mode

What is the data type of (1)? 

1
2
3
4

Solution:

Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]? 

1
2
3
4

Solution:

Which of the following statements is used to create an empty set?

1
2
3
4

Solution:

 

How many elements are in m?

m = [[x, y] for x in range(0, 4) for y in range(0, 4)]

1
2

Solution:

  Which of the following expressions can be used to multiply a given number ‘a’ by 4? 

1
2
3
4

Solution:

 

Which Of The Following Represents A Template, Blueprint, Or Contract That Defines Objects Of The Same Type?

1
2
3

Solution:

 To remove string "Abekus” from list, we use which command ? 

1
2
3
4

Solution:

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

a={1:"A",2:"B",3:"C"}
a.setdefault(4,"D")
print(a)

1
2
3
4

Solution:

What is the output of the given code?

class A: 

    def __init__(self, id): 

        self.id = id

         id = 555 

a = A(111) 

print a.id

1
2
3
4

Solution:

 

What Will Be The Output Of The Following Code Snippet?

class Sales:
   def __init__(self, id):
       self.id = id
       id = 100

val = Sales(123)
print (val.id)

1
2
3
4

Solution: