0% found this document useful (0 votes)
0 views5 pages

NTP26W0 Practice Test 2 - 2025

This document is a practice test for the subject 'Network Programming II' for a Diploma in ICT in Communication Networks at Walter Sisulu University. It includes multiple choice, true/false, and short answer questions covering Python programming concepts. The test is designed to assess students' understanding of various topics within the subject and is structured to be completed in 1 hour and 30 minutes for a total of 50 marks.
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)
0 views5 pages

NTP26W0 Practice Test 2 - 2025

This document is a practice test for the subject 'Network Programming II' for a Diploma in ICT in Communication Networks at Walter Sisulu University. It includes multiple choice, true/false, and short answer questions covering Python programming concepts. The test is designed to assess students' understanding of various topics within the subject and is structured to be completed in 1 hour and 30 minutes for a total of 50 marks.
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/ 5

WALTER SISULU UNIVERSITY

DEGREE AND DIPLOMA EXAMINATIONS


PRACTICE TEST 2 - 2025

SUBJECT : NETWORK PROGRAMMING II

SUBJECT CODE : NTP26W0

QUALIFICATION : DIPLOMA IN ICT IN COMMUNICATION NETWORKS

EXAMINER/S : MR JA OKUTHE

MODERATOR : DR O OKI

INSTRUCTIONS
• Answer ALL questions.

REQUIREMENTS

ANNEXURES/ADDENDA : NONE

DURATION : 1 Hour 30 Minutes

MARKS : 50

NUMBER OF PAGES : 5 pages (including cover page)

Pa ge 1|5
SECTION A (MULTIPLE CHOICE) [10 MARKS]

1.1 In Python programming, the entity None is a __________.


a. Value
b. Keyword
c. Variable
d. Nothing
1.2 What will be the output when the following code is executed?

a. 1
b. 2
c. 3
d. None
1.3 In the animals dictionary below, dog is an example of a _______.

a. Value
b. Key
c. Index
d. Element
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 can be easily transferred between a function and the main program.
d. They are variables linked to built-in functions.
1.5 What will be the output when the following code is executed?

a. (10, 20, 30)


b. (10, 20)
c. (20, 30, 40)
d. (20, 30)
1.6 Which of the following statements best describes the purpose of exceptions in Python?
a. Ensure the program is correct and alert programmers when code has errors.
b. Terminate programs when an error is encountered and avoid any harm.
c. Handle errors by displaying appropriate messages and avoiding program termination.
d. Advise the programmer by providing syntax hints to ensure the code is correct.
Pa ge 2|5
1.7 In Python, the purpose of aliasing a module is to ________.
a. Convert it to a package and insert more functions.
b. Specify new features and make it more effective.
c. Redefine exceptions that it can handle.
d. Change its identity to a different name from the original
1.8 What will be the output when the following code is executed?

a. ‘boss’
b. 226578543
c. ‘dave’
d. 334125798

1.9 Which of the following statements best describes a Python package?


a. Collections of modules, functions, and global variables organized in a directory
hierarchy
b. A file containing Python definitions and statements, which can be later imported and
used when necessary
c. Data structures that are grouped into a collection and stored in a library
d. A collection of files that cooperate to complete a specific task

1.10 Refer to the exhibit. The entity win is most likely a _________.

a. Function
b. Module
c. Package
d. Keyword

SECTION B (TRUE OR FALSE) [5 MARKS]


2.1 A variable created outside a specific function is not visible inside the function.

2.2 In Python, bad data fed to the code may cause a bug, resulting in undesirable code
behaviour.

2.3 A module can contain executable Python statements.

2.4 A Python dictionary is a mutable data structure.

2.5 In the Python code environment, which can be considered a pyramid with several layers,
the hardware layer includes the operating system.

Pa ge 3|5
SECTION C (SHORT ANSWER QUESTIONS) [35 MARKS]
3.1 The power of a Python function relies on its ability to accept data provided by the user. A
typical Python program includes parameters and arguments as variables.
a) List any two differences between parameters and arguments (4)
b) Consider the following Python code.

i. Identify any two parameters (2)


ii. What will be the output when the code is executed if x=2, y=1, and z=4? (2)
iii. Rewrite this code using the return instruction. (4)

3.2 Both tuples and dictionaries are Python data structures.


a) State any two differences between a tuple and a dictionary. (2)
b) Consider the following code that involves the use of tuples.

i. What will be displayed by the statement on line 3? (1)


ii. What will be displayed by the statement on line 4? (2)
iii. What will be displayed by the statement on line 5? (2)
iv. Rewrite the code above so that a new tuple called my_newsliced_tuple that
displays the last four elements of my_newtuple is created and displayed. (4)

3.3 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.

i. In line 1, is math a package or module? (1)


Pa ge 4|5
ii. What is the purpose of using the instruction import *? (1)
iii. Given that the area of a circle is determined by the formula A=πr , rewrite the
2

program to compute the area of the circle. (2)

3.4 Provide the output from the following code.


a)

(2)
b)

(2)
c)

(2)

=========================== THE END ===========================

Pa ge 5|5

You might also like