Logo

Python Questions Set 79:

Quiz Mode

 

What will be the value of the following Python expression?

4 + 3 % 5

1
2
3
4

Solution:

What is the output of the given code?


a=3.5


a='Abekus'


print(a)

1
2
3

Solution:

 To remove string “hello” from list1, we use which command? 

1
2

Solution:

 To add a new element to a list we use which command? 

1
2
3
4

Solution:

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

d = {"john":40, "peter":45}

d["john"]

1
2
3
4

Solution:

a = [-1, 1, 66.25, 333, 333, 1234.5]
>>> del a[0]


print(a)

1
2

Solution:

What is the output of the given code?


print("Abekus",end="@")

print("Continue")

1
2
3
4

Solution:

What is the output of the given code?


n=23


if n>40:

    print("I am larger")

elif n<20:

    print("I am smaller")

else:

    print("I am here")

1
2
3

Solution:

 

What will be the output of the following Python code?

for i in range(5):
   if i == 5:
       break
   else:
       print(i)
else:
   print("Here")

1
2
3
4

Solution:

Is the following Python code valid?

class B(object):
 def first(self):
   print("First method called")
 def second(self):
   print("Second method called")
ob = B()
B.first(ob)

1
2
3
4

Solution: