Bsc Csit Nepal

2070

C Programming

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

Attempt all questions:

  1. What is logical error? Write flowchart and program for checking whether the number entered by the user is exactly divisible by 5 or by 11. [1+5]

    OR

    What is algorithm? Write an algorithm to check given number is prime or composite. [1+5]

  2. What is operator? List any six operators used in C-programming language. Write a program to find least number between any two numbers using ternary operator. [1+2+3]

  3. Define printf() function, header file and main function. Find the value of following expression. Use the value initially assigned to the variables for each expressions. [4.5+1.5]

    • int a = 8, b = 5;
    • float x = 0.005, y = -0.01;
      1. 2 _ ((a / 5) + 4 _ (b – 3)) % (a + b - 2));
      1. (x > y) && (a > 0) || (b < 5);
      1. (a > b)?a:b;
  4. Difference between if and switch statement. Write a program to read the marks of four subjects then find total, percentage and division according to given condition. [1+5]

    PercentageDivision
    p ≥ 80Distinction
    80 > p ≥ 70First division
    70 > p ≥ 50Second division
    50 > p ≥ 40Third division
    OtherwiseFail

    Assume each subjects carrying 100 full marks and students must secure greater or equal to 40 in each subjects for division.

  5. Differentiate between break and continue statement. Write a program to display following output [2+4]

  6. Write a program to input any 10 numbers then find out greatest and smallest number. [6]

  7. Write a program to add two 3×3 matrix using function. [6]

  8. What is recursion? Write a program to find the factorial of given number using recursion. [2+4]

    OR

    What is pointer? Write a program to sort ‘n’ numbers in ascending order using dynamic memory. [2+4]

  9. List any five names of graphics function. Write a program to read line of text then count no. of vowels, No. of digits and no. of spaces. [2+4]

  10. Write a program to create a file “RECORD.TXT” then store roll no, name and percentage of 10 students. [6]