DIPLOMA IN COMPUTER SCIENCE
LAB TEST / ASSIGNMENT
SUBJECT CODE : CCP413
SUBJECT NAME : PROGRAMMING METHODOLOGY AND
DATA STRUCTURE
DURATION : 3 HOURS
SEMESTER : APRIL 2023
INSTRUCTIONS TO CANDIDATES
Please ensure that this examination paper contains THREE (3) pages before you
start the examination.
CLO 1: Generate C++ codes using arrays, structures, enumeration, recursive
functions.
Objective:
a. To test the students’ ability to write codes using various C++ components such
as arrays, structures, characters, strings and recursive functions.
b. To ensure that the students have grasped the basic programming concepts and
are able to apply them to solve problems.
a. List of software
ANY appropriate IDE.
b. Report and Marks
Each question will be worth 25% each.
Each question will be divided into the following:
5% for the Pseudocode.
Max 20% for coding work. (Additional 5% is awarded if the codes can
be executed without errors)
ALL THE FILES INTO A FOLDER, MUST BE ZIPPED AND NAMED AS SHOWN
Yourname_IDNumber.zip
Send the zipped folder via the appropriate submission link given in Disted E-
Learn.
Question 1 – Arrays
You are required to write a C++ code to do the following:
a) Display all the SORTED elements of your Array
b) Calculate the Sum and Average of the elements.
c) You may increase the Array Dimensions to earn more marks.
Question 2 – Characters and Strings
You are required to write a C++ code to do the following:
a) Display a string entered by user (5 Marks)
b) Include String functions eg. Concatenation,Substrings, String comparisons
and String length OR YOUR OWN CHOICE.
Question 3 – Structures and Enumerated Types
You are required to write a C++ code to do the following:
a) Write a structure to store the names, salary and hours of work per day of 10
employees in a company. Write a program to increase the salary depending on
the number of hours of work per day as follows and then print the name of all
the employees along with their final salaries.
Hours of work per day 8 10 >=12
Increase in salary (RM) 50 100 150
b) Include Minimum 2 functions to determine the usability of your above code.
Question 4 - Recursion
You are required to write a C++ code to do the following:
a) Based on the TEST DATA below, Write a program in C++ to get the largest
element of an array using recursion.
Test Data :
Input the number of elements to be stored in the array :5
Input 5 elements in the array :
element - 0 : Any Input
element - 1 : Any Input
element - 2 : Any Input
element - 3 : Any Input
element - 4 : Any Input
Expected Output :
Largest element of an array is: (Based on the Input given by the User)
b) Determine the Largest and Smallest number using recursive function.
c) Add ONE MORE FUNCTION OF YOUR CHOICE.