Python Quiz - Live

Hey Everyone,
We have prepared a quiz for you all. I hope you find it interesting and refreshes your memory a lil bit. Leave your answers down below and I’ll be sharing the answers with explanation later. Enjoy…!!

  1. What will be the datatype of the var in the below code snippet?

var = 10
print(type(var))
var = “Hello”
print(type(var))
a. str and int

b. int and int

c. str and str

d. int and str

  1. What will be the output of the following code snippet?

a = [1, 2, 3]
a = tuple(a)
a[0] = 2
print(a)

a. [2, 2, 3]

b. (2, 2, 3)

c. (1, 2, 3)

d. Error.

  1. What will be the output of the following code snippet?

a = [1, 2, 3, 4, 5]
sum = 0
for ele in a:
sum += ele
print(sum)

a. 15

b. 0

c. 20

d. None of these

  1. What will be the output of the following code snippet?

count = 0
while(True):
if count % 3 == 0:
print(count, end = " ")
if(count > 15):
break;
count += 1

a. 0 1 2 …… 15

b. Infinite Loop

c. 0 3 6 9 12 15

d. 0 3 6 9 12

  1. What will be the output of the following code snippet?

def func():
global value
value = “Local”

value = “Global”
func()
print(value)

a.Local

b. Global

c. None

d. Cannot be predicted

1 Like

1 - d
2 - d
3 -a (considering indentation).
4 - b
5 - d

1 Like

1 answer d
2 answer b

1 Like

1 question answer is d

1 Like

1 a is answe
2 a is answer
3 a is answe
4 a
5 b

1 Like

3 answer a
4 answer d
5 answer a

1 Like

the answers are
1.d
2.b
3.a
4.b
5.b

1 Like

1 . d
2 . d
3 . d
4 . d
5 . b

1 Like

1> d
2> d
3> a
4> b
5> d

1 Like
  1. d
  2. d
  3. a
  4. b
  5. a
1 Like

1 Ans. D
2 Ans. D
3 Ans. A
4 Ans. C
5 Ans. B

1 Like

1 - d, 2- C, 3 - b,4 - d, 5 - b

1 Like
  1. d
  2. d
  3. a
    4 .d
  4. b
1 Like

Ans-d
Ans-b
Ans-a
Ans-b
Ans-a

1 Like

Q1 answer isb
Q3- answer is d
Q4-answer is b

1 Like
  1. d
  2. d
  3. a
    4.b
    5.a
1 Like
  1. d
  2. b
  3. a
    4)d
    5)a
1 Like

above quiz answers:
d
d
a
a
b

  1. d
  2. d
  3. a
  4. b
  5. b

So to all who have answered.

The correct option for the question are : -

  1. d
  2. d
  3. a
  4. c
  5. a

Let me know if you have any doubts in any of these question.