0% found this document useful (0 votes)
757 views4 pages

Bahria University (Karachi Campus) : Midterm Examination - Spring Semester - 2020 (Computer Programming CSC-113)

1) The document provides instructions for a take home assignment with 4 questions for a Computer Programming course. 2) Question 1 asks students to write an algorithm and flowchart to calculate the sum of number sets partitioned into equal groups. 3) Question 2 asks students to write a C++ program to display a hollow pyramid star shape based on user input size until the user enters "No". 4) Question 3 asks students to write a program using an array and function to re-order positive numbers in a sorted array based on maximum, minimum, second maximum etc. 5) Question 4 asks students to write a program using switch statements to calculate grace marks for a student based on their class and number of

Uploaded by

Umar Farooq
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)
757 views4 pages

Bahria University (Karachi Campus) : Midterm Examination - Spring Semester - 2020 (Computer Programming CSC-113)

1) The document provides instructions for a take home assignment with 4 questions for a Computer Programming course. 2) Question 1 asks students to write an algorithm and flowchart to calculate the sum of number sets partitioned into equal groups. 3) Question 2 asks students to write a C++ program to display a hollow pyramid star shape based on user input size until the user enters "No". 4) Question 3 asks students to write a program using an array and function to re-order positive numbers in a sorted array based on maximum, minimum, second maximum etc. 5) Question 4 asks students to write a program using switch statements to calculate grace marks for a student based on their class and number of

Uploaded by

Umar Farooq
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/ 4

BAHRIA UNIVERSITY (KARACHI CAMPUS)

MIDTERM EXAMINATION –SPRING SEMESTER – 2020


(Computer Programming: CSC-113)

Take Home Assignment

Class: BS (IT) – 1-A (Evening)


Course Instructor: Tarwan Kumar Submission Deadline: 31-May-2020
Max Marks: 20

Note: Attempt all Questions. Answer each Question on a new page of the same document.

Read Carefully:
The deadline for this assignment is Sunday, May 31, 2020 on LMS.

WARNING: This is an individual assignment; you must solve it by yourself. Any form of
plagiarism will result in receiving zero in the assignment.

WARNING: Late submission will not be accepted. Any assignment submitted after the
cutoff time will receive zero by default (LMS).

This assignment has 04 questions that you have to answer and submit the solution on the
LMS within due deadline.

Question No: 01 [5-MARKS]


Assume that there are hundred numbers partitioned into equal sets (equal number of element in
each Element Set) and each Element Set is defined in the following order. Using counter
controlled loop concept, you are required to compute the sum of each order set.

Order Element set


1 1 2 3 4 5 6 7 8 9 10
2 11 12 13 14 15 16 17 18 19 20
3 21 22 23 24 25 26 27 28 29 30
4 31 32 33 34 35 36 37 38 39 40
5 41 42 43 44 45 46 47 48 49 50
6 51 52 53 54 55 56 57 58 59 60
7 61 62 63 64 65 66 67 68 69 70
8 71 72 73 74 75 76 77 78 79 80
9 81 82 83 84 85 86 87 88 89 90
10 91 92 93 94 95 96 97 98 99 100

Page 1 of 4
Write a step by step ALGORITHM and draw a FLOWCHART based on the above scenario.

Question No: 02 [5-MARKS]


Write a C++ SOURCE CODE using Nested Event Controlled Loop to display the hollow
pyramid star in the shape of diamond according to user choice. The program must be continued
to display hollow pyramid star of different size based on the user choice until and unless user
hits keyword “No” using computer input device. Display the output screen as following.
Note: Size of the pyramid must be read from user.

Question No: 03 [5-MARKS]


Write a C++ Source Code using Array and Function that can Re-Order the positive numbers
of a given sorted array list as following (See given output Screen). Array list must be read from
user and written using the event controlled loop. The maximum length of an array should be
“10”. You are required to declare and define a user defined function with name “RE-
ARRANGE_MAX_MIN” having two formal parameters as an list of elements and a number

Page 2 of 4
to be re-arranged/compared e.g. “RE-ARRANGE_MAX_MIN (Int Elements[], int number)”.
The program must be continued with its working based on the user choice until and unless user
hits keyword “No” using input device.

Note: In Final RE-Arranged Array list, 1st number should be of maximum value and 2nd
number should be of minimum value, 3rd number in the array list should be the 2nd maximum
value and 4rth number in the array list should be the 2nd minimum value and so on (See the
output screen).

Question No: 04 [5-MARKS]


Write a C++ Source Code to find the grace marks for a student using SWITCH statement.
The user should enter the class obtained by the student and the number of subjects he has failed
in (See output screen). Your program should assign the grace marks to student based on the
following rules.

Page 3 of 4
1. Rule 01:
a. If the student fails in more than three subjects and gets first class then, no grace
marks will be awarded to student.
b. If the student fails in less than or equal to three subjects, then student will be
awarded grace of 5 marks per subject.
2. Rule 02:
a. If the student fails in more than two subjects and gets second class then, no
grace marks will be awarded to student.
b. If the student fails in less than or equal to two subjects, then student will be
awarded grace of 4 marks per subject.
3. Rule 03:
a. If the student fails in more than one subject and gets third class then, no grace
marks will be awarded to student.
b. If the student fails in one subject only, then student will be awarded grace of 5
marks per subject.
4. If user enters 4th class as input for student, then your program must display a message
(“You have entered wrong class for the student! Please try again Thank you.”).

Good Luck 

Page 4 of 4

You might also like