Fundamentals of Computer Programming 2072

Tribhuwan University
Institute of Science and Technology
2072
Bachelor Level / First Semester / Science
Computer Science and Information Technology ( CSC-102 )
( Fundamentals of Computer Programming )
Full Marks: 60
Pass Marks: 24
Time: 3 hours
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.

Attempt all questions

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

6 marks view

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

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

1

01

101

0101

10101

6 marks view

    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();

    }


    6 marks view

    5. Explain pass by value and pass by reference with suitable example of each. (6)

    6 marks view

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

    6 marks view

    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)

    6 marks view

    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)

    6 marks view

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

    6 marks view

    10. Write short notes on:

      a) Documentation

      b) Structure

    6 marks view