Bsc Csit Nepal

Model

C Programming

Full Marks: 60
Pass Marks: 24
Time: 3 hours

Attempt any two questions: (2 x 10 = 20)

  1. Define function and list its advantages. Describe the difference between passing arguments by value and passing arguments by address with suitable program. [4+6]
  2. Explain how structure is different from union? Make a program using structure of booklist having data member’s title, author, and cost. Enter four data and calculate total cost. [3+4+3]
  3. Explain various modes in which file can be opened? Write a program to CREATE and WRITE N numbers in a file “NUMBER.TXT” . Open this file then read its content and put all even numbers in one file “EVEN.TXT” and odd numbers in another file”ODD.TXT”. [2+4+4]

Attempt any eight questions: (8 x 5 = 40)

  1. What do you mean by a problem analysis? What are the properties of a good algorithm? Explain the Compilation and Execution of any C program? [1+1+3]
  2. Define nested if else statement with suitable flowchart. Write a C code to check if user given input is exactly divisible by 5 or 11 using nested if else statement? [2+3]
  3. List various binary and unary operators used in C? Write a program that uses “while”loop to compute and prints the sum of a given numbers of squares. For example, if 4 is input, then the program will print 30, which is equal to 12+22+32+42 [1+4]
  4. “Size of character array is always declared one more that the input size.” Justify the statement. Write a program to read a character array in input as “TRIBHUVAN UNIVERSITY” from the user and find out how many times a character “I” occurs in that array? [1+4]
  5. Write syntax to declare and initialize 2-dimensional array? With suitable program logic explain how would u find transpose of a 3*3 matrix. [1+4]
  6. Explain the concept of recursive function using the example program to find the factorial of given positive integer. [5]
  7. Describe the fundamental concept of pointer and its arithmetic with suitable examples. [5]
  8. Explain the use of graphical functions. Write a program to draw a triangle using line() graphics function. [1+4]
  9. Write short notes on: [2+3]
    • i) Dynamic Memory Allocation
    • ii) break and continue