Python MCQ Quiz Hub

Python Functions MCQS Set 2

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

1. Write the output of : print(float())




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




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




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




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




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




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




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




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




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




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




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




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




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




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




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




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




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




19. 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)




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




21. 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)




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




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




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




25. Which of the following module is used with binary files?




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




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




28. 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)




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