Você está na página 1de 1

Second Assignment Questions

Subject: Problem solving using computers Sem: Ist B.Tech.

1a) Chatflow Wireless offers customers 600 weekday minutes for a flat rate of 39.99. Night (8
P.M. to 7 A.M.) and weekend minutes are free, but additional weekday minutes cost 0.40 each.
There are taxes of 5.25% on all charges. Write a C++ program that prompts the user to enter the
number of weekday minutes, night minutes, and weekend minutes used, and calculates the
monthly bill and average cost of a minute before taxes. The program should display with labels
all the input data, the pretax bill and average minute cost, the taxes, and the total bill. Store all
monetary values as whole cents (rounding the taxes and average minute cost), and divide by 100
for display of results. 2M
1b) What is looping? Differentiate between entry and exit controlled loop structures. 2M

2a) A company insures its drivers in the following cases:


If the driver is married.
If the driver is unmarried, male & above 30 years of age.
If the driver is unmarried, female & 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 the
inputs, write a C++ program to determine whether the driver is to be insured or not. (do not use
logical operators) 2M
2b) Write a C++ program to print out all Armstrong numbers between 1 and 500. 2M
3a) The marks obtained by a student in 5 different subjects are input through the keyboard. The
student gets a division as per the following rules:
Percentage above or equal to 60 - First division
Percentage between 50 and 59 - Second division
Percentage between 40 and 49 - Third division
Percentage less than 40 - Fail
Write a C++ program to calculate the division obtained by the student. (use if-else statement) 2M
3b) What is a switch-statement? When it is used? Give the syntax. 2M

4a) What is ternary operator? With proper syntax explain ternary (conditional) operator. Write a
C++ program to compute the largest among 3 numbers using ternary operator. 2M
4b) What is a nested-if-statement? When it is used? Give the syntax. 2M

5a) What is bitwise left shift operator? Write a C++ program to illustrate bitwise left shift
operator. 2M
5b) A five-digit number is entered through the keyboard. Write a C++ program to obtain the
reversed number and to determine whether the original and reversed numbers are equal or not.
2M

Você também pode gostar