πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
def solve(a, b):
   return b if a == 0 else solve(b % a, a)
print(solve(20, 50))
  • (A) 10
  • (B) 20
  • (C) 50
  • (D) 1
πŸ’¬ Discuss
βœ… Correct Answer: (A) 10
πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
def solve(a):
   a = [1, 3, 5]
a = [2, 4, 6]
print(a)
solve(a)
print(a)
  • (A) [2, 4, 6]. [2, 4, 6]
  • (B) [2, 4, 6], [1, 3, 5]
  • (C) [1. 3. 5], [1, 3, 5]
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (A) [2, 4, 6]. [2, 4, 6]
πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
def func():
   global value
   value = "Local"
   
value = "Global"
func()
print(value)
  • (A) Local
  • (B) Global
  • (C) None
  • (D) Cannot be predicted
πŸ’¬ Discuss
βœ… Correct Answer: (A) Local
πŸ“Š Python
Q. Which of the following statements are used in Exception Handling in Python?
  • (A) try
  • (B) except
  • (C) finally
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above
πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
a = 3
b = 1 
print(a, b)
a, b = b, a 
print(a, b)
  • (A) 3 1 1 3
  • (B) 3 1 3 1
  • (C) 1 3 1 3
  • (D) 1 3 3 1
πŸ’¬ Discuss
βœ… Correct Answer: (A) 3 1 1 3
πŸ“Š Python
Q. Which of the following types of loops are not supported in Python?
  • (A) for
  • (B) while
  • (C) do-while
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (C) do-while
πŸ“Š Python
Q. Which of the following is the proper syntax to check if a particular element is present in a list?
  • (A) if ele in list
  • (B) if not ele not in list
  • (C) Both A and B
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (C) Both A and B
πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
def thrive(n):
 if n % 15 == 0:
   print("thrive", end = “ ”)
 elif n % 3 != 0 and n % 5 != 0:
   print("neither", end = “ ”)
 elif n % 3 == 0:
   print("three", end = “ ”)
 elif n % 5 == 0:
   print("five", end = “ ”)
thrive(35)
thrive(56)
thrive(15)
thrive(39)
  • (A) five neither thrive three
  • (B) five neither three thrive
  • (C) three three three three
  • (D) five neither five neither
πŸ’¬ Discuss
βœ… Correct Answer: (A) five neither thrive three
πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
def check(a):
   print("Even" if a % 2 == 0 else "Odd")
   
check(12)
  • (A) Even
  • (B) Odd
  • (C) Error
  • (D) None
πŸ’¬ Discuss
βœ… Correct Answer: (A) Even
πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
example = ["Sunday", "Monday", "Tuesday", "Wednesday"];
print(example[-3:-1])
  • (A) ['Monday', 'Tuesday']
  • (B) ['Sunday', 'Monday']
  • (C) ['Tuesday', 'Wednesday']
  • (D) ['Wednesday', 'Monday']
πŸ’¬ Discuss
βœ… Correct Answer: (A) ['Monday', 'Tuesday']