πŸ“Š Python
Q. Which of the following is not a core data type in Python programming?
  • (A) Tuples
  • (B) Lists
  • (C) Class
  • (D) Dictionary
πŸ’¬ Discuss
βœ… Correct Answer: (C) Class
πŸ“Š Python
Q. What will be the output of the following Python expression if x=56.236?
Code:
print("%.2f"%x)
  • (A) 56.236
  • (B) 56.23
  • (C) 56.0000
  • (D) 56.24
πŸ’¬ Discuss
βœ… Correct Answer: (D) 56.24
πŸ“Š Python
Q. Which of these is the definition for packages in Python?
  • (A) A set of main modules
  • (B) A folder of python modules
  • (C) A number of files containing Python definitions and statements
  • (D) A set of programs making use of Python modules
πŸ’¬ Discuss
βœ… Correct Answer: (B) A folder of python modules
πŸ“Š Python
Q. What will be the output of the following Python function?
Code:
len(["hello",2, 4, 6])
  • (A) Error
  • (B) 6
  • (C) 4
  • (D) 3
πŸ’¬ Discuss
βœ… Correct Answer: (C) 4
πŸ“Š Python
Q. What will be the output of the following Python code?
Code:
x = 'abcd'
for i in x:
    print(i.upper())
  • (A) a B C D
  • (B) a b c d
  • (C) error
  • (D) A B C D
πŸ’¬ Discuss
βœ… Correct Answer: (D) A B C D
πŸ“Š Python
Q. What is the order of namespaces in which Python looks for an identifier?
  • (A) Python first searches the built-in namespace, then the global namespace and finally the local namespace
  • (B) Python first searches the built-in namespace, then the local namespace and finally the global namespace
  • (C) Python first searches the local namespace, then the global namespace and finally the built-in namespace
  • (D) Python first searches the global namespace, then the local namespace and finally the built-in namespace
πŸ’¬ Discuss
βœ… Correct Answer: (C) Python first searches the local namespace, then the global namespace and finally the built-in namespace
πŸ“Š Python
Q. What will be the output of the following Python code snippet?
Code:
for i in [1, 2, 3, 4][::-1]:
    print (i)
  • (A) 4 3 2 1
  • (B) error
  • (C) 1 2 3 4
  • (D) none
πŸ’¬ Discuss
βœ… Correct Answer: (A) 4 3 2 1
πŸ“Š Python
Q. What will be the output of the following Python statement?
Code:
>>>"a"+"bc"
  • (A) bc
  • (B) abc
  • (C) a
  • (D) bca
πŸ’¬ Discuss
βœ… Correct Answer: (B) abc
πŸ“Š Python
Q. Which function is called when the following Python program is executed?
Code:
f = foo()
format(f)
  • (A) str()
  • (B) format()
  • (C) __str__()
  • (D) __format__()
πŸ’¬ Discuss
βœ… Correct Answer: (C) __str__()
πŸ“Š Python
Q. Which one of the following is not a keyword in Python language?
  • (A) pass
  • (B) eval
  • (C) assert
  • (D) nonlocal
πŸ’¬ Discuss
βœ… Correct Answer: (B) eval