Programming Fundamentals, Past Papers

Programming Fundamentals BSCS 1st Term 2015 Past Paper UOS

University of Sargodha BS 1st Term Examination 2015 Programming Fundamentals CMP-2122 question paper for Computer Science students. Includes objective and subjective questions such as C programming fundamentals: preprocessor directives, identifiers, control structures, loops, data types, arrays, pointers, file handling functions fgets and fputs, user-defined functions, structure declaration, and programming problems on calculators, series summation, file processing, arrays, and structures.

University of Sargodha
BS 1st Term Examination 2015

Subject: CS
Paper: Programming Fundamentals (CMP-2122)
Time Allowed: 2:30 Hours
Maximum Marks: 60

Objective Part — Compulsory

Note: Attempt all questions each question carry equal marks (212=24)*

  1. What is preprocessor directive?
  2. Write three rules of declaring an identifier in C program.
  3. Differentiate while and do-while loop?
  4. What are primitive data types? Shortly discuss one of them.
  5. What is control structure?
  6. What are difference b/w pre-increment & post-increment operators?
  7. What is logical error and why is it the most difficult error to find?
  8. Difference b/w built-in and user defined function.
  9. What is the purpose of getch()?
  10. Differentiate 1-D array and 2-D array.
  11. What is a pointer?
  12. In file-processing why a programmer use fgets and fputs functions in C program.

Subjective Part (4*9=36)

Note: Attempt any four questions.

  1. Write a program that finds the sum of the following series using nested loop:
  1. Write a program that calculates four-function (+, -, , /) calculator. It asks the user to input two numbers and an operator from the prompt.
  2. Write a user-defined function to read the content from a text file OUT.txtcount and display the number of alphabets and digits present in it.
  3. Write a program that accepts an integer value from the user and passes that to a function by reference. If the number is positive, then function finds the square of the value. The updated value is displayed by main function.
  4. Write a program that accepts 10 elements of an integer array from the user. The array and its SIZE passes to user defined function that finds the sum and average of integer array.
  5. Write a program that declares a structure PERSON to store income (float), tax_rate (int) and tax_of_a_person (float). The program defines an array of structure to store the record of five persons. It inputs incomes and tax rate of five persons and then displays the tax payable (by each person).