Programming Fundamentals MSc IT 1st Term 2017 Past Paper UOS

University of Sargodha
M. Sc. 1st Term Exam 2017
Subject: Information Technology
Paper: Programming Fundamentals (CMP-2122)
Time Allowed: 2:30 Hours
Maximum Marks: 60
Objective Part (Compulsory)
Q1. Write short answers of the following in 2-3 lines each. (2*12)
i. What is preprocessor directive?
ii. What are comments and how do you insert it in a C program?
iii. Why we use do-while loop in C?
iv. What is variable initialization and why is it important?
v. What is the Lowlevel language?
vi. Describe the importance of default statement in switch statement.
vii. What are syntax errors? Why does it occur?
viii. What is the meaning of prototype of a function?
ix. Is it necessary to initialize the const variable in C?
x. Define a structure?
xi. What is the advantage of an array over individual variables?
xii. What do the characters “r” and “w” mean when writing programs that will make use of files?
Subjective Part (4*9)
Q2. Write a program that accepts your age in years (type int) and then displays age in days and months.
Q3. Write a program that displays the following output using nested loop:
Q4. Write a C program that copies the content of text file to other new file.
Q5. Write a program that takes 10 elements (array) from the user. Using bubblesort, sort the array in ascending order.
Q6. Write a C program to find factorial of a number using function recursion.
Q7. Write a four-function calculator to perform addition, subtraction, multiplication and division that takes two operands and an operator from user. Perform this logic by using switch statement.