SET A ORCHID INTERNATIONAL COLLEGE
Bijayachowk, Gaushala-9, Kathmandu
Full Marks: 60
Pre-Board Examination – 2080 Time: 3 hour
Bachelor Level / First Year/ First Semester/ Science
Computer Science and Information Technology (CSC.115)
(C. Programming)
Candidates are required to give their answer in their own words as far as practicable.
Group"A"
Long Answer Questions (Attempt any TWO questions) [2×10= 20]
1. What do you understand by nested structure? Write the general syntax to declare nested structure. Write program
in C using a UDF to find the average of N integers. The value of N should be read from the UDF itself and the
average should be returned to the main(). Finally the main() prints the average value. [2+3+5]
2. Write the general syntax of declaring enumeration. Create a structure called Movie with membersmovieID,
movieName, duration, ticketPrice. Allocate the memory dynamically for N movies. Read the details of N movies
through UDF, display all the movies using a separate UDF to display the list of movies, read N from the user, in
main(). [4+6]
3. What are the various modes in which a binary file can be opened? Create a file in D:\\ drive with name
“[Link]”. Read information of 5 students (roll, name and marks) with marks in Maths and Science. It is
known that the marks should not exceed 100, later, store it in the binary file. Finally, verify the contents by
displaying 4th recordof the information storedin the disk filewithout closing it, using Random Access to File.
[4+6]
Group"B"
Short Answer Questions (Attempt any EIGHT questions) [8×5=40]
4. What are preprocessor directives? Explain the use of nested if statement through a simple example of your own
choice.
5. Differentiate break and continue statements. Write a program in C to display a menu driven application that
accepts a user choice and sides of the rectangle:
1->Area of Rectangle
2->Perimeter of Rectangle
3->Exit
Calculate and display the result as per user’s choice.
6. List all the logical operators and bitwise operators in C. Write a program in C to print the following pattern:
*
* *
* * *
* * * *
7. Read the length of the string from the user. Then, dynamically allocate the memory (DMA) required to store
the string. Read the string from the user and display the total number of exclamatory sentence. Later, free the
memory reserved.
8. What do you mean by multi-dimensional array? Write a program to find the sum of two matrices of size 3X3.
9. What are the conditions for forming a recursive function? Write a program to find the factorial of a positive
number entered by the user.
10. “Pointer is considered as pearl of C programming”, justify. Write a program in C to find the maximum
element from N floating point values. Use the concept of pass by reference.
11. Graphics has to be initialized manually, in order to use graphics in C. How do you initialize graphics in C?
Write a C program that displays a rectangle and a circle at the center of the window with color RED and
GREEN having length 100 units, breadth 75 unitsand radius of the circle to be 50 units respectively. Finally
close the graph.
12. Write short notes on:
a. Storage class (Static, Register, Automatic, External)
b. goto label
ORCHID INTERNATIONAL COLLEGE SET B
Bijayachowk, Gaushala-9, Kathmandu
Pre-Board Examination - 2080
Full Marks: 60
Bachelor Level / First Year/ First Semester/ Science Time: 3 hour
Computer Science and Information Technology (CSC.115)
(C. Programming)
Candidates are required to give their answer in their own words as far as practicable.
Group"A"
Long Answer Questions (Attempt any TWO questions) [2×10 = 20]
1. What are the differences between break; and continue; statements? Write a program to read and display the
information of threeEmployees (empID, fullName, email, gender and dateOfBirth). The dateOfBirth is of Date
type (day, month, and year). Use the concept of nested structure and pass by reference to read and display the
information of 3 employees.
2. Explain the use of strlen(),strcpy() string handling functions. Write your own UDF that reads a string and
calculates the length of the string and a search character; finally return the number of times that character or its
upper case equivalent is found, without using string-handling functions.
3. Differentiate calloc() and malloc().Read a matrix of M X N dynamically, and determine if it is an identity
matrix.
Group"B"
Short Answer Questions (Attempt any EIGHT questions) [8×5=40]
4. How is pointer different from a normal built-in type of variable? Read an array of 10 integer values and pass it to
a UDF that reverses it. Finally, print the sum of first and last elements of this reversed array in the main body.
[2+3]
5. Differentiate for-loop and do-while loopalong with a simple program to demonstrate your concept. [2+3]
6. What do you mean by recursion? Write a program to find permutation P(n,r). Use recursion to calculate the
factorial. [P(n, r) = n! / (n-r)! ] [2+3]
7. What is a ternary operator? WAP in C to demonstrate the use of bitwise left shift operator. [2+3]
8. What are the uses of strcat() and strcmp() functions in C? Write a program in C to display all the characters read
from the keyboard in upper case, until the user enters ‘@’ sign. [2+3]
9. What is the difference between accessing structure members using structure variable and pointer to structure?
Explain it through any example of your own choice. [2+3]
10. What are the various modes in which binary files can be opened? Assume the Employees record as in question 1
is stored in “d:\\[Link]”. Display the information of only those employees who are male. [2+3]
11. Why should we initialize graphics in C, and how do we do so? Write a program to create two circles at the center
of the screen. Read the radii from the user for both the circles. The color of smaller circle should be RED and
larger circle should be YELLOW. [5]
12. Write a program that prints the series up to Nth item of the series: [5]
0 3 8 15 24 ...