Logo

Python Questions Set 44:

Quiz Mode

__ operator is used to perform the union of two sets.

1
2
3
4

Solution:

How is the name Django pronounced?

1
2
3
4

Solution:

Which of the following is not a data type in python.

1
2
3
4

Solution:

  In top-down design every module is broken into same number of submodules.
 

1
2

Solution:

Find the output of the following code:


from itertools import product


x=[1,2,3]

y=list(product(range(2),x))

print(len(y))

Solution:

Which Python function is used to read the first 4 characters of a file?

1
2
3
4

Solution:

Which file is an empty file that tells Python that the current directory should be considered as a Python package?

1
2
3
4

Solution:

Deduce the output of the following code:


def fun(l, n):

    i = n - 1

    while i >= 0:

        print(l[i])

        i -= 1

x = fun([1, 2, 3, 4], len([5, 6, 7, 8]))

1
2
3
4
5

Solution:

What will be the output of the following Python code?

class Demo:
def check(self):
return "Demo's check"
def display(self):
print(self.check())
class Demo_Derived(Demo):
def check(self):
return "Derived's check"
Demo().display()
Demo_Derived().display()

1
2
3
4

Solution:

 

Compare the following two Python codes shown below and state the output if the input entered in each case is -6?

CODE 1
import math
num=int(input("Enter a number of whose factorial you want to find"))
print(math.factorial(num))
 
CODE 2
num=int(input("Enter a number of whose factorial you want to find"))
print(math.factorial(num))

1
2
3
4

Solution: