Skip to main content

PRACTICE QUESTIONS SET 2


LIST OF PROGRAMS


21.       A company insures its drivers in the following cases:
            a.         If the drivers is married
            b.         If the drivers is unmarried, male and above 30 years of age.
            c.         If the drivers is unmarried, female and above 25 years of age.
            In all other cases the driver is not insured. If the marital status, sex and age of the driver are inputs, write a program to determine whether the driver is to be insured or not.
22.       Any character is entered through the key board, write a program to determine weather the character entered is a capital letter, a small case letter,, a digit or a special character.
           
Character
ASCII values
A-Z
65-90
a-z
97-122
0-9
48-57
Special symbols
0-47,58-64,91-96,123,127

23.       An insurance company follows following rules to calculate premium.
a. If a person’s health is excellent and the person is between 25 and 35 years of age and lives in a city and is a male then the premium is Rs. 4 per thousand and his policy amount can not exceed Rs. 2 Lakhs.
b. If a person’s satisfied all the above conditions except that the sex is female then the premium is Rs. 3 per thousand and her policy amount can not exceed Rs. 1 Lakhs.
c. If a person’s health is poor and the person is between 25 and 35 years of age and lives in a village and is a male then the premium is Rs. 6 per thousand and his policy amount can not exceed Rs. 10,000.
            d. In all the other cases the person is not insured.
WAP to output whether the person should be insured or not, his/her premium rate and maximum amount for he/she can be insured.
24.       A library charges a fine for books returned late. Following are the fines:

First five days
:
40 paise per day
Six to ten days
:
65 paise per day
Above-ten days
:
80 paise per day

WAP to calculate the fine assuming that the book is returned N days late.

25.       WAP to input two numbers and print the greatest number among the two
26.       WAP to find the greatest no among the three numbers inputted from the user
27.       WAP to calculate the amount for telephone bill as per the given instructions:
For first 100 calls = Rs. 100/
For additional 50 calls = Rs. 2 per call
For calls more than 150 = Rs. 2.50 per call
28.       A security man is paid at the hourly rate (R) for the first 35 hours of work in a week. There after, he is paid at 1.5 times the hourly rate (R) for the next 20 hours and at 2 times the hourly rate (R) for further hours of work in the week.
Taking the number of hours (H) and the rate per hour (R) as inputs, WAP to calculate the weekly wage (W).
29.       A bank offers the following rates of interest for the fixed deposits:
           
Time (in Year)
Rate (%)
Up to ½
9
>½ but <=1
10
>1 but <=3
11
>3
12

The amount (A) after n year is calculated by using the formula:
A=P(1+r/100)n
Where, = Principal amount
r = rate of interest
WAP to calculate the amount accrued by the investor.

30.       The monthly electricity bill is to be computed as follows:
            Minimum Rs. 250 for the first 100 units
            Plus Rs. 0.40 per unit for next 50 units
            Plus Rs. 0.50 per unit for next 50 units
            Plus Rs. 0.60 per unit for next 50 units
            WAP which calculates the monthly bill based on the number of units consurned.
31.       The Solution of two linear equations
            ax + by = c, px + qy = r
            is given as x = cq – br / aq - bp , y = - cp / aq – bp
WAP to find the solution of any pair of simultaneous equations (linear) for the given values of a, b, c and q, r, p if aq – bp = 0 then print no finite solution.
32.       WAP to find out the charge for sending parcels when the charges are as follows:
For the first 1 KG. or fraction there of Rs. 20.00
For every additional 1 KG. or every fraction there of Rs. 25.00
33.       A sales man is paid commission on the following basis:

Sales
Commission Rate
Upto Rs. 10000
2%
Rs. 10001 to Rs. 20000
3%
Rs. 20001 to Rs. 50000
5%
Rs. 50001 to Rs. 70000
8%
Above Rs. 70000
10%

WAP to accept the sales amount and calculate the commission, print sale commission rate and commission.
34.       WAP to comput the result of the following condition based expression :
F(x) = 4x + y if x>0
F(x) = 4x - y if x<0
35.       A cloth showroom has announced the following festival discounts on purchase of
itoms:

Amount of purchase
Discount in %

Mill Cloth
Handloom items
Less than Rs. 1000
2%
5%
Rs 1000 to Rs. 5000
20%
25%
Rs. 5001 to Rs.10000
40%
50%
Above 10000
50%
60%

WAP to compute the net amount paid by the customer. Assume all required values to be inputted by the user. Make use of if and switch structures.
36.       WAP to accept a day number and print the corresponding day name using switch.
37.       WAP to accept a month number and print the corresponding month name using switch.
38.       WAP to create a menu based program to do the following using switch:
            1.         Find the volume of a cone                          ********
2.         Find the volume of a cylinder                    ********
3.         Find the volume of a sphere                       ********
39.       Write a menu based program using switch to calculate the following:
a.         Area of Circle [***********] where r is the radius of the circle.
b.         Circumference of circle [***********]
c.         Area of Semi circle [***********]
            d.         Perimeter of semi circle [***********]
40.       Create a menu-based program to find the addition, division, multiplication, and

Comments

Popular posts from this blog

unix commands