LOYOLA COLLEGE (AUTONOMOUS), CHENNAI – 600 034
B.Sc. DEGREE EXAMINATION – STATISTICS
|
FIFTH SEMESTER – APRIL 2006
ST 5401 – C AND C ++
(Also equivalent to STA 401)
Date & Time : 17-04-2006/AFTERNOON Dept. No. Max. : 100 Marks
PART – A
Answer all the questions. 10 ´ 2 = 20
- List the characters involved in the character set of C.
- How do string constants differ from character constants?
- Write a C program to compute the product of two given numbers.
- j = 1
while ( j<=4)
{
printf( “%d”, j);
j = j + 1;
}
What is the output of this program?
- What is an array?
- Define Classes.
- Write any two application of C++.
- Find errors, if any, in the following C++ statements.
cout<<”x = “ X;
cin>>x;>>y;
- Distinguish between private and public section.
- What is a function in C++?
PART – B
Answer any five questions. 5 ´ 8 = 40
- What are increment and decrement operators? Explain their uses with examples.
- When the principal, rate of interest and period of deposit are given, write a C program to compute the simple interest and the compound interest.
- Write a C program to find the mean of two numbers using function“.
- Write a C program to count the number of boys whose weight is less than 50 kgs and height is greater than 170 cm and also print their corresponding weights and heights.
- Explain the following conditional statements:
a). if statement b). nested if c). while … do and d). do while.
- Define overloaded functions to display two and three values.
- Write a C++ program to find the largest of given n positive numbers
- Write a C++ program to arrange a set of n values in the ascending order
PART – C
Answer any two questions. 2 ´ 20 = 40
- a). The mean and variance of a set of n values x1,x2,…,xn are given by the formulas
Mean = Sxi / n
Variance = (1/n) Sxi2 – (Sxi /n)2
Write a C program to find the mean and variance.
b). Explain switch statement and give an example. (12 + 8)
- a). Write a C program for raising a whole number to a power with help of function.(Raising the value i to power j is denoted as i j in Mathematics).
b). Explain two-dimensional array and give an example. (13 +7)
- a). If the annul gross income of a person exceeds Rs.20,000, he has to pay 25% of his income tax and 7% of his gross-income as profession tax. Otherwise, he has to pay 15% of his gross-income as income tax and 5% of his gross-income as profession tax. Write a C++ program to read in the gross-income of a person and calculate the income tax and the profession tax to be paid by him.
b). A bank provides an interest of 10% on deposits up to Rs.8000, 12% for deposits between Rs.8001 and Rs.12000 and 15% for deposits above Rs.12000. Write a program to calculate one year’s interest for a given deposit amount according to the above rules. (10 +10)
- a). Write a C ++ program to find out whether a given number n is a prime number .
b). Write a C++ program to perform addition, multiplication and division of two numbers using class concept. (6+14)
Latest Govt Job & Exam Updates: