& PIP UPDATED ACTUAL Exam
Questions and CORRECT Answers
Decomposition - CORRECT ANSWER breaking a large problem into smaller more
manageable parts, using modules
Module - CORRECT ANSWER a file containing python definitions and statements
Module user - CORRECT ANSWER someone who uses an existing module
Module supplier - CORRECT ANSWER someone who creates a brand new module
What a module can contain (5 entities) - CORRECT ANSWER functions, constants,
objects, variables, classes
Namespace - CORRECT ANSWER a space in which names exist, with no names that
conflict each other ( no duplicates )
What happens to the namespace when module is imported? - CORRECT ANSWER All
the names become known but need to be qualified to enter the codes namespace, so there can be
a variable such as randint without conflict
Qualify - CORRECT ANSWER name of module, followed by dot, followed by name of
entity.
for example... random.randint()
import module math - CORRECT ANSWER import math
, import module math as 'm' - CORRECT ANSWER import math as m
make all entities in math accessible without qualification - CORRECT ANSWER from
math import *
To make the entity sin accessible without qualification - CORRECT ANSWER from math
import sin
Import sin under the name 's', and pi under name 'p' - CORRECT ANSWER from math
import sin as s, pi as p
Make sin accessible without qualification, and import the rest of math - CORRECT
ANSWER from math import sin
import math
A name gets assigned that's already in the namespace - CORRECT ANSWER the original
name is overwritten
dir() - CORRECT ANSWER returns alphabetically a sorted list containing the names for
all teh entities
pow(X, Y) - CORRECT ANSWER returns value X to the power of Y
ceil(x) - CORRECT ANSWER smallest integer greater or equal to x
ceil(1.4) - CORRECT ANSWER 2
floor(x) - CORRECT ANSWER largest integer less than of equal to x