πŸ“Š Python
Q. What will be the output of the following Python code?
Code:
class tester:
    def __init__(self, id):
        self.id = str(id)
        id="224"
 
>>>temp = tester(12)
>>>print(temp.id)
  • (A) 12
  • (B) 224
  • (C) None
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (A) 12
πŸ“Š Python
Q. What is the maximum length of a Python identifier?
  • (A) 32
  • (B) 16
  • (C) 128
  • (D) No fixed length is specified.
πŸ’¬ Discuss
βœ… Correct Answer: (D) No fixed length is specified.
πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
print(2**3 + (5 + 6)**(1 + 1))
  • (A) 129
  • (B) 8
  • (C) 121
  • (D) None
πŸ’¬ Discuss
βœ… Correct Answer: (A) 129
πŸ“Š Python
Q. What will be the datatype of the var in the below code snippet?
Code:
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
πŸ’¬ Discuss
βœ… Correct Answer: (D) int and str
πŸ“Š Python
Q. How is a code block indicated in Python?
  • (A) Brackets.
  • (B) Indentation.
  • (C) Key.
  • (D) None of the above.
πŸ’¬ Discuss
βœ… Correct Answer: (B) Indentation.
πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
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.
πŸ’¬ Discuss
βœ… Correct Answer: (D) Error.
πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
print(type(5 / 2))
print(type(5 // 2))
  • (A) float and int
  • (B) int and float
  • (C) float and float
  • (D) int and int
πŸ’¬ Discuss
βœ… Correct Answer: (A) float and int
πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
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
πŸ’¬ Discuss
βœ… Correct Answer: (A) 15
πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
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
πŸ’¬ Discuss
βœ… Correct Answer: (C) 0 3 6 9 12 15
πŸ“Š Python
Q. Which of the following concepts is not a part of Python?
  • (A) Pointers.
  • (B) Loops.
  • (C) Dynamic Typing.
  • (D) All of the above.
πŸ’¬ Discuss
βœ… Correct Answer: (A) Pointers.