Air University Multan Campus
Lab Final Examination: Fall, 2020
Subject Programing Fundamental Total Marks 45
Course Code CS-111L Date 04-02-2021
Class BSCS Time 09:00 AM – 12:00 PM
Semester 1st Max. Time 3 hrs.
Allowed
Section B Instructor Name Muhammad Yasir Khan
Signature
All questions are mandatory.
1- Write a program to which ask the user to enter 10 integers. Then using a function, it should
sum only even numbers in the array and them write those even numbers and total sum in a
text file. [10]
2- Write a program in C++ which return factorial of a number passed as an argument. [10]
3- In statistics, when a set of values is sorted in ascending or descending order, its median is the
middle value. If the set contains an even number of values, the median is the mean, or
average, of the two middle values. Write a function that accepts as arguments the following:
An array of integers
An integer that indicates the number of elements in the array
The function should determine the median of the array. This value should be returned as a
double. (Assume the values in the array are already sorted.) Use pointer notation instead of
array notation in this function. [10]
4- Write a function that accepts a pointer to a C-string as an argument and displays its contents
backward. For instance, if the string argument is Gravity the function should display ytivarG.
Demonstrate the function in a program that asks the user to input a string and then passes it to
the function. [10]
5- Attempt this question on back side of your question paper and submit to the invigilator. [5]
a. What was the best thing you learnt in this course?
b. What was the most difficult topic or concept in this course.
c. How can I improve my method of teaching to deliver the concept properly?
Feel free to answer. It won’t affect you in any way.
Happy Coding