Read the questions as text
ISC Class 12 Sample Paper 9
Standard: 12
Subject: Computer
Max Marks: 100
Max. Time 3 hours
-----------------------------------------------------------------------------------------------------------------
Answer all questions in Part I (compulsory) and seven questions from Part-II, choosing three questions
from Section-A, two from Section-B and two from Section-C.
All working, including rough work, should be done on the same sheet as the
rest of the answer.
The intended marks for questions or parts of questions are given in brackets [ ].
-----------------------------------------------------------------------------------------------------------------------
PART I
Answer all questions
Question 1
[1X5=5]
(a) Simplify the following boolean expression using law of algebra x.y.(x.y)+y.z
(b) Prove that (x.y)’=x’+y’ using truth table
(c) Convert the following sum of product expression into its corresponding POS
F(A,B,C)=A’.B’.C’+A’.B’.C+A’.B.C+A.B’.C
(d) Find the compliment of :F(A,B,C,D)=[A+{(B+C).(B’+D’)}]
(e) Draw the logic gate diagram and the truth table XOR Gate
Question 2
(a) Name the Universal gates ,Explain with truth table And Diagram
[2]
(b) State the difference between Stack and Queue.
[2]
(c) Convert the following infix notation to its postfix form.
E*(F/(G-H)*I)+J
[2]
(d) What is function overloading?
[2]
(e) What is meant by access modifier, define it.
[2]
Question 3
State the final value of q at the end of following program segment
int m, n,p,q=0;
for(m=2;m<=3;++m){
for(n=1;n<=m;++n){
p=m+n-1;
if(p%3==0)
q+=p;
else
q+=p+4;
}}
[5]
PART II
Attempt seven questions, choosing two questions from Section-A, two from Section-B and Section-C
Section A
Question 4
(a) Give the Boolean function F(A,B,C,D)= Σ(0,1,2,3,5,7,9,13) used K-map to reduce it in SOP
form, draw logic gate diagram from the reduced from expression
[5]
(b) Now given X(A,B,C,D)=π (0,2,6,8,10,14) do the same for this Boolean expression [5]
Question 5
(a) How is an XOR gate different from an OR gate , draw a truth table representing a 2 input XOR
expression , derive its SOP expression & draw the logic gate diagram
[6]
(b) State a difference between a multiplexer and decoder.
[2]
(c) State how a binary tree is a recursive data structure.
[2]
Question 6
(a) Draw the logic gate diagram to implement the following by using NOR gates only. Show the
output at each stage
1. AND 2. OR.
[4]
(b) State the principal of Duality, give example
[3]
(c) What do LIFO and FIFO stand for? Name a data structure that follows LIFO principle and one
that follows FIFO.
[2]
Section B
Question 7
NIC institute resource manager has decided to network the computer resources like printer, storage,
etc, so that minimum resources & max sharing could be avail. Accordingly printers are linked to
centralized system& the printing jobs are done on a “FIFO”(first cum first served ) served bases
only. In order to avoid collision , the restriction is that no more than 2 printing jobs can be added
Define a class printJob with the following details
[10]
Class name Data members Job[] NewJob Capacity Front Rear Member function PrintJob()
Void createJob() Void AddJob()
Void removeJob()
printJob
Array of integers to hold printing jobs To add new printing job inside array The max capacity of the integer array Point index of front Point index of last
constructor to assign values to data members capacity=20,front=rear=-1 & call function createJob() To create an array to hold the printing jobs Adds the new printing job to the end of the last array, if possible print “jobs full” when more than 2 jobs are added Remove the printing job from front, if the array is not empty, otherwise prints “Vancy”
Question 8 A special number is a number in which the sum of the factorial of each digit is equal to the number itself 145= 1!+4!+5!
=1+24+120
Design a class special to check if a given number is a special number. Some of the members of a class are given below
[10]
Class name Data members N Member functions Special() Special(int) Void sum() Void isSpecial()
Special
Integer
Constructor to assign 0 to n Parameterized constructor to assign a value to n Calculate and display the sum of the first and last digit of n Check & display if the number n is special number
Question 9
A class collection contains an array of 100 integers, using the following class description create an
array withn elements .some of the members of the class are given below
[10]
Class name
Collection
Data members
Arr[]
No. of people visited the booth
Len
Total amount of money collected
Member functions
collection()
Default constructor
collection(int)
Parameterized constructor to assign the length of array
Void inparr()
To accept the array elements
Void disp()
To display the sorted elements
Void sort_arr()
To sort the array with any sorting algorithm
Section C
Question 10
A class Employee contains employee details and another class salary calculates the employee’s net
salary. The details of 2 classes are given below
[5]
Class Name
Salary
Data members
Basic
double variable to store basic pay
Name
String variable to store name of employee
Designation
String variable to store designation
Member function
Salary(…)
Constructor to assign initial values
Void calc()
Calculate the employees net salary according to following rules
DA=10%of basic
HRA=15%of basic
Salary= basic+DA+HRA
PF=8%of salary
Netsal= salary-PF
Display employee details and net salary through main class.
Question 11
A class hifact has been define to find the HCF of two numbers using the recursive technique. This HCF is used to find the LCM of the two numbers. Some members of class are given below [5]
Class name Data members A,b,hcf,lcm Member functions HiFact() Void getdata() Void change() Int reacHCF(int,int) Int fn_Lcm(int,int,int) Void result()
Question 12
HiFact
Integers
Constructor to assign initial values To input values of a&b To swap a&b if a>b To find HCF using recursive technique To find LCM using a,b,HCF To to call reacHCF(),fm_LCM() & print LCM,HCF of the two members a&b
[5]
(a) A Linked List is formed from the objects of the class,
[2]
Class Node
{
int num;
Node next;
}
Write the algorithm OR a method for inserting a node in the end of the list.
The method declaration is given below :
void insertnode(Node start)
(c) List the nodes in the tree given below using:
[3]
(i) Preorder Traversal
(ii) Root of the tree (iii) External nodes of the tree
――――――――――
ISC Class 12 Sample Paper 10
Standard: 12
Subject: Computer
Max Marks: 100
Max. Time 3 hours
-----------------------------------------------------------------------------------------------------------------
Answer all questions in Part I (compulsory) and seven questions from Part-II, choosing two questions from
Section-A, two from Section-B and two from Section-C.
All working, including rough work, should be done on the same sheet as the rest of the
answer.
The intended marks for questions or parts of questions are given in brackets [ ].
-----------------------------------------------------------------------------------------------------------------------
PART I
Answer all questions
Question1:
a) Convert the following sum of product expression into its corresponding POS
[1]
F(A,B,C)=A’.B’.C’+A’.B’.C+A’.B.C+A.B’.C
b) Show that AB+(AC)’+AB’C(AB+C) is always 1.
[1]
c) Simplify expression AB’CD’+AB’CD+ABCD’+ABCD
[1]
d) Convert the following into canonical SOP form (X’Y)’.(X’Z’)’
[1]
e) Find the complement of,F(A,B,C,D)=(A+((B+C).(B’+D’)))
[1]
Question 2:
a) Draw the logic gate diagram and truth table for XOR gate.
[2]
b) Name the Universal gates ,Explain with truth table And Diagram
[2]
c) Prove that (x.y)’=x’+y’ using truth table
[2]
d) State the two idempotent laws of Boolean algebra. Verify any one.
[2]
e) Draw the logic gate diagram for the following function using NOR gates only.
[2]
F(A,B,C)=A’B+AB’+C
Question 3
[5]
The following function comb() and combi() are a part of some class. Give the output when the combi() is called.
Show the dry run/working.
void combi()
{
for(int i=0; i<5; i++)
{
for(int j=0;j<i+1; j++)
System.out.print(“ “+comb(i,j));
System.out.println();
}
}
long comb(int n, int k)
{
long c=1;
for(int i=1;i<=k;i++,n--)
c=c*n/i;
return c;
}
PART II
Attempt any two questions from Section-A, two from Section-B and two from Section-C
Section A
Question 4
(a) Given the Boolean function:
[5]
F ( P, Q, R, S ) = ∑ ( 0, 1, 3, 4, 5, 6, 7, 9, 10, 11, 13, 15 ) Use Karnaugh’s map to reduce the function F, using the SOP form. Draw a logic gate diagram for the reduced SOP form. You may use gates with more than two inputs. Assume that the variable and their complements are available as inputs.
(b) Given G(A,B,C,D)= (A+B+C+D) (A+B+C+D’) (A+B+C’+D’) (A+B+C’+D) (A+B’+C+D’) (A+B’+C’+D’) (A’+B+C+D) (A’+B+C’+D)
i) Reduce the above expression by using 4 variable Karnaugh map, showing the various groups (i.e.octal, quads
and pairs).
[4]
ii) Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are
available as inputs.
[1]
Question 5.
(a) What is Full adder? Write the SOP expressions for sum and carry. Simplify the expressions algebraically using
Boolean algebra.
[5]
(b) Draw the truth table and logic circuit diagram for a Hexadecimal to Binary encoder.
[5]
Question 6.
(a) Write the equivalent Boolean expression for the propositions F=X→Y and F=X↔Y.
[2]
(b) Reduce the following Boolean expressions to the simplest form:
[3]
A.[B+C.(A.B+A.C)’]
(c) Draw the truth table and logic circuit diagram for a 3x8 decoder. What is the difference between a
multiplexer and a decoder?
[5]
Section B
Answer two questions
Each program should be written in such a way that it clearly depicts the logic of the problem. This can be achieved by
using mnemonic names and comments in the program. (Flowcharts and algorithms are not required)
The programs must be written in Java.
Question 7.
[10]
In a class VowelWord to accept sentence and calculate the frequency of words that begin with a vowel. The
words in the input string are separated by a single blank space and terminated by a full stop. The description
of the class is given below:
Class name
VowelWord
Data members
str
to store the sentence
freq
store the frequency of the words beginning with a vowel
Member functions
VowelWord()
constructor to initialize data members to legal initial value.
void readstr()
to accept a sentence
void freqvowel()
counts the frequency of the words that begin with a vowel
void display()
to display the original string and the frequency of the words
that begin with a vowel.
Specify the class VowelWord giving details of the constructors and all the functions. Also write the main function
Question 8.
[10]
A class RecFact defines a recursive function to find the factorial of a number.
The details of the class are given below:
Class name
:
RecFact
Data members/instance variables
n r Member functions RecFact( ) void readnum( )
int factorial(int) void factseries()
:
stores the number whose factorial is required
:
stores an integer
:
default constructor
: to enter values for ‘n’ and ‘r’ : returns the factorial of the number using the recursive technique.
: to calculate and display the value of
n!+(r-2)! ( n − r)!
Specify the class RecFact giving the details of the constructor and member functions void readnum( ), int factorial(int) and void factseries( ). Also define the main function to create an object and call methods accordingly to enable the task.
Question 9.
[10]
A perfect square is an integer which is the square of another integer. For example, 4, 9,16 are perfect squares. Design a Class Perfect with the following description:
Class name Data members/instance variables N Member functions: Perfect( ) Perfect(int)
void perfect_sq()
void sum_of()
Perfect
stores an integer number
default constructor parameterized constructor to assign a value to ‘n'.
to display the first 5 perfect squares larger
than ‘n’ (if n = 15, the next 3 perfect squares
are 16, 25, 36)
to display all combinations of
consecutive integers whose sum is
equal to n. ( the number n = 15 can be
expressed as
1
2
3
4
5
4
5
6
7
8
Specify the class Perfect giving details of the constructors, void perfect_sq( ) and void sum_of(). Also define the main function to create an object and call methods accordingly to enable the task.
Section C Answer any two questions
Each program should be written in such a way that it clearly depicts the logic of the problem step wise.This can also be achieved by using comments in the program and mnemonic names or pseudo codes for algorithms. The program must be written in Java and the algorithms must be written in general/standard form, wherever required/ specified. (Flowcharts are not required.)
Question 10.
[5]
A class OctaDeci has been defined to convert an Octal number into its equivalent Decimal number. Some of the
members of the class are given below:
Class name
:
OctaDeci
Data members
:
dec
:
integer to store decimal number.
N
:
integer octal to be converted to its decimal form.
Member functions
:
OctaDeci()
:
constructor to assign initial value to the data members.
void getOctal() :
to accept Octal integer N.
void recursiveDec(int): to find the decimal equivalent of the octal number stored in N and store
in dec using Recursive Technique.
void putdata()
:
to display the octal number ‘N’ and its decimal equivalent.
Specify the class OctaDeci giving details of constructor and functions. You do not need to write the main function.
Question 11.
[5]
A class Revstr defines a recursive function to reverse a string and check whether it is a palindrome. The details of the class are given below:
Class name : Revstr
Data members Str : stores the string.
Revst : stores the reverse of the string.
Member functions void getStr() : to accept the string.
void recReverse(int) : to reverse the string using recursive technique.
void check() : to display the original string, its reverse and whether the string is a palindrome or not.
Specify the class Revstr giving details of the functions void getStr(), void recReverse(int) and void check(). The main function need not be written.
Question 12.
[5]
Draw a truth table with a three input combination which outputs 1 if there are odd number of 0’s. Also derive an SOP expression using K map.
――――――――――
ISC Class 12 Sample Paper 11
Standard: 12
Subject: Computer
Max Marks: 100
Max. Time 3 hours
-----------------------------------------------------------------------------------------------------------------
Answer all questions in Part I (compulsory) and seven questions from Part-II, choosing three questions
from Section-A, two from Section-B and two from Section-C.
All working, including rough work, should be done on the same sheet as the
rest of the answer.
The intended marks for questions or parts of questions are given in brackets [ ].
-----------------------------------------------------------------------------------------------------------------------
PART I
Answer all questions
Question 1
(a) Simplify the following boolean expression using law of algebra
[2]
x.y.(x.y)+y.z
(b) Prove that (x.y)’=x’+y’ using truth table
[2]
(c) Convert the following sum of product expression into its corresponding POS
F(O,V,W)=O’.V’.W’+O’.V’.W+O’.V.W+O.V’.W
[2]
(d) Find the compliment of :F(A,B,C,D)=[A+{(B+C).(B’+D’)}]
[2]
(e) Draw the logic gate diagram and the truth table XOR Gate
[2]
Question 2
(a) Name the Universal gates ,Explain with truth table And Diagram
[2]
(b) State the difference between Stack and Queue.
[2]
(c) Each element of an array X[5][20] requires 1 byte of storage. If the array is stored in column
major order with the beginning location 1500, determine the location of X[2][10]
[2]
(d) What is function overloading?
[2]
(e) What is meant by access modifier, define it.
[2]
Question 3 (a) In the following, function strange is part of some class. Assume that arguments x & y are greater than 0, when the function is invoke, show the dry run int strange(int x, int y){ if(x>=y){ x=x-y; return strange(x,y); } else{ return x;}}
i. What will the function strange (20,5)return
[2]
ii. What will the function strange (15,6)return
[2]
iii. In one line state what the function strange()… is doing
[1]
(b) State the final value of q at the end of following program segment
int m,n,p,q=0;
for(m=2;m<=3;++m){
for(n=1;n<=m;++n){
p=m+n-1;
if(p%3==0)
q+=p;
else
q+=p+4;
}}
[5]
PART II
Attempt seven questions, choosing three questions from Section-A, two from Section-B and Section-C
Section A
Question 4
(a) Give the Boolean function F(A,B,C,D)= Σ(5,6,7,8,9,10,14) used K-map to reduce it in SOP
form, draw logic gate diagram from the reduced from expression
[5]
(b) Now given X(A,B,C,D)= π (0,2,6,8,10,14) do the same for this Boolean expression [5]
Question 5
The immigration rules of a country allow the issue of work – cum—stay permits to an applicant only if the applicant satisfies any one of the following conditions
• The spouse of the applicant is a permanent recident of that country, having lived there for atleast 5 yrs
OR
• The applicant possesses certain special skills as specified if the “Skill requirement list” of the
country and is sponsored by the permanent resident of that country
The inputs are
A:the spouse or sponcer has permanent resident status
B: the spouse has lived in the country for 5 or more yrs
C: the applicant possess the required special skills
D:sponsorship by permanent resident
(a) Draw the truth tables of the inputs and outputs given above and right SOP expression for
X(A,B,C,D)
[5]
(b) Reduce X(A,B,C,D) using K-Map, draw the logic gate diagram for the reduced SOP
expression for X(A,B,C,D) using AND & OR gates
[5]
Question 6
(a) How is an XOR gate different from an OR gate , draw a truth table representing a 2 input XOR
expression , derive its SOP expression & draw the logic gate diagram
[6]
(b) What is the purpose of multiplexer , mention any two application of it?
[2]
(c) Draw the logic gate diagram for the following 3 input function F(X,Y,Z) using NOR gate only
F(X,Y,Z)= Σ(0,1,3,4)
[2]
Question 7
(a) Reduce the following expression using the law of Boolean algebra, draw the logic gate diagram
for the simplified expression F=A.(A’+B).C.(A+C)
[5]
(b) State the principal of Duality, give example
[3]
(c) Convert A.B+B.C’ to its conical SOP from using algebra
[2]
Question 8
(a) Draw the truth table & logic circuit diagram for 3X8 decoder, state the difference between
multiplexer & decoder
[5]
(b) Reduce the following Boolean expression to the simplest form A.[B+C.(A.B+A.C’)] [3]
(c) Given :F(X,Y,Z)= Σ (1,3,7)prove F(X,Y,Z)= π(0,2,4,5,6)
[2]
Section B
Question 9
NIC institute resource manager has decided to nerwork the computer resources like printer, storage,
etc, so that minimum resources & max sharing could be availd. Accordingly printers are linked to
centralized system& the printing jobs are done on a “FIFO”(first cum first served ) served bases
only. In order to avoid collision , the restriction is that no more than 2 printing jobs can be added
Define a class printJob with the following details
[10]
Class name
printJob
Data members
Job[]
Array of integers to hold printing jobs
NewJob
To add new printing job inside array
Capacity
The max capacity of the integer array
Front
Point index of front
Rear
Point index of last
Member function
PrintJob()
constructor to assign values to data members
capacity=20,front=rear=-1 & call function
createJob()
Void createJob()
To create an array to hold the printing jobs
Void AddJob()
Adds the new printing job to the end of the last
array, if possible print “jobs full” when more
than 2 jobs are added
Void removeJob()
Remove the printing job from front, if the array
is not empty, otherwise prints “Vancy”
Question 10
A special number is a number in which the sum of the factorial of each digit is equal to the number
itself
145= 1!+4!+5!
=1+24+120
Design a class special to check if a given number is a special number. Some of the members of a
class are given below
[10]
Class name
Special
Data members
N
Integer
Member functions
Special()
Constructor to assign 0 to n
Special(int)
Parameterized constructor to assign a value to n
Void sum()
Calculate and display the sum of the first and
Void isSpecial()
last digit of n Check & display if the number n is special number
Question 11
A class collection contains an array of 100 integers, using the following class description create an
array with n elements .some of the members of the class are given below
[10]
Class name
Collection
Data members
Arr[]
No. of people visited the booth
Len
Total amount of money collected
Member functions
collection()
Default constructor
collection(int)
Parameterized constructor to assign the length of
array
Void inparr()
To accept the array elements
Void disp ()
To display the sorted elements
Void sort_arr()
To sort the array with any sorting algorithm
Section C
Question 12
A class Employee contains employee details and another class salary calculates the employee’s net
salary. The details of 2 classes are given below
[10]
Class Name
Salary
Data members
Basic
double variable to store basic pay
Name
String variable to store name of employee
Designation
String variable to store designation
Member function
Salary(…)
Constructor to assign initial values
Void calc()
Calculate the employees net salary according to
following rules
DA=10%of basic
HRA=15%of basic
Salary= basic+DA+HRA
PF=8%of salary
Netsal= salary-PF
Display employee details and net salary through main class.
Question 13
A class revstr defines a recursive function to reverse a string and check whether it is a palindrome
the details of the class are given below
[10]
Class name
Revstr
Data members
Str Revst Member functions Void getstr() Void rec_reverse(int) Void check()
Stores the string Stores the reverse of the string
To input string To reverse the string using the recursive techenic To display the original string , its reverse & weather the string is a palindrome or not
Question 14
Design a class modify has been defined with the following details
[10]
Class name
Modify
Data members
St,len
To store the string, & length of string
Member functions
Void read()
To accept the string in uppercase alphabets
Void putin(int,char)
To insert a character at the specified position in
the string & display the change string
Void takeout(int)
To remove a character from specified position in
the string & display
Void change()
To replace each character in the original string
by the character which is at a distance 2 moves
ahead. For ex “ABCD” becomes “CDEF”
――――――――――
ISC Class 12 Sample Paper 12
Standard: 12 Max Marks: 100
Subject: Computer Max. Time 3 hours
-----------------------------------------------------------------------------------------------------------------
Answer all questions in Part I (compulsory) and six questions from Part-II, choosing two questions from Section-A, two from Section-B and two from Section-C.
All working, including rough work, should be done on the same sheet as the rest of the answer. The intended marks for questions or parts of questions are given in brackets [ ].
-----------------------------------------------------------------------------------------------------------------------
PART I
Question1
Answer all questions
a) Draw the truth table to prove the proportional logic expression.
[1]
a<=>b = (a => b) . (b => a)
b) Determine if following wff is valid, satisfiable or unsatisfiable:
[1]
(p -> q) => [~q -> (~p ^ ~q)]
c) Differentiate between a tautology and a contradiction.
[1]
d) Convert the following expression F(X,Y,Z) = XY+Y’Z into minterms.
[1]
e) Minimize F = AB + (AC)’ +AB’C using Boolean laws.
[1]
Question 2
a) Each element of an array A [-15….. 20, 20….. 45] requires 4 bytes for storage.
[2]
Find the address of A [30][20] if the base address is 1000, in RowMajorWise
b) State the different applications of stack.
c) Convert the following infix notation to its postfix form:
[2]
(A + ( B * C )) / ( C – ( D * B ))
d) Prove that (x.y)’=x’+y’ using truth table
[2]
e) State the two idempotent laws of Boolean algebra. Verify any one.
[2]
Question 3
[5]
Give output of the following function where x and y are arguments greater than 0.
Show the dry run/working.
void confusing ( int x, int y )
{
if ( x > 1 ) // base case
{
if ( x % y = = 0 )
{ System.out.print( y + " " );
confusing ( x / y, y);
} // end of inner if else confusing ( x , y+1); } //end of outer if } (i) What will the function confusing (24 , 2) return ? (ii) What will the function confusing (84 , 2) return ?
PART II
Attempt any two questions from Section-A, two from Section-B and two from Section-C
Section A
Question 4
(a) Given the Boolean function:
[5]
F ( P, Q, R, S ) = π ( 0, 1,2, 3, 5, 7, 8,9, 10, 11 ) Use Karnaugh’s map to reduce the function F, using the SOP form. Draw a logic gate diagram for the reduced SOP form. You may use gates with more than two inputs. Assume that the variable and their complements are available as inputs.
(b) Given G(A,B,C,D)= ABC’D’+A’BC’D’+A’BC’D+ABC’D+A’BCD+ABCD
i) Reduce the above expression by using 4 variable Karnaugh map, showing the various groups (i.e.octal, quads
and pairs).
[4]
ii) Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are
available as inputs.
[1]
Question 5.
(a) What is a multiplexer? Draw the circuit and the truth table of 8 to 1 multiplexer.
[5]
(b) Draw the truth table and logic circuit diagram for an Octal to Binary encoder.
[5]
Question 6.
a) How is a half adder different from full adder? Draw the truth table and derive the sum and carry expression
for a full adder. Also, draw the logic diagram for a full adder.
[4]
b) State whether the following expression is a Tautology, contradiction or a contingency, with the help of a truth
table(X→Z) ˅ ~[(X→Y) ^ (Y→Z)].
[3]
c) Draw the truth table and logic circuit diagram for a 3x8 decoder.
[3]
Section B
Answer two questions
Each program should be written in such a way that it clearly depicts the logic of the problem. This can be achieved by
using mnemonic names and comments in the program. (Flowcharts and algorithms are not required)
The programs must be written in Java.
Question 7.
[10]
Design a class Alpha which enables a word to be arranged in ascending order according to its alphabets. The details of the members of the class are given below :
Class name Data members /instance variables: Str
Member functions : Alpha( ) void readword( ) void arrange ( )
void disp()
: Alpha
: to store a word
: default constructor : to accept the inputted word : to arrange the letter in alphabetical order using any Standard sorting technique. : Displays the word.
Specify the class Alpha giving details of the constructor and the member functions void readword( ), void arrange( ), void disp ( ) and defining the main ( ) function to create an object and call the function in order to execute the class by displaying the original word and the changed word with proper message.
Question 8.
[10]
Design a class Palindrome which enables a word to be arranged in ascending order according to its alphabets and also
finds the frequency of each alphabets present in the word. The details of the members of the class are given below:
Class name : Palindrome
Data members/instance variables :
str
: to store a word
revword
: to store the reverse of the word
Member functions/methods :
Palindrome( ) : constructor to initialize data members with initial values
void readWord( ) : to accept the inputted word
String rev( String, int ): to reverse the word using Recursive Technique
void disp( ) : to display the original word, and the reversed word
void isPalin( ) : to check whether the inputted word is a Palindrome or not by calling the rev( ) function.
Specify the class Palindrome giving details of the constructor and member functions void readWord( ), String rev(String,int), void disp( ) and void isPalin( ). Define the main( ) function to create an object and call the member function according to enable the task .
Question 9. Rack is a kind of data structure which can store at the most 20 books. The rack restriction is that a book can be kept in to the rack or removed only at one end i.e. on the top. The class Rack has the following details : Class name : Rack Data members/ instance variables :
book[ ] : array of string of maximum 50 locations to store books. name : string variable to store name of book. Limit : integers as maximum capacity of the array Top: integer to indicate topmost book into the Rack. Member functions/methods : Rack( ) : a constructor to store blank in the array book[ ]. Rack( int nx ) : a constructor to assign nx to limit and -1 to top. void dispList( ) : to display list of books in the rack. boolean ifEmpty( ) : returns true, if rack is empty, otherwise returns false. void putTheBook( ) : input name of the book into variable name and adds it on the top into the array book[ ]
if rack is empty otherwise prints a message “Rack overflow”. void removeBook( ) : removes a book form the top of the rack, if rack is not Empty and print the book name,
otherwise outputs a Message “Rack underflow”.
Specify the class Rack giving details of constructors and the functions ifEmpty(), void putTheBook( ), void removeBook( ) only. Assume that other functions are already written for you. You do not need
… (see the PDF for the full paper)