wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CHAPTER - 4 Python libraries

Total questions: 27

Worksheet time: 27mins

Name
Class
Date
1.

1.______ is a string literal denoted by triple quotes for

providing the specifications of certain program elements.

a)

a)Interface

b)

b)Modularity

c)

c) Docstring

d)

d)Client

2.

2. Which of the following functions is a built-in function in

python?

a)

a) seed()

b)

b) sqrt()

c)

c) factorial()

d)

d) print()

3.

3.What are the outcomes of the following functions?

chr(‘97’)

chr(97)

a)

a) a and Erro

b)

b) ‘a’

c)

c) Error

d)

d) Error and a

4.

4.Which of the following functions does not throw an error?

a)

a) ord()

b)

b) ord(‘ ‘)

c)

c) ord(”)

d)

d) ord(“”)

5.

What is meant by module in python?

4 lines
6.

6.Give an real time example for modularity.

4 lines
7.

7. (a)   which function helps to display all information including docstring ,function name and constant in a module.

8.

8.What is a library in python?

a)

COLLECTION OF FILES

b)

COLLECTION OF MODULES

c)

IT IS SUBPROGRAM

d)

NAME OF A FILE

9.

9.exp(),floor()belongs which module?

a)

cmath.py

b)

urlib.py

c)

math.py

d)

statistics.py

10.

10.Which operator is used in python to import all modules from package

a)

-- operator

b)

+ operator

c)

operator

d)

----> operator

11.

11.A variable defined inside the def() we called as

a)

Global

b)

enclosing

c)

local

d)

local to def()

12.

12What will be the output of the following

from import factorial

print(math.factorial(5))

a)

25

b)

10

c)

120

d)

error bcz factorial is not a module in math

13.

13.Which of the statements is used to import all names from a module into the current calling module

a)

import

b)

from

c)

dir()

d)

import*

14.

14 .What is the extension of python library modules?

a)

.mod

b)

.lib

c)

.code

d)

.py

15.

15 .In python which is the correct method to load a module math?

a)

include math

b)

import math

c)

#include<math.h>

d)

using math

16.
How do you correctly call this function
a)
def(1)
b)
x=square( )
c)
defSquare(4)
d)
x=square(5)
17.
What will print?
a)
1
2
11
b)
1
2
21
c)
1
2
3
11
d)
1
2
3
21
18.
What will print?
a)
5
b)
6
c)
3 2
d)
an error message
19.
Tells the interpreter that the code which follows is a function
a)
const
b)
int
c)
def
d)
while
20.

Which of the following items are present in the function header?

a)

Function name only

b)

Both function name and parameter list

c)

parameter list only

d)

Return value

21.

Which of the following keywords marks the begining of the function block?

a)

Func

b)

define

c)

def

d)

function

22.

What Is The Output Of The Following Code Snippet?


def func(message, num = 1):

print(message * num)


func('Welcome')

func('Viewers', 3)

a)

Welcome

Viewers

b)

Welcome

ViewersViewersViewers

c)

Welcome

Viewers,Viewers,Viewers

d)

Welcome

23.

what is a variable defined outside all the function referred to as?

a)

A static variable

b)

A global variable

c)

A local variable

d)

An automatic variable

24.

The values passed through a function call statement are called

(a)  

25.

The parameters could be a

a)

Variable

b)

Literal

c)

Expression

d)

Function

26.

What types of values remain unaffected during function call statement?

a)

Mutable objects

b)

Immutable objects

c)

Literal

d)

Variables

27.

The string enclosed in triple quotes is called the doc string. It is used to

a)

Show the documentation about the function

b)

be read by the developer reading the function code