0 ratings0% found this document useful (0 votes) 6 views3 pages2018 Theory Programming 2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
ZIMBABWE.
MINISTRY OF HIGHER AND TERTIARY EDUCATION,
SCIENCE AND TECHNOLOGY DEVELOPMENT
HIGHER EDUCATION EXAMINATIONS COUNCIL
(HEXCO)
NATIONAL CERTIFICATE
IN
INFORMATION TECHNOLOGY
SUBJECT: Programming Using C++ (Theory) _ PAPER NO: 317/13/S02A
DURATION: 3 Hours
© REQUIREMENTS
Answer booklet
INSTRUCTIONS TO CANDIDATE
Answer all questions
This paper consists of 3 printed pages.3/S02A PROGRAMMING USIN
QUESTION 1
8) Explain four (4) benefits of using the C++ programmir language
‘Simarks)
») Define the following C++ programming terms:
1) Keyword (2 marks)
ii) Source code (2 marks)
ii) Linker (2 marks)
iv) Literal (2 marks)
©) Explain the meaning of the following terms as used in programming:
i) Logical error (2 marks)
ii) Run-time error
UESTION 2
a)
(2 marks)
Explain any five (5) data types used in C++ programming. _(10 marks)
4) If the ages of Tom, Sue and Joe are input by the user, write a code
snippet to determine the youngest of the three (3). (10 marks)
UESTION 3
a) _ A program is required that would calculate the area of a circle. You are
required to fill in the Input- Process-Out (IPO) table given below:
© [ia FR
~ (3 marks) (6 marks)
b) With the aid of code snippets explain:
i) Do... while loop.
ii) Nested for loop.
iii) Switch statementFunction prototype (2 marks)
i) Void funetion (2 marks)
>) Determine the output of the program below and explain
ee (int BA, int GB)
at maing
e Int A-4,B-18;
Tee (A.B)
return 0; (4 marks)
QUESTION 5
a) Declare a structure called “BANK” with fields:
AccountNo an integer type
Accountname a string 20 characters
Accountbalance a double type
Write a code snippet that declare an array called “CLIENTS” of size 10
and enable the user to capture bank details for 10 clients. (10 marks)
b) Explain the effect of each of the following file processing code segments:
i) ofstream myfile;
myfile. open (“students. txt”); (3 marks)
ii) while (IMylife.eof ())
a
Myfile. getline (data, 100);
c) State the differences between text file and binary file, sy
JUESTION 6