Course Instructors : Mahmood Siddique Fawad Naseem Hina Kirn Hina Tahir Ahmed Bilal Semester: Spring 2014 Course Code: Percent Weight: Duration : 90 Minutes Time: Date : Program: BSCS Room# : Review Date : TBA
Name: Registration Number
INSTRUCTIONS 1. Write your name and registration number on the Question Paper and Answer Sheet in the spaces provided 2. Write with blue/black permanent ink pen 3. Avoid corrections in objective section of the exam paper 4. Try to finish your exam within prescribed time
Marks Allowed Marks Obtained
Instructor Signature
University Of Central Punjab Faculty of Information Technology Final Exam
X1 X1
2
Marks: 6 Time: 5 Min Write a function that takes an integer (as a long value) as a parameter and returns the number of odd digits in that integer.
Question 1 X1
3
Marks: 10 Time: 10 Min Write a C++ program which uses a 3x3 matrix A with pre-defined values as given below. Calculate the transpose of the matrix and finally display the transpose. You may use a temporary array. Initially your matrix should look like the following, DO NOT TAKE INPUT FROM USER:
= 3 8 4 9 7 1 6 2 5
Expected output is:
= 3 9 6 8 7 2 4 1 5
Question 2 X1
4
Marks: 6 Time: 10 Min Write a C++ program that inputs a char array from user and toggle the case of the letters i.e. convert all upper case letter to lower case and lower case letters to upper case. Sample input: fUn Sample Output: FuN
Question 3 X1
5
Marks: 10 Time: 10 Min Write a recursive function to calculate the number of prime numbers occurring in array.
Question 4 X1
6
Marks: 10 Time: 10 Min Write a C++ program that declares a double type array of size 20. Input the values from the user and sort the array. Finally display the contents of the array. Use insertion sort.
Question 5 X1
7
Marks: 3 Write Down the output of the following Code. #include<iostream> Output #include<conio.h> using namespace std;
void func(char[],int); void main() { char arr[10]={"Character"}; char charac='c'; func(arr,charac); getch(); } void func(char s[],int c) { int i,j;