Fundamentals of Computer Programming 2066

Tribhuwan University
Institute of Science and Technology
2066
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. Why flow chart is required? Explain different symbols used in the flow chart and explain with suitable example.

6 marks view

2. Determine which of the following are valid identifiers? If invalid, explain why?

(a) record1 (b)record

(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

6 marks view

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

6 marks view

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


6 marks view

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

6 marks view

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

6 marks view

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)

6 marks view

8. Justify the pointer is jewel of C language. Write a function that is passed an array of 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.

6 marks view

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.

6 marks view

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.

6 marks view