Fundamentals of Computer Programming - Unit Wise Questions
1. Draw the flow chart for finding largest of three numbers and write an algorithm and explain it.
3. Write a program for the interest charged in installments for following case. A cassette player costs Rs. 2000. A shopkeeper sells it for Rs. 100 down payment and Rs. 100 for 21 more months. What is the monthly interest charged?
2. Find the value of “a” in each of the following statements:
int i=3 , j=4 ,k=8
float a=4.5 ,b=6.5,c=3.5
(a) a = b- i/k +c/k
(b) a = (b-k)/j + (j + c)/k
(c) a = c-(( i + j)/(k + i))*b
(d) a = c – i + j / k+ i * b
(e) a = c + j % 2 +b
(f) a = (b + 1) % (c + 1).
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
3. Write a program to find the factorial of a given integer.
7. Write a program to count the number of words in a sentence.
4. Write a program that uses a “for” loop to compute and prints the sum of a given numbers of squares.
5. Write a program to obtain the product of the following matrices and explain it:
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));
2) (x > y) && (a > 0) || (b < 5);
3) (a > b)?a:b;
6. Write a function to add, subtract, multiply, and divide two complex numbers (x +iy) and (c + id).
6. Write a function to multiply two x matrices.
8. What is a pointer and explain its applications? Write a program that uses pointers to copy an array of double.
OR
Define a pointer. Write a function that is passed an array of n pointers to the maximum of the floats.
9. Define a structure of employee having data members name, address, age, and salary. Take data for employee in an array dynamically and find the average salary.
7. Write a program which will read a line and delete from it all occurrences of the word
“that”.
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)
9. Write a program to read the data file which has following details.
a. Name b. Age c. Test player d. Total run.
10. Some text file is given; create another text file replacing the following words “Ram” to “Hari”, “Sita” to “Gita”, and “Govinda” to “Shiva”.
OR
What are the uses of graphical function? Explain the basic graphical function with suitable program.
10. Write a program to create a file "RECORD.TXT" then store roll no, name and percentage of 10 students. [6]
10. Given a text file, create another text file deleting the following words “three”, “bad”, and “time”.
OR
Why do you require graphical function? Explain the basic graphical function with suitable program.
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]