Nucleus Previous Years Solved Sample Placement Papers
-
What will be the output of the following Python function?
min(max(False,-3,-4), 2,7)
A. -4
B. -3
C. 2
D. False Answer: Option D
-
Solution: The function
max()
is being used to find the maximum value from among -3, -4 and false. Since false amounts to the value zero, hence we are left withmin(0, 2, 7)
. Hence the output is 0 (false). -
Which of the following is not a core data type in Python programming?
A. Tuples
B. Lists
C. Class Answer: Option C
D. Dictionary
- Solution: Class is a user-defined data type.
-
What will be the output of the following Python expression if x=56.236?
print("%.2f"%x)
A. 56.236
B. 56.23
C. 56.0000
D. 56.24 Answer: Option D
-
Solution: The expression shown above rounds off the given number to the number of decimal places specified. Since the expression given specifies rounding off to two decimal places, the output of this expression will be 56.24. Had the value been
x=56.234
(last digit being any number less than 5), the output would have been 56.23. -
Which of these is the definition for packages in Python?
A. A set of main modules
B. A folder of python modules Answer: Option B
C. A number of files containing Python definitions and statements
D. A set of programs making use of Python modules
- Solution: A folder of python programs is called as a package of modules.
-
What will be the output of the following Python function?
len(["hello",2, 4, 6])
A. Error
B. 6
C. 4 Answer: Option C
D. 3
-
Solution: The function
len()
returns the length of the number of elements in the iterable. Therefore the output of the function shown above is 4. -
What will be the output of the following Python 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
Answer: Option D
-
Solution: The instance of the string returned by
upper()
is being printed. -
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 Answer: Option C
D. Python first searches the global namespace, then the local namespace and finally the built-in namespace