2015

(May)

MATHEMATICS

(Major)

Course: 401

[A: Computer Programming (C Programming)]

Full Marks: 50

Pass Marks: 20

Time: 2 ½ hours

The figures in the margin indicate full marks for the questions

1. Choose the correct answer: 1x5=5

- Which of the following is not a character constant in C?

- ‘Thank you’
- ‘Enter values of P, N, R’
- ’23.5 E-03’

- Which of the following statements is wrong in C?

- Mes = 123.56;
- Con = T *A;
- This = T * 20;
- 3 + a = b

- If an integer is to be entered through the keyboard, which function would you use?

- Scanf ()
- Gets ()
- Getche ()
- Getchar ()

- Which of the following statements is used to take the control in the beginning of a loop?

- Exit.
- Break.
- Continue.
- None of the above.

- The array int num[26] has

- Twenty-six elements.
- Twenty-five elements.
- Twenty-seven elements.
- Twenty-four elements.

2. Answer any eight of the following questions: 2x8=16

- Draw the flowchart of finding the largest number among three numbers.
- The radius of a circle is input through the keyboard. Write a C program to calculate the area of the circle.
- Write a short note on algorithm.
- Mention the bitwise operators in C.
- Evaluate the following expression assuming that k is a float variable:

K = 3/2 * 4 + 3/ 8 + 3

- State the errors, if any, in the following input statements:

- Scanf (“%c%f%d”, city, &price, &year);
- Scanf (“%s%d”, city, amount);

- Write a C program to print the odd integers between 1 and 49.
- State the errors, if any, if the following function declarations:

- Int sum (int a, b);
- Int (fun) void;

- Write the syntax of the ‘simple if statement’ and draw flowchart for it.
- Write a C program to determine whether an integer is divisible by 3 or not.
- Convert the equationinto corresponding C statement.

3. Write a C program to determine the area of a triangle using the formula, area where

Or

Write a C program to interchange the contents of two variables.

4. Write a C program to read the values ofand, and print the result of the expression 3

Or

Write a C program to evaluate the sum of squares of all integers between 1 and 10.

5. If the marks obtained by a student in 5 different subjects are input through the keyboard, write a C program to find out the aggregate marks and percentage marks obtained by the student. Assume that the maximum marks that can be obtained by a student in each subject is 100.

Or

Write a C program to compute compound interest.

6. In a company, an employee is paid as under: If his basic salary is less than Rs. 1,500, then house rent allowance (HRA) is 10% of basic salary and dearness allowance (DA) is 90% of basic salary. If his basic salary is either equal to or above Rs. 1,500, then HRA = Rs. 500 and DA = 98% of the basic salary.

If the employee’s salary is input through the keyboard, write a C program to find his gross salary. 4

Or

A year is input through the keyboard. Write a C program to determine whether the year is a leap year or not.

7. What is an array? Write a C program to choose the maximum of a one-dimensional array of numbers. 1+3=4

Or

Write a C program to determine whether a number is prime or not. 4

8. Write a C program to find the transpose of a matrix of order 3 x 3. 3

Or

Write a C program to evaluate the determinant of a matrix of order 2 x 2.

9. What is user defined function? Write a C program to evaluate the cube of an integer using function prototype. 1+3=4

Or

Write a C program to print all Fibonacci numbers less than 100.

10. Answer any one of the following: 4

- Write a C program to find the sum of cosine series up to 10 terms.
- Write a C program to add two matrices or order 3 x 3.
- Write a C program to compute the roots of the quadratic equation