You are on page 1of 2

Roll Number:

Thapar University, Patiala


Department of Computer Science and Engineering
END SEMESTER EXAMINATION
B. E. (First Year): Semester-1 (2019) Course Code: UTA003
(COE/COEM/CAG/CML/ECE/ECEM/SEM/ECM) Course Name: Computer Programming
December 04, 2019 Wednesday, 14.00 - 17.00 Hrs
Time: 3 Hours, M. Marks: 100 Name Of Faculty: GEK, GS, RKU, RKR,
HKG, SES, SS, AP, DM

Note: Attempt all questions.


Assume missing data, if any, suitably.

Q.1 Write a C program to create a record of 10 student's detail using an array of (5,5)
structure, with four fields (roll_number, name, marks, grade). Assign
appropriate data type to each field. Write a code that displays the details of
a student for a given roll_number. If the roll_number is not found then display
a message "Student details are not found in the database".

Q.2 Write a C program to read the name and marks of n number of students (4,6)
from user and store them in a text (.txt) file.

Q.3 Write a C program to check whether a given integer number is palindrome (10)
or not.

Q.4 Write a program which takes a matrix of order 3x3 from the user and (4,6)
computes the transpose of that matrix.

Q.5 Guess a number between 1 and 100 in your mind. Write a program so that (20)
the computer will ask you a series of questions and determine that number
based on your answers.
Hint:
• Use two variables: low = 1 and high = 100
• Compute mid = (low + high) / 2
• Ask the user: Is it mid?
• Get user response ('<','>' or '=').
• Adjust low or high based on response
• Repeat as needed

Q.6 Write a C program to count total number of words in a string using looping (10)
instruction.

Q.7 Explain the storage classes used in C language and demonstrate each using (2.5*4)
suitable example.

PTO
Q.8 Differentiate between the following with suitable examples : (5,5)
i) Formal and actual parameters
ii) Call by Value and Call by Reference

Q.9 Given two strings sl="Welcome" and s2="Thapar". Write a program in C to (10)
concatenate (user defined function) these two given strings and store
results in third sting s3, such that s3 ="Welcome Thapar".
Note: Don't use the function strcat().

PTO

You might also like