Tribhuvan University
Institute of Science and Technology
2066
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.
- Why flowchart is required? Explain different symbols used in the flow chart and explain with suitable example.
- 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 - 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); - 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.
- Write a program to enter two 3x3 matrices and calculate the product of given matrices.
- Explain the use of two dimensional arrays. Illustrate it with suitable program and explain it.
- 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) - 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. - 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.
- 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