Network Programming II Practice Test 3
Network Programming II Practice Test 3
EXAMINER/S : MR JA OKUTHE
MODERATOR : DR O OKI
INSTRUCTIONS
• Answer ALL questions.
REQUIREMENTS
ANNEXURES/ADDENDA : NONE
MARKS : 50
Pa ge 1|6
SECTION A (MULTIPLE CHOICE) [10 MARKS]
a. 1
b. 3
c. 4
d. 5
1.4 Which of the following statements best describes immutable data?
a. They cannot be modified at run time.
b. They can be freely updated at any time.
c. They move easily between a function and the main program.
d. They are variables linked to inbuilt functions.
1.5 What will be the output of the following code?
a. (10, 5, 3)
b. (10, 5)
c. (5, 3, 7)
d. (5, 3)
1.6 Which of the following statements best describes a Python package?
a. A single file that defines functions, classes, and variables and may also include
runnable code.
b. Contains collections of functions and global variables organized in a directory
hierarchy.
c. Mutable data structures that allow you to store key-value pairs.
d. A data structure representing an immutable, ordered collection of elements.
Pa ge 2|6
1.7 What will be the output when the following code is executed?
a. dave
b. 226578543
c. 334125798
d. 555123454
1.8 What will be the output from the following code?
a. 4
b. 5
c. 6
d. 7
1.9 Which of the following statements best describes a ValueError exception?
a. Occurs when dealing with variables that are inappropriately used in some context.
b. Shows up when a data type cannot be accepted in the current context.
c. Arises when trying to activate a method which does not exist in an item under
consideration.
d. Raised when the control reaches a line of code which violates Python’s grammar
1.10 Refer to the exhibit.
Pa ge 3|6
SECTION B (TRUE OR FALSE) [5 MARKS]
2.1 A variable created outside any function is visible inside the function.
2.2 A dictionary is a mutable data type.
2.3 A function does not belong to any data.
2.4 Even the most careful programmer is not able to avoid minor or major defects in program
development.
2.5 A module is is a file containing Python definitions and statements.
Pa ge 4|6
3.2 Consider the following Python code.
3.3 A function's power is revealed when it can accept data provided by the user. A Python
program that uses functions includes parameters and arguments as variables.
3.4 Modules and packages are used in Python to enhance the structure of large and complex
programs.
a) List and discuss any two differences between modules and packages. (2)
b) Consider the following Python code.
Pa ge 5|6
3.5 Python slice() function returns a slice object in a sequence. The programmer can specify
where to start the slicing, and where to end.
Pa ge 6|6