Programming Fundamentals MSc IT 1st Term 2018 Past Paper UOS

University of Sargodha
M. Sc. 1st Term Exam 2018
Subject: I.T
Paper: Programming Fundamentals (CMP-2122)
Time Allowed: 2:30 Hour
Maximum Marks: 60
Objective Part (Compulsory) (2*12)
Q.1. Write short answers of the following in 2–3 lines each.
i. What is the difference between high level and low level languages?
ii. What is the significance of an algorithm to C programming?
iii. Evaluate the expression. y = 24 / 3 / 2 + 1 – 2 + 6 / 2;
iv. What is a program flowchart?
v. What are run-time errors?
vi. Can I use “int” data type to store the value 32768? Why?
vii. What is the use of a ‘\0’ character?
viii. Can the curly brackets { } be used to enclose a single line of code?
ix. How do you access the values within an array?
x. When is the “void” keyword used in a function?
xi. Define recursion.
xii. What is a pointer? Write an example of initialization of a pointer?
Subjective Part (4*9)
Q.2. Write a program that will prompt the user to enter number of hours. It computes and displays the how many number of weeks, days and hours within the input number of hours.
For example:
Enter total hours = 4000
Output will be displayed
23 weeks, 5 days and 16 hours in input hours
Q.3. Write a program to calculate the monthly Mobile Telephone bill, input the calls, pass the calls to the user defines function BillCalculate()
, calculate telephone bill and display it. Calculate the monthly telephone bills as per the following rule.
- Minimum Rs. 300 for upto 50 calls.
- Plus Rs. 0.70 per call for next 50 calls.
- Plus Rs. 0.55 per call for next 50 calls.
- Plus Rs. 0.35 per call for any call beyond 150 calls.
Q.4. Write a C program to calculate the following Sum of the following series by using nested loops:
Q.5. Write a program that stores 10 values in an array of type integer. The array and its SIZE pass to the user-define function that find and display most frequently occurrence number from the array.
Q.6. Write a recursive function RecursiveSum
that takes an integer array and the array size as arguments and returns the sum of all elements of the array.
Q.7. Write a program that reads a text file that containing 100 integers’ numbers. Your program should count all of the numbers that are prime.
Prime number: a prime number can be divided evenly only by 1 and by itself. Prime numbers also must be greater than 1.