Python MCQ Quiz Hub

Python Functions MCQS Set 2

Choose a topic to test your knowledge and improve your Python skills

Write the output of : print(float())





✅ Correct Answer: 2

What type of error is returned by following statement? print(int(“a”))





✅ Correct Answer: 2

Write the output of the following: if user entered 7 a=input("Enter age") print(type(a))





✅ Correct Answer: 1

Write the output of the following: print(max(2, 5, 4, 8, 29, 24))





✅ Correct Answer: 2

Write the output of the following: print(min(“Hell”, “Hello”, “he”))





✅ Correct Answer: 1

Write the output of the following. print(abs(-8))





✅ Correct Answer: 2

Write the output of the following : print(round(34.5671,2)) print(round(34.3631,2))





✅ Correct Answer: 1

Write the output of the following: print(list(i * 2 for i in range(4))) print(list(range(4)))





✅ Correct Answer: 2

Write the output of : print((range(5)))





✅ Correct Answer: 1

Which of the following mathematical function return absolute value of a number?





✅ Correct Answer: 2

Which of the following Python module need to be imported to invoke sin( ) function?





✅ Correct Answer: 1

Which of the following module which need to be imported to invoke randint( ) function?





✅ Correct Answer: 2

Which of the following mathematical function return factorial of a number?





✅ Correct Answer: 3

Name the function required to check if a string contains only uppercase letters?





✅ Correct Answer: 3

Which of the following function returns the length of a sequence?





✅ Correct Answer: 1

Which of the following function is not invoked by math module?





✅ Correct Answer: 4

Which method of pickle module reads data from a binary file?





✅ Correct Answer: 2

Write the output of the following: def c(x, y): if x % y : return x+5 else: return y+10 print(c(20, 5))





✅ Correct Answer: 2

Write the output of the following: def guess(n="k", a=20, r="t"): return a, n, r t=guess("k", "t", 7) print(t)





✅ Correct Answer: 2

Write the output of : print(sum(1,2,1))





✅ Correct Answer: 1

Write the output of the following: val = 20 def display (N): val = 25 if N%5 == 0: val = val + N else: val = val - N print(val, end="#") display(70) print(val)





✅ Correct Answer: 2

Write the output of the following: def disp(m="A", t = 1): for i in range(t): print(m * 1, end="#") disp('B', 5)





✅ Correct Answer: 1

Write the output of the following: def calc(x): r=2*x**2 return r print(calc(3))





✅ Correct Answer: 1

Write the output of the following : def var(var, lst): lst[0] = var k = 33 a = [1, 2, 3] var(k, a) print(a)





✅ Correct Answer: 3

Which of the following module is used with binary files?





✅ Correct Answer: 4

Which of the following module is used for function max( )??





✅ Correct Answer: 4

Write the output of the following : t=(32, 34, 33, 33.5, 41, 44, 33) print(sum(t) + t.count(33))





✅ Correct Answer: 3

How many numbers will be printed by the following code: def fun(n1,n2): for x in range(n1,n2+1): if x%4==0: print(x, end=" ") fun(100,120)





✅ Correct Answer: 2

Write the output of the following: def lst(l1): for x in l1: print(x.lower(),end="---") lst(["MCQ","PAPER"])





✅ Correct Answer: 2