πŸ“Š Python
Q. What will be the output of the following Python expression?
Code:
round(4.576)
  • (A) 4
  • (B) 4.5
  • (C) 5
  • (D) 4.6
πŸ’¬ Discuss
βœ… Correct Answer: (C) 5
πŸ“Š Python
Q. Which of the following is a feature of Python DocString?
  • (A) In Python all functions should have a docstring
  • (B) Docstrings can be accessed by the __doc__ attribute on objects
  • (C) It provides a convenient way of associating documentation with Python modules, functions, classes, and methods
  • (D) All of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the mentioned
πŸ“Š Python
Q. What will be the output of the following Python code?
Code:
print("Hello {0[0]} and {0[1]}".format(('foo', 'bin')))
  • (A) Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
  • (B) Error
  • (C) Hello foo and bin
  • (D) None
πŸ’¬ Discuss
βœ… Correct Answer: (C) Hello foo and bin
πŸ“Š Python
Q. What is output of print(math.pow(3, 2))?
  • (A) 9.0
  • (B) None
  • (C) 9
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (A) 9.0
πŸ“Š Python
Q. Which of the following is the use of id() function in python?
  • (A) Every object in Python doesn’t have a unique id
  • (B) In Python Id function returns the identity of the object
  • (C) None of the mentioned
  • (D) All of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (B) In Python Id function returns the identity of the object
πŸ“Š Python
Q. The process of pickling in Python includes ____________
  • (A) conversion of a datatable into a list
  • (B) conversion of a Python object hierarchy into byte stream
  • (C) conversion of a list into a datatable
  • (D) conversion of a byte stream into Python object hierarchy
πŸ’¬ Discuss
βœ… Correct Answer: (B) conversion of a Python object hierarchy into byte stream
πŸ“Š Python
Q. What will be the output of the following Python code?
Code:
def foo():
    try:
        return 1
    finally:
        return 2
k = foo()
print(k)
  • (A) 1
  • (B) 2
  • (C) 3
  • (D) error, there is more than one return statement in a single try-finally block
πŸ’¬ Discuss
βœ… Correct Answer: (B) 2
πŸ“Š Python
Q. What is the maximum possible length of an identifier?
  • (A) 31 characters
  • (B) 63 characters
  • (C) 79 characters
  • (D) none
πŸ’¬ Discuss
βœ… Correct Answer: (D) none
πŸ“Š Python
Q. Which of the following is invalid?
  • (A) __str__ = 1
  • (B) _a = 1
  • (C) __a = 1
  • (D) None
πŸ’¬ Discuss
βœ… Correct Answer: (D) None
πŸ“Š Python
Q. Which of the following is an invalid variable?
  • (A) foo
  • (B) 1st_string
  • (C) my_string_1
  • (D) _
πŸ’¬ Discuss
βœ… Correct Answer: (B) 1st_string