Logo

Python Questions Set 24:

Quiz Mode

How is a blank list defined

1
2
3

Solution:

x=0

What is the output of x == None?

1
2

Solution:

What is the data type of the value (1)?

1
2

Solution:

Which of the following is the correct extension of python file?

1
2
3
4

Solution:

Guess the output:


if("test" == "test"):

   print("Yes")

else:

    print("No")

1
2
3

Solution:

 

What will be the output of the following Python code?

a=165
b=sum(list(map(int,str(a))))
print(b)

1
2

Solution:

What is the output of the given code?


s="Abekus"

def fun():

    print(s)

    


fun()

1
2
3

Solution:

What is the output of the code shown below?

l = [-2, 4]
m = list(map(lambda x: x*2, l))
print(m)

1
2
3
4

Solution:

What is the output of the following code?

i = 0
while i < 3:
print(i)
i += 1
else:
print(0)

1
2
3
4

Solution:

What is the output of the snippet?

i = 1

while True:

  if i%3 == 0:

    break

  print(i)

 

  i + = 1

1
2
3
4

Solution:

 

What will be the output of the following Python code?


re.sub('Y', 'X', 'AAAAAA', count=2)

1
2
3
4

Solution:

What append do in lists ?

1
2
3
4

Solution:

 

What will be the output of the following Python code?


  x = 'abcd' for i in x:     print(i)     x.upper() 

1
2
3
4

Solution:

What is the time complexity of the following code?

for i in range(0, 5):

for j in range(0, 10):

print("times")

1
2
3
4

Solution:

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

a = [1, 4, 3, 5, 2]
b = [3, 1, 5, 2, 4]
a == b
set(a) == set(b)

1
2
3
4

Solution:

 

What is the output of the following code?

numbers = [1, 3, 6]
newNumbers = tuple(map(lambda x: x , numbers))
print(newNumbers)

1
2
3
4

Solution:

What is the output of the following code?


text="""

Abekus

helps in improving

my knowledge."""


print(text[1:7])

print("Abekus")

1
2
3
4

Solution:

The following python program can work with __________ parameters.

def f(x):

def f1(*args, **kwargs):

print("Sanfoundry")

return x(*args, **kwargs)

return f1

1
2
3
4

Solution:

Which type of copy is shown in the following python code?

l1=[[10, 20], [30, 40], [50, 60]]
ls=list(l1)
ls
[[10, 20], [30, 40], [50, 60]]

1
2
3
4

Solution:

 Which of the following best describes polymorphism? 

1
2
3
4

Solution: