C. Programming Mid Term
C. Programming Mid Term
1
1 1
1 1 1
1 1 1 1
ORCHID INTERNATIONAL COLLEGE SET B
Bijayachowk, Gaushala-9, Kathmandu
Full Marks: 60
Pre-Board Examination – 2075 Pass Marks: 30
Bachelor Level / First Year/ First Semester/ Science Time: 3 hour
Computer Science and Information Technology (CSC.110)
(C. Programming)
Candidates are required to give their answer in their own words as far as practicable.
Section "A"
Long Answer Questions (Attempt any Two questions) [2×10 = 20]
1. What are the similarities and differences between array and structure? Write a program to read the
information of an Employee (empID, fullName, designation, salary, dateOfJoining) and display it. The
dateOfJoining is of Date type (day, month, and year). Use the concept of nested structure.
2. Explain each built-in functions used in DMA. Write the general syntax for allocating memory on
runtime for N number of floating type array using calloc().
3. Explain bitwise right-shift operator. Write a simple program to demonstrate the use of nested for loop.
Section B
Short Answer Questions (Attempt any Eight questions) [8×5=40]
4. What is the use of break, and continue; statement? Draw flowchart and write program in C to find
the simple interest. [2+3]
5. Differentiate between compiler and interpreter. What is the importance of program documentation in
a C program? [2+3]
6. Describe NULL pointer. Write a program in C to swap two floating type values using the concept of
pass by reference. [2+3]
7. What do you mean by enumeration and macros? Write a simple program in C to implement cube of
any number using the concept of macro. [2+3]
8. How can graphics be initialized in C? Explain line(), circle() and rectangle() graphical functions along
with their general syntax. [2+3]
9. Distinguish between the while and do-while loop. Write a program in C to find the sum of squares of
N natural numbers using for loop. Read the value of N interactively. [2+3]
10. How do you initialize a structure variable? Read and display information of 5 books (bookID, title,
cost and edition). Use user defined functions to read and display the information. [2+3]
11. What are the uses of strcpy() and strcmp() functions. Write a program in C to read a string and a
character from the user interactively. The UDF must be used to calculate total number of
occurrences of the character in the string. Finally, the count should be displayed in the main body.
[2+3]
12. What are the various modes in which a file can be opened? Assuming the Employee structure as in
question 1, stored in a record file employee.dat, display the information of employees earning not
less than 50000 in a well formatted way. [2+3]