We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10
11.
The function can be called in the program
by writing function name followed by ____ a. [ ] b. { } c. ( ) d. None of the above
Q12. def cal(n1) : What is n1?
a. Parameter b. Argument c. Keyword d. None of the above
Q13. cal(n1) : What is n1?
a. Parameter b. Argument c. Keyword d. None of the above
Q14. Write the output of the following:
def s(n1): print(n1) n2=4 s(n2) a. 2 b. 3 c. 4 d. Error
Q15. Which of the following statement will
execute in last? def s(n1): #Statement 1 print(n1) #Statement 2 n2=4 #Statement 3 s(n2) #Statement 4 a. Statement 1 b. Statement 2 c. Statement 3 d. Statement 4
Q16. Choose the correct answer:
def s(n1): print(n1) n2=4 s(n2)
Statement A : n1 and n2 have same memory Address
Statement B : both n1 and n2 are referring to the same value, so they have same identity a. Statement A is True and Statement B is False b. Statement A is False and Statement B is True c. Both the statements are True d. Both the statements are False Q17. Write the output of the following : def s(n1): print(n1) n1 = n1 +2 n2=4 s(n2) print(n2) a.
6 4 b.
4 6 c.
4 4 d.
6 6
Q18. Consider the following code and choose
the incorrect statement.: def s(n1): print(id(n1)) n2=4 s(n2) print(id(n2)) a. Function name is ‘s’ b. Function ‘s’ is taking one parameter. c. Both print statement will print the same value. d. Both print statement will print different value.
Q19. Write the output of the following:
def cal(m,n): if m==n: return m*3 else: return m*2 s = cal(9, 8) print(s) a. 16 b. 18 c. 27 d. 24
Q20. Write the output of the following:
def cal(m,n): if m==n: return m*3 else: return n*2 s = cal("Amit", "Anuj") print(s) a. AmitAmitAmit b. AmitAmit c. AnujAnujAnuj d. AnujAnuj
Q21. Write the output of the following:
def fn(n1, n2=7): n1=n1+n2 print(n1) fn(3, 9) a. 3 b. 9 c. 12 d. 10
Q22. Write the output of the following:
def fn(n1, n2=7): n1=n1%n2 print(n1) fn(3%2, 9%2) a. 1 b. 0 c. 2 d. 3
Q23. Which of the following function definition
header is wrong? a. def sum(n1, n2, n = 3): b. def scan(p1, p2 = 4, p3 = 5): c. def div(p1=4, p2, p3): d. def mul(p1, n1, m1): Q24. Functions which do not return any value is called ______ a. default function b. zero function c. void function d. null function
Q25. The ____________ statement returns the
values from the function to the calling function. a. send b. give c. return d. take
Q26. The return statement in function is used
to ______ a. return value b. returns the control to the calling function c. Both of the above d. None of the above
Q27. Choose the correct statement
a. We can create function with no argument and no return value. b. We can create function with no argument and with return value(s) c. We can create function with argument(s) and no return value. d. All of the above
Q28. Write the output of the following:
sound() def sound(): print("sound" * 2) a. sound b. soundsound c. NameError : name ‘sound’ is not defined d. SyntaxError: invalid syntax
Q29. A function may return multiple values
using _____ a. List b. Tuple c. String d. Dictionary
Q30. The part of the program where a variable
is accessible is known as the __________ of that variable a. scope b. module c. part d. none of the above
Q31. Which of the following is not the scope of
variable? a. Local b. Global c. Outside d. None of the above
Q32. A variable that is defined inside any
function or a block is known as a ____ a. Global variable b. Local variable c. Function Variable d. inside variable
Q33. Fill in the blank so that the output is 9:
a=9 def sound(): ________ a print(a) sound() a. local b. global c. outer d. var
Q34. Write the output of the following:
a=9 def sound(): b=7 print(a) sound() print(b) a.
7 7 b.
9 9 c.
7 9 d.
Error
Q35. How many built-in functions are used in
the following code: a = int(input("Enter a number: ") b=a*a print(" The square of ",a ,"is", b) a. 1 b. 2 c. 3 d. 4
Q36. Which of the following is not the built-in
function? a. input( ) b. tuple( ) c. print( ) d. dictionary( )
Q37. Which of the following is not the type of
function argument? a. Required argument b. Keyword argument c. initial argument d. default argument
Q38. Write the output of the following:
print("A") def prnt(): print("B") print("C") prnt() a.
A B C b.
B C A c.
A B d.
A C B
Q39. Write the output of the following:
def check(): i=5 while i > 1: if i //2==0: x=i+2 i = i-1 else: i = i-2 x=i print (x) check() a.
3 3 b.
5 3 c.
3 1 d. 3 2
Q40. Which module is to be imported for using
randint( ) function? a. rand b. random c. randrange d. randomrange
Q41. Which of the following number can never
be generated by the following code: random.randrange(0, 100) a. 0 b. 100 c. 99 d. 1
Q42. Write the output of : print(abs(-45))
a. 45.0 b. -45 c. 45 d. None of the above
Q43. Write the output of : print(max([1, 2, 3, 4],
[4, 5, 6], [7])) a. [1, 2, 3, 4] b. [4, 5, 6] c. [7] d. 7
Q44. Write the output of :
print(min(tuple(“computer”))) a. c b. o c. u d. t
Q45. Choose the incorrect statement.
a. print(pow(2, 3)) b. print(pow(2.3, 3.2)) c. print(pow(2, 3, 2)) d. None of the above
Q46. Which of the following return floating
point number? a. print(pow(2, 3)) b. print(pow(2.3, 3.2)) c. print(pow(2, 3, 2)) d. All of the above
Q47. Which of the following statement is
correct? a. A Python standard library consists of a number of modules b. A Module consists of a number of Python standard libraries c. Library and modules are alias of each other. d. None of the above
Q48. Arrange the following from Simple(small)
to Complex(big). Instructions, Functions, Library, Module a. Instructions, Functions, Library, Module b. Functions, Instructions, Library, Module c. Module, Functions, Instructions, Library d. Instructions, Functions, Module, Library
Q49. A module is save with
extension _____________ a. .py b. .pym c. .mpy d. .mps
Q50. Choose the correct statement to import
Math module: a. Import math b. import math c. import Math d. Import Math