[go: up one dir, main page]

0% found this document useful (0 votes)
97 views1 page

Chapter 4 MCQS

The document contains 27 questions about Python functions and related concepts. For each question there are multiple choice answers A, B, C, or D. The correct answers are: D, D, A, B, C, C, A, B, C, C, B, B, D, A, D, B, B, A, C, C, A, A, C, B, A, C, 17.

Uploaded by

rahul ma
Copyright
© © All Rights Reserved
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
0% found this document useful (0 votes)
97 views1 page

Chapter 4 MCQS

The document contains 27 questions about Python functions and related concepts. For each question there are multiple choice answers A, B, C, or D. The correct answers are: D, D, A, B, C, C, A, B, C, C, B, B, D, A, D, B, B, A, C, C, A, A, C, B, A, C, 17.

Uploaded by

rahul ma
Copyright
© © All Rights Reserved
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/ 1

Sr no Question A B C D Correct Answer

1 Which keyword is used for function? function fun define def D


Which of the following items are present in
2 the function function name parameter list return value both A and B D
header?
If the return statement is not used inside the
3 none 0 null arbitary value A
function, the function will return:
A function that calls other
4 What is a recursive function? A function which calls itself Both A and B None of the above B
function
Which of the following function headers is
5 def fun(a = 2, b = 3, c) def fun(a = 2, b, c = 3) def fun(a, b = 2, c = 3) def fun(a, b, c = 3, d) C
correct?
6 How is a function declared in Python? def function function_name(): declare function function_name() def function_name(): declare function_name(): C
Which one of the following is the correct way
7 of calling a function_name() call function_name() ret function_name() function function_name() A
function?
What will be the output of the following
8 4.5 5 4 4.6 B
Python expression? round(4.576)
What will be the output of the following
9 Error TRUE FALSE 0 C
Python function? all([2,4,0,6])
What will be the output of the following
10 4.5 4.6 4.57 4.56 C
Python expression? round(4.5676,2)
What will be the output of the following
11 Error TRUE FALSE 4>2 B
Python function? any([2>8, 4>2, 1>2])
What will be the output of the following
12 2 FALSE -3 -4 B
Python function? min(max(False,-3,-4), 2,7)

A Python module is a file with the _____ file


13 .pym .pymodule .module .py D
extension that contains valid Python code.
To use a module in another module, you
14 must import it import include both none A
using an ________ statement
A package is a folder containing one or more
15 Python modules. One of the modules in a __package__.py __main__.py init.py __init__.py D
package must be called _______.
Which statement is correct to import all
16 from package import all from package import * from package include all from package include * B
modules from the package
17 What is returned by math.ceil(3.4)? 3 4 3 4 B
18 What is returned by math.factorial(5)? 110 120 100 140 B
What will be the output of the following
Python code?
Hello World! Hello World!' Hello
19 def sayHello(): None of the mentioned A
Hello World! 'Hello World!' Hello
print('Hello World!')
sayHello()
sayHello()
What will be the output of the following
Python code?

def printMax(a, b):


if a > b:
20 print(a, 'is maximum') 3 4 4 is maximum none C
elif a == b:
print(a, 'is equal to', b)
else:
print(b, 'is maximum')
printMax(3, 4)
What will be the output of the following
Python code?

x = 50
x is 50 x is 50 x is 50
def func(x):
21 Changed local x to 2 Changed local x to 2 Changed local x to 2 none A
print('x is', x)
x is now 50 x is now 2 x is now 100
x=2
print('Changed local x to', x)
func(x)
print('x is now', x)
What will be the output of the following
Python code?
Hello Hello Hello Hello
22 def say(message, times = 1): A
WorldWorldWorldWorldWorld World 5 World,World,World,World,World HelloHelloHelloHelloHello
print(message * times)
say('Hello')
say('World', 5)
What will be the output of the following
Python code?

def func(a, b=5, c=10): a is 7 and b is 3 and c is 10 a is 3 and b is 7 and c is 10 a is 3 and b is 7 and c is 10
23 print('a is', a, 'and b is', b, 'and c is', c) a is 25 and b is 5 and c is 24 a is 5 and b is 25 and c is 24 a is 25 and b is 5 and c is 24 None of the mentioned C
a is 5 and b is 100 and c is 50 a is 50 and b is 100 and c is 5 a is 100 and b is 5 and c is 50
func(3, 7)
func(25, c = 24)
func(c = 50, a = 100)
What will be the output of the following
24 Error TRUE FALSE 0 B
Python function? any([2,4,0,6])
What will be the output of the following
25 Error xyz 0 TRUE A
Python function? float("xyz")
What will be the output of the following
26 Error TRUE FALSE 0 C
Python function? print(bool([])
What will be the output of the following
27 17 7 0 Error A
Python function? print(sum([1,2,4],10)
What will be the output of the following
28 16 -16 0 error A
Python function? print(pow(-4,2))
What will be the output of the following
29 1 1+j 1+0j Error C
Python function? print(complex(1))
The ___ statement is used to important all
30 extend implement import deliver C
the functionality of one module into another.
what will be the output of following build in
31 24 25 26 25.1 C
module? print(math.ceil(25.1))
which method generate random float number
32 random.uniform random.random random.float random.randfloat A
in given range?
____ returns a random integer between the
33 random.uniform random.random random.int random.randint D
specifies integers.
____is the core library for scientific
34 numpy scipy matplotlib pandas A
computing in python.

You might also like