Thursday, November 10, 2011

C Programming Paper 2066

Tribhuvan University
Institute of Science and Technology
2066

Bachelor Level/ First Year/ First Semester/ Science                              Full Marks: 60
Computer Science and Information Technology (CSc 102)             Pass Marks: 24
(Fundamentals of Computer Programming)                                                Time: 3 hours.
Candidates are required to give their answers in their own words as for as practicable.
All questions carry equal marks.
Attempt all the questions.
  1. Why flowchart is required? Explain different symbols used in the flow chart and explain with suitable example.

  2. Determine which of the following are valid identifiers? If invalid, explain why?
    (a)    record1                                   (b)  1record
    (c)    file_3                                      (d)   return
    (e)   #tax                                          (f)   name
    (g)    goto                                        (h)  name and address
    (i)      name-and-address                  j)   123-45-6789
    (k)    void                                         (l)   name_address

  3. Find the error in the given program and explain it. Write the correct program.
    #include<stdio.h>
    include<math.h>
    main
    {
    float p, r, n;
    printf(“Please enter a value for the principle (P):”);
    scanf(“%f”, &p);
    printf(“Please enter a value for the interest rate (R)”);
    scanf(“%f”, &r);
    printf(“Please enter a value for the number of years (n):”):
    scanf(“%f”, n);
    f = p * pow + r/100),n);
    printf(\n The final value (F) is: %. 2f\n”, f);

  4. Write a program that uses a “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.

  5. Write a program to enter two 3x3 matrices and calculate the product of given matrices.

  6. Explain the use of two dimensional arrays. Illustrate it with suitable program and explain it.

  7. Write and test the following power() function that returns 'x' raised to the power 'n', where 'n' can be any integer:
     double power (double  x, int p)

  8. Justify the pointer is jewel of C language. Write a function that is passed an array of 'n'  pointers to floats and returns a newly created array that contains those 'n'  float values in reverse order. Assume any necessary data.
    OR
    Explain pointer with suitable diagram. Write a function that uses pointers to search for the address of a given integer in a given array. If the given integer is found, the function returns its address; otherwise it returns NULL.

  9. Why structure is required? Make a program using structure of booklist having data member’s title, author, and cost. Enter four data and calculate total cost.

  10. Create a text file and enter “to write a good program is very time consuming job”. Create another text which contains reverse of above text.
    OR
    Explain the use of graphical function. Make a program that contains basic graphic functions.

0 comments:

Post a Comment