Bsc Csit Nepal

2072

C Programming

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

Attempt all questions:

  1. Draw a flow chart and write an algorithm to find a number is divisible by either 5 or 7 ? (6)

  2. Discuss logical operators along with the truth table. Write a program using switch statement to display EXCELLENT, VERY GOOD, GOOD, SATISFACTORY, or FAIL if the user enters A, B, C,D,E respectively. (3+3)

  3. What do you mean by entry-controlled and exit-controlled loop? Write a program to print the following output.(2+4)

  4. Differentiate break statement with continue statement. What is the output if the following program ? (2+4)

         #include<stdio.h>
         #include<conio.h>
         #include<math.h>
    
         Void main()
         {
         int x=2, n=5, sum=0, i;
         clrscr();
         for(i=1; i<=n; i++)
         {
         If(i%2==0)
         Sum==sum-pow(x,i);
         else
         sum=sum+pow(x,1);
         }
         Printf(“sum=%d”,sum);
         Getch();
         }
  5. Explain pass by value and pass by reference with suitable example of each. (6)

  6. What is array? Write a program to find the sum of each row of 3*2 matrix.

  7. What is dynamic memory allocation? Write a program to find sum and average of n numbers entered from the keyboard using dynamic memory allocation to create array to store these n numbers.(2+4)

  8. Discuss different file openings modes. Write a program to read all the numbers from the input file “value.dat” and store only even numbers in an output file named as “result.res”.(2+4)

  9. Discuss with example any five graphics function used in c-programming. (6)

  10. Write short notes on:

    • a) Documentation
    • b) structure