Vous êtes sur la page 1sur 4

Index

Q.1 Write a program that accepts temperature in Celsius and print the converted temperature in
Fahrenheit.
Hint F= (9/5)C+32.

Q2. Input roll no and marks in five different subjects of a student. Your program should create a
nicely formatted report that displays his roll no and all five scores as well as the total score and
percentage that the student scored.

Q.3 a) Write a program to input two numbers a and b and prints sum, difference , product , quotient
and remainder.
b) Now modify the above program to make a simple calculator that reads two numbers and an
operator using switch statement. The program should apply inputted operator on the inputted
operands and displays result. For the invalid operator, the program should print Invalid operator
inputted. The program should work for following operators: +. - , * , / ,(mod)%,(power)^.

Q4. WAP that reads in a character <ch> from the keyboard and then displays one of the following
messages:
a. If <ch> is a lower case alphabet, the message
The upper case character corresponding to <ch> is
b. If <ch> is an upper case alphabet, the message
The lower case character corresponding to <ch> is
c. If <ch> is not an alphabet, the message
<ch> is not an alphabet

Q5. Write a program to input Taxinum (int to store taxi num), kms (int to store num of kms travelled)
calculate Bill according to the table given:
Km travelled(in km) Rate/km (in Rs)
<=1km 25
1<km <=6 10
6<km<=12 15
12<km<=18 20
>18 km 25
Display the result in following format.
Taxinum ..... travelled ....kms and the Bill is Rs.....

Q6. Input three integers and print highest and second highest out of them.

Q.7. An electricity board charges according to the following rules:
For the first 100 units 40 p per unit (p = Paise)
For the next 200 units - 50 p per unit
Beyond 300 units - 60 p per unit
All users have to pay meter charge also, which is Rs 50.
Write a program to read the number of units consumed and print out the charges.



Q 8 Write a program that reads a six digit number from the user. After reading the number, compute
the sum of the odd-positioned numbers, multiply all of the even-positioned numbers together, and add
these two numbers together. That is, you should add the first, third and fifth numbers. You will then
multiply the second and fourth and sixth number. The sum of these two numbers is your final result.

Q.9. Develop a C++ program to classify students amongst various categories as per their age
entered. Read age of N students and count no of students falling in each category as described
below print a report as follows
Group A: 12 yrs and above but less than 15 yrs - XX
Group B: 15 yrs and above but less than 17 yrs - XX
Group C: 17 yrs and above but less than 19 yrs - XX
Group D: Lesser than 12 yrs - XX

Q10 Input dd, mm, yyyy as integer and check for validity of date entered by user. Use multiple ifs and
switch statement. Validity of year is between 1900 to current year.

Q11. Write a menu driven program to calculate the total surface area and volume of a cube, cuboid,
or sphere depending upon users choice. The program should continue until he selects the option to
exit the program.

Q.12. a) Write a program read a number N. Now print a multiplication table of a number N, also print
all prime numbers between 1 to N.
b) To find and display HCF and LCM of two user entered integer numbers.

Q13. Write a program to find the sum of first n terms of the following series:
i) 1+ x -
! 2
2
x
+
! 3
3
x
- . . .
ii) 1+(1+2)+(1+2+3)+(1+2+3+4)+(1+2+3+4+5)+------ n terms


Q.14 Write a program in C++ to display the following series
(Fibonacci series- Each new term is sum of previous two digits)
1 1 2 3 5 8 .....................upto N terms .
Also find sum of N terms of the above series.

Q15. WAP to display the Armstrong numbers between 1 and 500 .
[Armstrong numbers are those numbers for which sum of cubes of each digits is equal to number eg
153=1
3
+5
3
+3
3
]
Q16. Write code to find if a pair of numbers are amicable.
Hint : a pair of numbers are amicable if the sum of the factors of one number (excluding itself) is
equal to the second number and vice-versa. eg 220 and 284 OR 2620 and 2924

Q.17. Write a program to create the following output if number of lines to be printed is given by user.


E.g.: Number of lines: 5

Output should be:




Q.18 a) Write a program to count and print
vowels, white spaces and words in a user entered string.
b) Write a program to accept full name in a string and print only the initials.
eg Enter name: Mohan Das Karam Chand Gandhi
Output string M D K C Gandhi.

Q.19 Write a menu driven program to read an array of integers and do the following. Use user
defined functions.
a) To find and display three highest and three lowest numbers
b) Apply binary search algorithm to search for a given number.
c) Sort the array elements in ascending or descending order as per the choice of
the user.
d) To find prime number in that array and store them in different array.
e) Insert/delete a number at/from a desired location by shifting rest of the numbers if
rquired.
f) Rearrange the array such that each half of the array is reversed.


Q.20. Write a menu driven program for the following.
Given a square matrix of order n. The maximum possible for n is 20. Input n and input possible values
in matrix. Write functions to:
i) Display the original matrix.
ii) Display the row and column position of the largest element of array.
iii) Display the row and column position of the second largest element of array
iv) To find the number of negative elements.
v) To find sum of diagonal elements.
vi) To display elements above or below the diagonal as per the users wish.

Q21 Using User Defined Functions, do the following:
a) Write a program which determines the least number out of four numbers a,b,c,d with the help of
function small( ).
b) Compute the binomial coefficient
n
C
r
for positive integers n and r where n is greater than r.
binomial coefficient
n
C
r
= n!
--------------
r! * (n-r) !
Q.22 Write a menu driven program for the following using UDF.
Read names of ten students in 2D character array names[10][20] and perform the following
operations on it.
a) Read and Display the list
1
121
12321
1234321
123454321


b) Reverse the list (Each name in the list should be reversed)
c) Sort the list alphabetically
d) find and display those names which are palindrome.

Q.23 Write a menu driven program for the following.
Declare a structure which contains fields: Acc_no, Name, Balance_amt, Amount_to_deposit,
amount_to_withdraw
Write a c++ program using functions to:
i) read details of 5 bank holders [only Acc_no, Name, Balance_amt ]
ii) print the details of those consumers who has balance>30000/-
iii) Deposit desired amount and print the updated balance_amt
iv) Withdraw desired amount and print the updated balance_amt
Ensure the balance_amt should not be lesser than 5000/-



Q 24. Create a structure Date having three integer data items to represent date, month
and year. Write suitable functions to :
(a) Read date and validate it.
(c) Set the ordinal suffix st, nd, th or rd .
(d) Using above function display date in the following format eg. 22/7/2010 should be
displayed as 22nd July, 2010 with suitable suffix on date as th, rd etc using above
function.
(e) Compare two dates D1& D2, and return to -1, 0, 1. It returns to -1, if D1 is earlier than
D2, returns to 0 when D1 and D2 are same and returns to 1 when D1 is later than D2.
Create a menu driven program to simulate all these operations.

Q 25. Data can be represented in memory in different ways Binary, Decimal, Octal, Hexadecimal.
Input number preceded by B,D,O,H to represent its type. Write a program using UDF to perform the
conversions.

Vous aimerez peut-être aussi