0% found this document useful (0 votes)
2 views

Computer class 12 isc programs

The document outlines a series of programming tasks that include converting binary to decimal and vice versa, formatting sentences, sorting words by length, and toggling letter cases. It specifies input and output formats for each task, along with examples for clarity. Additionally, it describes class structures and methods for sorting and toggling words in Java.

Uploaded by

anushka.bhosale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Computer class 12 isc programs

The document outlines a series of programming tasks that include converting binary to decimal and vice versa, formatting sentences, sorting words by length, and toggling letter cases. It specifies input and output formats for each task, along with examples for clarity. Additionally, it describes class structures and methods for sorting and toggling words in Java.

Uploaded by

anushka.bhosale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Write a menu driven program to perform the given tasks as per the user's choice:

(i) To accept a binary number (base 2) and convert it into its decimal equivalent (base 10)
Sample Input: (110011),
Sample Output: (51),0
(ii) to input a decimal number (base 10) and convert it into its binary equivalent.
Sanple Iuput:
Enter a number: (35),0
The binary equivalent = (100011),
IWrite a progTam to dccept a sentence which nay be
0ords are to be separated by a single blank space. terminated by eitheror ? only. The
terminate
with "'or'?. You can assume that Print an error message if the input does not
n0 word in the
that you get a proper formatted output. sentence exceeds 15 characters,
Perform the following tasks:
() Convert the first letter of each word to
) Eind the number of vowels and uppercase.
headings along with the words.
consonants in each word and display them with
proper
Test your program wnth the following inputs.
Example 1:
[ISC 2015]
Input: Intelligence plus character is education.
Output:
Intelligence Plus Character Is Education.
Word Vowels Consonants
Intelligence 5
7
Plus
3
Character 3 6
Is
1
Education 5 4
Example 2:
Input: God is great.
Output:
God Is Great.
Word Vowels Consonants
God 1 2
Is 1 1
Great 2 3

Example 3:
Input: All the best!
Output:
Invalid Input
Write a progran which takes a string (maximum 80 characters) terminated by a full stop.
The words in this string are assumed to be separated by one or more blanks.
Arrange the words of the input string inthe descending order of their lengths.
Words having the sane length should be sorted alphabetically. Each word must start with an
uppercase letter and the sentence should be terminated by a full stop.
Test your program for the follocving data and also some random data.
Sample Data:
Input:
This is hunan resoturce departnent.
Output:
Department Resource Hunnan This Is.
Input: head and to handle others use your
heart.
To handle yourself use
USe your
Output: Others Heart Head Your Your And Use Use To To.
Yourself Handle Handle
Write a program in Java to store the numbers in a 4 x 4 matrix in Double Dimensional
Array. Arrange the numbers of each row in ascending order and display the result.
Sample Input Sample Output
22 14 23 25 14 22 23 25
81 26 31 10 10 26 31 81
58 64 17 12 12 17 58 64
55 33 26 14 14 26 33 55
Write a program to accept a string and pass it to a method void Replace( String wd). The method
further replaces each letter by the next letter in opposite case. The conversion follows round
robin system (i.e., Zfollows 'a' and 'z' follows A).
For exanmple;
Sample Input: Abz
Sample COutput: bCA
Aclass Sorter contains an array of 100 integers. Some of the member functions/methods of
Sorter are given below:
Class name : Sorter
Data memberslinstance variables : Any array of 100 integers
Member functionslmethods
Sorter( ) : Constructor
void readlist() : To input 100 integers.
void displaylist() : To display the list of sorted integers.
int indexofmin(int startindex) : Returns the index/subscript of the smallest integer
in the array, between the start index and the last
index.
void selectionsort() : Sorts the array in ascending order using the selection
sort techique.
class Sorter giving the details of the constructor and the functions void displaylist(),
Specify the You may assume that the other functions
startindex), void selectionsort( ).
int indexofmin(int the main( ) function.
for you. You do not need to write
are written
Desigu a class Toggle which toggles a word by converting all uppercase letters to lovercase
letters and vice-versa.
Exanple: The word "mOTivATe" becomes "MotIVatE "
The details of the members of the class are given below:
Class name : Toggle
Data mnemberslinstance variables:
str stores a word
newstr :stores the toggled word
len : to store the length of the word
Methods/Member functions:
Toggle( ) : default constructor
void readword( ) : to accept the wvord
void toggle( ) : converts the uppercase letters to lowercase letters and vice
versa. Finally, the converted word is stored in newstr
void display ) :displays the orignal word along with the toggled word
readword( ), void toggle( )
Specify the class Toggle giving details of the constructor, void
and void display ). and call the functions accordingly to enable
Define the main( ) function to create an object
the task.

You might also like