Programming Fundamentals BSIT OR SE 1st Term 2017 Past Paper UOS

University of Sargodha
B.S 1st Term Examination 2017
Subject: Information Technology/Software Engineering
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 on your answer sheet. (2*12)
- What is the purpose of default statement in switch statement?
- Why it is variable initialization?
- Define EOF marker?
- What is the purpose of file pointer?
- What is built-in function? Give example.
- What is Run-Time Error? Give example.
- What is Dangling Pointer?
- Differentiate between Local and Formal parameters?
- Which function is used to copy one string to another string?
- What is pointer constant?
- What is the drawback of Global variables?
- What is the infinite loop?
Subjective Part (4*9=36)
Note: Attempt any four questions. All questions carry equal marks.
Q2. Write down a program that reads 10 elements in an array from user. Pass the array to a method that prints the sum of given numbers.
Q3. Write down a program that accepts an integer number from user. Calculate and display its factorial by using a recursive function.
Q4. Write down a C program that prints the following pattern?
Q5. Write down a program that counts total number of characters in a text file.
Q6. Write a program that declares a structure Student to store rollno (int), name (string), and cgpa (float). The program defines an array to store record of five students. It inputs five students and then displays the record of each student.
Q7. Write down a program that prompts a 4-digit number from user and reverse it. For example if user enters 2348 the program should print 8432.