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

Class 12 UNIT TEST 1 Computer Science

Uploaded by

riyonsutradhar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Class 12 UNIT TEST 1 Computer Science

Uploaded by

riyonsutradhar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

DON BOSCO SCHOOL OODLABARI

COMPUTER SCIENCE
UNIT TEST 1 FM: 30
CLASS XII
Questions1 : Design a class Coding to perform some string related operations on a word
containing alphabets only.
Example Input: Java
Output : Original word: Java
J=74
a=97
v=118
a=97
Lowest ASCII code: 74
Highest ASCII code: 118
Some of the members of the class are given below.
Class name: Coding
Data members/Instance variables :
wrd : to store the word
len : to store the length of the word
Methods/ Member functions :
Coding() : constructor to initialize the data members
void accept () : to accept the word
void find () : to display all the characters of wrd along with their ASCII code . Also display the
lowest and the highest ASCII code in wrd.
void show(): to display the original word and all the characters of the wrd along with their
ASCII code . Also find the lowest and the highest ASCII code in wrd by invoking the function
find().

Questions 2: Design a class findfreq to accept a sentence and to perform some string
related operations on the sentence.
Example Input: APPLE LIVE
Output :
CHARACTERS FREQUENCY
A 1
E 2
I 1
L 2
P 2
V 1
Some of the members of the class are given below.
Class name: findfreq
Data members/Instance variables :
int freq : to store the frequency of each Characters
String sen : to store the sentence from the user
Methods/ Member functions :
findfreq() : constructor to initialize the data members
void getsen() : to accept the sentence
void findit ( ) : to find the frequency of each characters present .
void print(): to display the characters present in the sentence along with the frequency of
each characters as example given above.

Questions 3: Design a class Mixmax to accept two words and to perform some string
related operations on both the words.
Example Input:
WORD 1 : TOP
WORD 2: CLASS
Output : TCOLPASS

Some of the members of the class are given below.


Class name: Mixmax
Data members/Instance variables :
wrd1 : to store the first word
wrd2: to store the second word
newwrd : to store the mixed word
Methods/ Member functions :
Mixmax (String s , String p ) : constructor to initialize the data members with the formal
parameters
void mix( ) : to mix the characters of both the words as per the example provided.
void display(): to display the original words along with the new word as per the example
provided.

You might also like