File - Priyanka Correa Computer Application

advertisement
PRACTICE QUESTIONS ON CONDITIONAL STATEMENTS
(Board paper 2006)
Q.1 A cloth showroom has announced the following festival discounts
on the purchase of items, based on the total cost of the items purchased:Total cost Discount (in Percentage)
Total cost
Discount (in Percentage)
Less than Rs. 2000
5%
Rs. 2001 to Rs. 5000
25%
Rs. 5001 to Rs. l0000
35%
Above Rs. 10000
50%
Write a program to input the total cost and to compute and display the
amount to be paid by the customer after availing the discount.[15 marks]
(Board paper 2009)
Q. 2 An electronics shop has announced the following seasonal
discounts on the purchase of certain items.
Purchase Amount
in Rs.
0 – 25000
25001 – 57000
57001 – 100000
More than 100000
Discount on
Laptop
0.0%
5.0%
7.5%
10.0%
Discount on
Desktop PC
5.0%
7.6%
10.0%
15.0%
Write a program based on the above criteria to input name, address,
amount of purchase and type of purchase (L for Laptop and D for
Desktop) by a customer. Compute and print the net amount to be paid by
a customer along with his name and address. [15]
(Hint: discount = (discount rate/100)* amount of purchase
Net amount = amount of purchase – discount)
(Board paper 2010)
Q. 3 Shasha Travels Pvt. Ltd. gives the following discount to its
custormes:
Ticket amount
Discount
Above Rs. 70000
18%
Rs.55001 to Rs. 70000
16%
Rs.350001 to Rs.55000
12%
Rs.25001 to Rs.35000
2%
Write a program to input the name and ticket amount for the customer
and calculate the discount amount and net amount to be paid. Display
the output in the following format for each customer.
Name
Ticket Charges
Discount
Net Amount
____
____________
_______
__________
Q. 4 Write a program to accept a number and check and display
whether it is a prime number or not. (Hint a number is said to be a prime
if it is divisible only by 1 and itself and not by any other number.
Example : 3, 5, 7, 11, 13 etc.)
Accept a number and print whether it IS Automorphic number.
(automorphic number is a number whose square end with the number
itself eg. 5 and 25 or 25 and 625 are automorphic.
(Board paper 2011)
Q. 5 Write a program to input a number and print whether the number is
a special number or not.
(A number is said to be special number. If the sum of the factorial of the
digits of the number is same as the original number).
Example: 145 is a special number because 1!+4!+5!= 1+24+120=145
Where ! stands for the factorial of the number and the factorial value of
a number is the product of all integers from 1 to that number, example
5!= 1*2*3*4*5=-120).
(Hint : you have to separate each digit and factorial and then add it and
finally compare original number and sum calculated. So safeguard your
original number in some other variable to compare at the end.)
(Board paper 2012)
Q. 6 Given below is a hypothetical table showing rates of Income Tax
for male citizens below the age of 65 years:
Taxable Income (TI) in
Income Tax in
Does not exceed 1,60,000
Nil
Is greater than 1,60,000 and less than or
equal to 5,00,000
( TI – 1,60,000 ) * 10%
Is greater than 5,00,000 and less than or
equal to 8,00,000
[ (TI - 5,00,000 ) *20% ] +
34,000
Is greater than 8,00,000
[ (TI - 8,00,000 ) *30% ] +
94,000
Write a program to input the age, gender (male or female) and Taxable
Income of a person.If the age is more than 65 years or the gender is
female, display “wrong category*.
If the age is less than or equal to 65 years and the gender is male,
compute and display the Income Tax payable as per the table given
above.
[15 marks]
(Board paper 2013)
Q. 7
The International Standard Book Number (ISBN) is a unique
numeric book identifier which is printed on every book. The ISBN is
based upon a 10-digit code. The ISBN is legal if:
1xdigit1 + 2xdigit2 + 3xdigit3 + 4xdigit4 + 5xdigit5 + 6xdigit6 +
7xdigit7 + 8xdigit8 + 9xdigit9 + 10xdigit10 is divisible by 11.
Example: For an ISBN 1401601499
Sum=1×1 + 2×4 + 3×0 + 4×1 + 5×6 + 6×0 + 7×1 + 8×4 + 9×9 + 10×9 =
253 which is divisible by 11.
Write a program to:
(i) input the ISBN code as a 10-digit integer.
(ii) If the ISBN is not a 10-digit integer, output the message “Illegal
ISBN” and terminate the program.
(iii) If the number is 10-digit, extract the digits of the number and
compute the sum as explained above.
If the sum is divisible by 11, output the message, “Legal ISBN”. If the
sum is not divisible by 11, output the message, “Illegal ISBN”. [15]
Q.8
Design a class to overload a function series() as follows:
(i) double series(double n) with one double argument and
returns the sum of the series.
sum = 1/1 + 1/2 + 1/3 + ….. 1/n
(ii) double series(double a, double n) with two double arguments
and returns the sum of the series.
sum = 1/a2 + 4/a5 + 7/a8 + 10/a11 ….. to n terms [15 marks]
(Board paper 2014)
Q. 9
A special two-digit number is such that when the sum of its
digits is added to the product of its digits, the result is equal to the
original two-digit number.
Example:
Consider the number 59.
Sum of digits = 5 + 9 = 14
Product of its digits = 5 x 9 = 45
Sum of the sum of digits and product of digits= 14 + 45 = 59
Write a program to accept a two-digit number. Add the sum of its digits
to the product of its digits. If the value is equal to the number input,
output the message “Special 2-digit number” otherwise, output the
message “Not a Special 2-digit number”.
(Hint : to separate the two digits d = num % 10 will give you unit place
and t = num / 10 will give you tens place number. And further you know
how and add and multiply)
Download