RANI Icse Practicals
RANI Icse Practicals
Note: The Date for the practical will be announced on the notice board by
January 26, 2014.
Questions for the practical will be given from the given question set ONLY
1 Write a program to accept 25 names from the user and print them in alphabetical
order. For example:
Input : Danish, Salman, Amir, Hritik, Madhuri
Output: Amir Danish Hritik Madhuri Salman
2 Write a program to accept roll number and marks in English from 10 students from the
user and print them in descending order of marks.
3 Write a program to accept a string from the user and print the following
(a) Number of characters
(b) Number of words in the string
(c) Count the number of words begin with capital letter
(d) Count how many times an input word is repeated in the string
5 Write a program to accept a telephone number, name of the customer and number of
calls from the user and print the telephone bill based on the following conditions.
6 The bill calculation in the above program should be done in a function called calculation
and return the value to the main program. The main program should print the final bill.
8 Write a program to input a number from the user and using a function called
Palindrome(), check and print whether the number is a palindrome number or not.(A
number is read same from both the sides is called palindrome number. E.g. 121, 454,
12321, 565…etc.)
9 Write a program to input a number from the user and using a returned type function
called Perfect( ), check and print whether the number is a perfect number or not. The
function returns true if the number is perfect otherwise false. (perfect number is a number
whose sum of the factors(except the original number) of the number is equal to the same
number. E.g.: 6: factors of 6: 1,2,3: sum = 1+2+3 = 6)
11 Using switch case write a program to accept a number from the used and print in the
output in the following format.
Example:
Input: 742
Output: seven four two
14 Code number and cost and name of 10 products are given as follows
Code:101,102,103,104,105,106,107,108, 109, 110
Cost:25.50,45.00,300.50,75.25,90.00,99.99,65.50,70.00,99.99,100.00
Name of product: pepsi, coke, water, …….10 names
Write a Program to input code number of a product and print corresponding cost using binary
search.
15 A game of throwing dice is played between two players in which, each player throws a
dice unless his score adds up to 20. A player is declared “winner” with the minimum number
of throws. Write a program to perform the given task.
16 Write a program to input a string from the user and print it as given in the example:
18 Write a program to Input a string from the user in the mixed case letters and print it in
title case letters.
e.g.: Input: hello hOW aRe yOu?
Output: Hello How Are You?
19 Write a program to input a string from the user and print frequency of alphabets, digits
and special characters in the string
20 Write a program to input name of country from the user and print the capital of that
country on the screen from the given set of data. If the input name of country is not present in
the list then print appropriate message.
Country Capital
21 Write a program to input weight of a parcel and print cost of parcel based on the
following conditions
23 Create a class called BEST with the following data members and its member functions.
Data Members: Name of the customer, telephone number, number of calls, tax and the bill
Member functions:
Accept( ) : The function is used to input Name of the customer, telephone number and
number of calls from the user.
Billing ( ): The function calculates the bill amount based on the following conditions.
Main( ): Create an object of the class and execute all the functions in logical sequence for
250 customers .
24 2
34
456
5678
6 7 8 9 10
25 Encryptology is the process of encoding a string to another form in such a way that it should
not be known to unauthorized person. You are to encode a program in java by using a class
to encrypt a string in such a way that each character of the given string is replaced with a
character at mentioned gap (say, move). If move is positive then the characters are replaced
by other characters ahead by given move. For a negative move, the characters are replaced
by other characters backward. In case move is 0 then the same string is produced.
You must keep in your mind that the characters are wrapped around while encryption i.e. Z
is followed by A and A is followed by Z considering the moves to be negative and positive
respectively.
e.g., ABZ can be encrypted as CDB if move = 2
ABZ can be encrypted as YZX if move = -2
ABZ can be encrypted as ABZ if move = 0
Class : Encode
Data members/Instant variables :
String s, str
Member methods :
void input( ) : To assign string st to s. Initialize String str = “”;
void perform (int move): To perform encryption at defined move.
void display( )To display the encrypted string.
*****************