πŸ“Š Python
Q. What keyword is used in Python to raise exceptions?
  • (A) raise
  • (B) try
  • (C) goto
  • (D) except
πŸ’¬ Discuss
βœ… Correct Answer: (A) raise
πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
s1 = {1, 2, 3, 4, 5}
s2 = {2, 4, 6}
print(s1 ^ s2)
  • (A) {1, 2, 3, 4, 5}
  • (B) {1, 3, 5, 6}
  • (C) {2, 4}
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (B) {1, 3, 5, 6}
πŸ“Š Python
Q. Which of the following is not a valid set operation in python?
  • (A) Union
  • (B) Intersection
  • (C) Difference
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) None of the above
πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
a = [1, 2, 3, 4]
b = [3, 4, 5, 6]
c = [x for x in a if x not in b]
print(c)
  • (A) [1, 2]
  • (B) [5, 6]
  • (C) [1, 2, 5, 6]
  • (D) [3, 4]
πŸ’¬ Discuss
βœ… Correct Answer: (A) [1, 2]
πŸ“Š Python
Q. Which of the following are valid escape sequences in Python?
  • (A) \n
  • (B) \t
  • (C) \\
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above
πŸ“Š Python
Q. Which of the following are valid string manipulation functions in Python?
  • (A) count()
  • (B) upper()
  • (C) strip()
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above
πŸ“Š Python
Q. Which of the following modules need to be imported to handle date time computations in Python?
  • (A) datetime
  • (B) date
  • (C) time
  • (D) timedate
πŸ’¬ Discuss
βœ… Correct Answer: (A) datetime
πŸ“Š Python
Q. In which language is Python written?
  • (A) C++
  • (B) C
  • (C) Java
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (B) C
πŸ“Š Python
Q. How can assertions be disabled in Python?
  • (A) Passing -O when running Python.
  • (B) Assertions are disabled by default.
  • (C) Both A and B are wrong.
  • (D) Assertions cannot be disabled in Python.
πŸ’¬ Discuss
βœ… Correct Answer: (A) Passing -O when running Python.
πŸ“Š Python
Q. What will be the output of the following code snippet?
Code:
a = [[], "abc", [0], 1, 0]
print(list(filter(bool, a)))
  • (A) ['abc', [0], 1]
  • (B) [1]
  • (C) [“abc”]
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) ['abc', [0], 1]