Computer Science MS - 2015
Computer Science MS - 2015
Computer Science MS - 2015
This document of the analysis of pupils’ performance at the ISC Year 12 and ICSE Year 10 Examination is one
of its kind. It has grown and evolved over the years to provide feedback to schools in terms of the strengths and
weaknesses of the candidates in handling the examinations.
We commend the work of Mrs. Poonam Sodhi and the ISC Division of the Council who have painstakingly
prepared this analysis. We are grateful to the examiners who have contributed through their comments on the
performance of the candidates under examination as well as for their suggestions to teachers and students for the
effective transaction of the syllabus.
We hope the schools will find this document useful. We invite comments from schools on its utility and quality.
Gerry Arathoon
November 2015 Chief Executive & Secretary
i
INTRODUCTION
The Council has consistently been bringing out the “Pupil Performance Analysis” document since 1994.
This document is reviewed every year and changes incorporated based on suggestions received from various
quarters which include experts in the field of education as well as heads of schools and teachers, in order to make
the study more useful and meaningful.
This document comprises of qualitative analysis of performance of pupils at the ISC examinations. Performance
Analysis has been carried out for the most popular subjects that are largely ascribed to, by the schools.
The purpose of this study is to enable teachers to see at a glance, overall performance of all candidates who
have taken the examination and examiners comments on each question. This would enable the teachers to
understand the assessment of the ISC examinations better and would help them to guide their students more
effectively.
The qualitative analysis details the assessment criteria followed for evaluation of answer scripts. Once the
process of evaluation of scripts is over, examiners are requested to give detailed comments on the performance
of candidates for each question. This includes the examiners’ response on what constitutes a good answer;
common errors made by candidates while answering the questions; their popularity with students and overall
performance of students.
Mrs. Shilpi Gupta along with Dr. M.K. Gandhi, Mrs. Desiree Tennent and Ms. Mansi Guleria have done
commendable work in ensuring that this document is prepared well in time, in order to guide students who will
be appearing for the ISC Examination.
Poonam Sodhi
November 2015 Deputy Secretary
COMPUTER SCIENCE
STATISTICS AT A GLANCE
Total Number of students who took the examination 18,375
Highest Marks Obtained 100
Lowest Marks Obtained 1
Mean Marks Obtained 86.23
Mark Range
Details
0-20 21-40 41-60 61-80 81-100
Number of Candidates 16 59 1156 4352 12792
Percentage of Candidates 0.09 0.32 6.29 23.68 69.62
Cumulative Number 16 75 1231 5583 18375
Cumulative Percentage 0.09 0.41 6.70 30.38 100.00
60.00
50.00
40.00
30.00 23.68
20.00
6.29
10.00
0.09 0.32
0.00
0-20 21-40 41-60 61-80 81-100
Marks Obtained
144
B. ANALYSIS OF PERFORMANCE
PART I
Answer all questions.
While answering questions in this Part, indicate briefly your working and reasoning,
wherever required.
Question 1
(a) Simplify: (A + C)∙(A+ A∙D) + A∙C + C [2]
(b) Draw a logic circuit for (A + B)∙(C + D)∙C [2]
(c) Verify the following proposition with the help of a truth table: [2] [2]
P (~P Q) = P Q
(d) State De Morgan’s law and verify it, using a truth table. [2]
(e) Answer the questions related to the circuit given below: [2]
X
Y
Comments of Examiners
(a) Most of the candidates answered well. Some
Suggestions for teachers
reduced the expression in one step without showing
Students should be told to show the
the working. In a few cases, the laws were used
incorrectly. Some candidates were unable to open working and mention the laws, if
the brackets in the expression necessary in such type of questions.
(b) Some candidates interchanged the gates. i.e. OR Knowledge of the laws and practice
gate with AND gate and vice versa. in their application is important.
(c) This part was well answered by most candidates. Logic gates and logic circuits must
Some were confused with symbols ‘˄’ and ‘V’ and be practiced with almost every
interchanged them in the truth table. Some solved expression.
algebraically instead of using the truth table. Propositional logic should be taught
(d) A number of candidates proved both the laws of De using all terms that are required.
Morgan. A few candidates mentioned some other The symbols used in propositions
law. Some wrote ‘Break the line and change the must be explained.
sign’ which is not the law, but a way to remember All the laws of Boolean algebra
the law. must be practiced and proved with
(e) (i) Most of the candidates attempted this part well the help of truth table.
except for a few who gave the answer as 0. Logic circuits with objective type
(ii) A few candidates mentioned the name of the
expression must be done.
gate used in the circuit instead of the basic
More practice must be given for
gate the circuit represents. i.e NOR gate
instead of OR gate. Universal Gates.
145
MARKING SCHEME
Question 1.
(a) Simplify: (A + C) (A + AD) + AC + C
(A + C) A + AC + C
A + AC +AC + C
A+C
(b) Logic circuit for ( A+B ) . ( C+D) . C
(d) De Morgan’s law states that the complement of sum of the variables is same as product
of the individual complements of the variables and vice-versa.
(A.B)' = A' + B' (A+B)' = A' . B'
146
Question 2
(a) Define computational complexity. Calculate the complexity using Big‘O’ notation [2]
for the following code segment:
for(int k=0;k<n;k++)
s+=k;
(b) Convert the following infix notation into postfix form: [2] [2]
X + ( Y – Z ) +(( W + E) * F ) / J
(c) Differentiate between this keyword and super key word. [2]
(d) The array D[-2…10][3…8] contains double type elements. If the base address is [2]
4110, find the address of D[4][5], when the array is stored in Column Major Wise.
(e) State any two characteristics of a Binary tree. [2]
Comments of Examiners
(a) This part was answered well by most of the candidates.
Several candidates used examples to illustrate the Suggestions for teachers
answer. A few candidates found it difficult to provide More practice must be given in
appropriate definition. Some candidates wrote ‘k’ complexity of a code or a segment.
instead of ‘n’ for complexity All definitions related to
(b) Most candidates were able to solve this problem complexity must be covered.
correctly. Some candidates wrote the correct answer Examples need to be practiced with
without showing the working. Some applied the conversion of Infix to Postfix
postfix correctly, but could not derive the final answer. notation using direct method or the
Order of precedence was not clear and the placement stack method. The order of
of ‘+’ sign was improper in several cases. precedence must be explained.
(c) Examples were used by a number of candidates to Java keywords must be explained
show the difference. In some cases, only ‘super’ and practiced in programs for better
keyword was explained. understanding.
(d) A number of candidates were confused with the width Size of various data types must be
of the cell and assumed different values. Some wrote explained as it is necessary in such
the answer directly without showing the working or type of questions. Formula and
mentioning the formula. working should also be shown.
(e) Various answers were given by candidates. Some More practice must be given in
explained with the help of a diagram. Binary Tree, its parts and
characteristics.
MARKING SCHEME
Question 2.
(a) Computational complexity is the growth rate or measurement of an algorithm. The level in difficulty in
solving mathematically posed problems as measured by the time, number of steps or arithmetic operations,
or memory space required (called time complexity, computational complexity, and space complexity,
respectively).
Complexity of the segment = O(n)
(b) = X+ ( Y – Z ) +( ( W + E) * F ) / J
147
= X + Y Z - + ( W E + * F) / J
=X+ YZ-+WE+F* /J
=X+YZ-+ WE+F* J/
=XYZ– +WE+F*J/+
(c) this ( ) is used to refer to the instance variables of the class.
super ( ) is used to invoke the super class’s constructor/ instance variable/methods
(d) The given values are:
B = 4110, W = 8 bytes or 64 bits for double type , I = 4, J = 5, Lr = -2, Lc = 3,
M = (10- (-2)+1 = 10+2+1 = 13
Address of A [ I ][ J ] = B + W * [ ( I - Lr ) + M * ( J - Lc ) ]
= 4110 + 8 * [(4 - (-2)) + 13 * (5 - 3)]
= 4110 + 8 * [6 + 13*2]
= 4110 + 8 * [6+26]
= 4110 + 8 * [32] = 4110 + 256 OR = 4110 + 64 * [32] = 4110 + 2048
= 4366 (Ans) = 6158 (Ans)
(e) 1. It is acyclic
2. No two node can be similar or identical
3. It is recursive
4. There is only one unique path between two nodes.
5. Rooted data structure OR Linear data structure OR Dynamic data structure
6. Every node has a maximum of two sub nodes ( or maximum degree 2 )
Question 3
(a) The following function is a part of some class. Assume ‘x’ and ‘y’ are positive
integers, greater than 0. Answer the given questions along with dry run / working.
void someFun(int x, int y)
{
if(x>1)
{ if(x%y==0)
{ System.out.print(y+“ ”);
someFun(x/y, y);
}
else
someFun(x, y+1);
}
}
148
(i) What will be returned bysomeFun(24,2)? [2]
(ii) What will be returned bysomeFun(84,2)? [2]
(iii) State in one line what does the function someFun( )do, apart from [1]
recursion?
(b) The following is a function of some class which checks if a positive integer is an
Armstrong number by returning true or false. (A number is said to be Armstrong if
the sum of the cubes of all its digits is equal to the original number.)The function
does not use modulus (%) operator to extract digit. There are some places in the
code marked by ?1?, ?2?, ?3?, ?4?, ?5?which may be replaced by a
statement/expression so that the function works properly.
149
Comments of Examiners
(a) Some candidates used examples to illustrate the Suggestions for teachers
answer. A number of candidates found it difficult to Students should be asked to show
provide an appropriate definition. A few candidates the working and explain with
wrote ‘k’ instead of ‘n’ for complexity memory blocks. More practice
(b) Most candidates were able to solve this problem must be given in Recursive
correctly. Some candidates wrote the correct answer techniques.
without showing the working. Some applied the Practice should be given to
understand the program line by line
postfix correctly, but could not derive the final
and derive at a conclusion of what
answer. The order of precedence was not clear and the function is doing.
the placement of ‘+’ sign was improper in several More practice should be given on
cases. A few candidates interpreted the expression as programs using conditions / looping
‘sum = = num’ instead of ‘ sum = = N’. and other output related programs.
Teachers are expected to show the
dry run/ working of program and
emphasize that working is
necessary to get full credit. More
practice must be given in standard
programs.
MARKING SCHEME
Question 3.
(a) (i) someFun(24, 2)
24>1 true 24%2==0 true output 2
someFun(24/2, 2)
12>1 true 12%2==0 true output 2
someFun(12/2, 2)
6>1 true 6%2==0 true output 2
someFun(6/2, 2)
3>1 true 3%2==0 false call someFun(3, 3)
someFun(3, 3)
3>1 true 3%3==0 true output 3
someFun(3/3, 3) 1>1 false
OUTPUT: 2 2 2 3
(ii)someFun(84, 2)
84>1 true 84%2==0 true output 2
someFun(42/2, 2)
42>1 true 42%2==0 true output 2
someFun(42/2, 2)
21>1 true 21%2==0 false call someFun(21, 3)
someFun(21, 3)
21>1 true 21%3==0 true output 3
someFun(7/3, 3)
150
7>1 true 7%3==0 false call someFun(7, 4)
someFun(7, 4)
7>1 true 7%4==0 false call someFun(7, 5)
someFun(7, 5)
7>1 true 7%5==0 false call someFun(7, 6)
someFun(7, 6)
7>1 true 7%6==0 false call someFun(7, 7)
someFun(7, 7)
7>1 true 7%7==0 true output 7
someFun(7/7, 7) 1>1 false
OUTPUT: 2 2 3 7
(iii) Generating Prime factors.
(b) (i) 0
(ii) f * 10;
(iii) digit*digit*digit; OR Math.pow(digit,3)) ;
(iv) num / 10; OR f;
(v) sum = = N OR N= = sum
PART – II
Answer seven questions in this part, choosing three questions from
Section A, two from Section B and two from Section C.
SECTION - A
Answer any three questions.
Question 4
(a) Given the Boolean function F(A, B, C, D) = (0,1,2,3,5,7,8,9,10,11).
(i) Reduce the above expression by using 4-variable Karnaugh map, showing [4]
the various groups (i.e. octal, quads and pairs).
(ii) Draw the logic gate diagram for the reduced expression. Assume that the [1]
variables and their complements are available as inputs.
(b) Given the Boolean function:
P(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 [4]
the various groups (i.e. octal, quads and pairs).
(ii) Draw the logic gate diagram for the reduced expression. Assume that the [1]
variables and their complements are available as inputs.
151
Comments of Examiners
(a) (i) Most candidates fared well in this part. Some Suggestions for teachers
candidates were not able to draw the K-Map Make students reduce POS and
for the POS expression correctly. For a number SOP expressions using K-Map
of candidates the “Map rolling” concept was simultaneously. Students should be
not very clear. Grey coding and labelling the told not to include the redundant
K-Map was not clear to a number of group in the final expression.
candidates. Reducing the groups by laws is not
(ii) Some candidates drew the logic circuit using needed. Only direct answer for the
NOR gates while some others drew vague groups to be written in the reduced
diagrams. expression.
(b) (i) Many candidates made errors in place value More and more practice should be
and putting variables in K-Map. In other cases, given in drawing logic circuits
the groups were reduced by laws. Several using basic gates and also with
candidates drew the K-Map incorrectly. Some universal gates.
converted the canonical form to cardinal form Emphasize on arranging the
and then reduced it. Many candidates included variables in proper order and the
the redundant group in the final expression importance of cell values
(ii) Some candidates drew the logic circuit using corresponding with the variables.
NAND gates while some others drew vague Explain clearly how the group are
diagrams. framed and reduced. Redundant
groups are not to be included in the
final reduced expression.
More practice should be given in
drawing logic circuits using basic
gates and also with universal gates.
152
MARKING SCHEME
Question 4.
(a) F (A,B,C,D) = π (0 , 1 , 2 , 3 , 5 , 7 , 8 , 9 , 10 , 11 )
12 13 15 14
A’+B’ 1 1 1 1
8 9 11 10
A’+B 0 0 0 0
153
(b) P (A,B,C,D) =ABC’D’ + A’BC’D’ + A’BC’D + ABC’D + A’BCD + ABCD
0 1 3 2
A’B’
4 5 7 6
A’B 1 1 1
12 13 15 14
AB 1 1 1
8 9 11 10
AB’
Quad1 (m4+ m5+ m12+ m13) = BC’ Quad 2 (m5+ m7+ m13+ m15 ) = BD
154
Question 5
A person is allowed to travel in a reserved coach of the train, if he/she satisfies the [10]
criteria given below:
The person has a valid reservation ticket and a valid ID proof.
OR
The person does not have a valid reservation ticket, but holds a valid pass
issued by the Railway department with a valid ID proof.
OR
The person is a disabled person and holds a valid pass issued by the Railway
department along with a valid ID proof.
The inputs are:
INPUTS
R The person has a valid reservation ticket.
P The person holds a valid pass issued by the Railway department.
D The person has a valid ID proof.
H The person is a disabled person.
(In all the above cases 1 indicates yes and 0indicatesno).
Output : T – Denotes allowed to travel (1 indicates yes and 0 indicates no in all the
cases)
(a) Draw the truth table for the inputs and outputs given above and write the POS [5]
expression for T(R, P, D, H).
(b) Reduce T(R, P, D, H) using Karnaugh map. [5]
Draw the logic gate diagram for the reduced POS expression for T(R, P, D, H)
using only NOR gates. You may use gates with two or more inputs. Assume that
the variable and their complements are available as inputs.
155
Comments of Examiners
(a) A number of candidates were able to attempt this part Suggestions for teachers
satisfactorily. Some candidates did not mention the Students should be told to read the
final expression. Some were confused with the POS question carefully and answer
expression and took the output with 1’s instead of accordingly so that no part is left
0’s. A few candidates took 0’s as outputs but wrote unanswered. More practice should
the minterms instead of maxterms. be given to derive SOP and POS
(b) Many candidates fared well in this part. However, expression from any given
some candidates were not able to draw the K-Map for truth table (i.e. Minterms and
the POS expression correctly. For a number of Maxterms )
candidates the “map rolling” concept was not very Make students reduce POS and
clear. Some converted the canonical form to cardinal SOP expressions using K-Map
form and then reduced it. NOR gates in the circuit simultaneously. Students should be
was ignored by a few candidates. told not to include the redundant
group in the final expression. The
circuit diagram for the reduced
expression must be practiced both
with basic gates and universal
gates.
MARKING SCHEME
Question 5.
(a)
T
R P D H
(OUTPUT)
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 1
0 1 1 1 1
1 0 0 0 0
1 0 0 1 0
1 0 1 0 1
1 0 1 1 1
1 1 0 0 0
1 1 0 1 0
1 1 1 0 1
1 1 1 1 1
156
(b)
12 13 15 14
R’+P’ 0 0 1 1
8 9 11 10
R’+P 0 0 1 1
Hence T (R,P,D,H) = D . (R + P)
R
(R+P)’
P [(R+P)’+D’]’
D’
Question 6
(a) Draw the truth table and logic gate diagram for an Octal to Binary encoder. [4]
(b) What is a Multiplexer? State an application of a Multiplexer. Also, draw the logic [4]
diagram of a 4:1 Multiplexer.
(c) Verify the following expression using Boolean laws. Also, mention the law used at [2]
each step of simplification. [3]
X∙Y∙Z + X∙Y'∙Z + X∙Y∙Z' = X ∙ ( Y + Z )
157
Comments of Examiners
Suggestions for teachers
(a) Most of the candidates answered this part correctly. A few More practice should be given in
candidates drew the decimal encoder while some others drawing encoder and decoder. Use
drew the gates wrong. of proper connector and gates must
(b) Some candidates wrote the definition instead of application be explained.
and in some cases block diagrams were used instead. Some More practice must be given in
candidates interchanged the gates in the circuit diagram. drawing of multiplexer.
(c) While most candidates answered this part correctly, some Explanation of various gates and
did not mentioned the laws. A few candidates wrote the their use must be emphasized
answer directly in one step. Tell students that laws must be
mentioned while reducing,
minimizing or proving an
expression.
MARKING SCHEME
Question 6.
(a) Truth table for Octal to Binary Encoder : Input Output
Octal number B2 B1 B0
0 0 0 0
1 0 0 1
2 0 1 0
3 0 1 1
4 1 0 0
5 1 0 1
6 1 1 0
7 1 1 1
Logic Diagram for Octal to Binary Encoder :
0
1
2
3
4
5
6
7
B2 B1 B0
(b) Multiplexer: It is a combinational circuit which inputs parallel data and outputs one serial
data.
158
(c) X.Y.Z + X.Y’.Z + X.Y.Z’ = X .( Y + Z )
= X.Y.Z + X.Y’.Z + X.Y.Z’
= X.Y.(Z + Z’ ) + X.Y’.Z Complimentary law: Z+Z’=1
= X.Y + X.Y’.Z
= X.(Y + Y’.Z ) Distributive law: A + B.C = (A+B).(A+C)
= X.[ (Y + Y’) .( Y+Z ) ] Complimentary law: Y+Y’=1
= X.( Y+Z )
Question 7
(a) Derive a Boolean expression for the logic circuit given below and reduce the derived [3]
expression, using Boolean laws:
A o
B o o
C o X
(b) What are universal gates? Construct a logic circuit using NAND gates only for the [3]
expression: A∙ (B + C)
(c) Define Half Adders. Draw the circuit diagram and the truth table for a Half Adder. [4]
159
Comments of Examiners
Suggestions for teachers
(a) Most of the candidates answered this part correctly. More practice should be given in
Some candidates gave incomplete answers. A few deriving expression for any circuit
candidates could not reduce the expression. Some diagram and then reducing it.
wrote the answer directly without mentioning the Drawing of logic circuits using
intermediate points. universal gates must be explained
(b) Some candidates used basic gates in drawing the clearly. Proving of universality of
logic circuit instead of NAND gates. The concept of gates must be explained.
Universal gates not clear to a number of candidates. More practice should be given in
(c) Some candidates drew wrong circuit diagrams. The drawing half adder and full adder
circuits for partial sum and carry were done and also the truth table and
expression of both adders. Students
separately and not as one circuit in some cases.
must be told that Half Adder is one
circuit and not two different
circuits.
MARKING SCHEME
Question 7.
(a) 1. (A’.B’.C’)
2. (A’.B’.C’)’
3. (A’.B’.C’)’ . C
4. (A’.B’.C’)’ . C + ( A’.B’.C’)’
(A+B+C) . C + (A+B+C)
(A+B+C) . (C+1)
A+B+C
(b) Universal gates are derived gates which can perform the function of all basic gates. NAND gate
and NOR gate are Universal gates.
(c) Half adders are combinational circuits which adds two input binary bits and output two binary
bits. (Partial Sum and Carry).
160
Truth table of half adder :
OR
SECTION – B
Answer any 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 8
A class Admission contains the admission numbers of 100 students. Some of the data [10]
members / member functions are given below:
Class name : Admission
Data member/instance variable:
Adno[ ] : integer array to store admission numbers
Member functions/methods:
Admission( ) : constructor to initialize the array elements
void fillArray( ) : to accept the elements of the array in ascending
order
int binSearch(int l, int u, int v) : to search for a particular admission number (v)
using binary search and recursive technique
and returns 1 if found otherwise returns -1
Specify the class Admission giving details of the constructor, void fillArray( ) and
int binSearch(int, int, int) . Define the main( ) function to create an object and call the
functions accordingly to enable the task.
161
Comments of Examiners
Most of the candidates were able to attempt this part
Suggestions for teachers
correctly. Common errors made by candidates in this
More practice should be given in
question were: the concept of recursion was not clear to
solving programs using recursive
some candidates; several candidates did not use the
techniques. Much attention should
parameters in the function; some took extra variables
be paid by the teachers towards
while others did not initialize the array in the constructor;
recursion and its techniques with
a few candidates wrote the function binsearch( ) without
examples. Knowledge of base case
using the recursive technique. The other function
and recursive case should be given
including the constructor was well answered. Some
to the students for every program
candidates did not write the main( ) function and also
using recursive technique. Invoking
ignored the comments to be given in the program.
function within another function
should be given more practice. The
students should create recursive
code for most iteration cases.
MARKING SCHEME
Question 8.
import java.util.*;
public class Admission
{ static Scanner x=new Scanner(System.in);
int Adno[]=new int[100];
Admission(){ }
void fillArray()
{
System.out.println("Enter 100 elements in ascending order ");
for(int i=0;i<100;i++)
Adno[i]=x.nextInt();
}
162
obj.fillArray();
System.out.println("Enter value to be searched");
int v=x.nextInt();
int p=obj.binSearch(0,obj.Adno.length-1,v);
if(p==-1)
System.out.println("No. not found");
else
System.out.println("No. is present " );
}
}
Question 9
A class Merger concatenates two positive integers that are greater than 0 and produces a [10]
new merged integer.
Example: If the first number is 23 and the second is 764, then the concatenated number
will be 23764.
Some of the members of the class are given below:
Class name : Merger
Data members/instance variables:
n1 : long integer to store first number
n2 : long integer to store second number
mergNum : long integer to store the merged number
Member functions:
Merger() :
constructor to initialize the data members
void readNum( ) to accept the values of the data members n1 and
:
n2
voidJoinNum( ) : to concatenate the numbers n1 and n2 and store
it in mergNum
void show( ) : to display the original numbers and the merged
number with appropriate messages
Specify the class Merger, giving the details of the constructor, void readNum( ),void
JoinNum( )and void show( ). Define the main( ) function to create an object and call the
functions accordingly to enable the task.
163
Comments of Examiners
A number of candidates were able to attempt this part
well. The joinnum() function was not done properly by Suggestions for teachers
some candidates. Various methods/techniques were used More practice must be given in
to concatenate the numbers. Some did it directly without conversion from numeric to string
converting it to String type. Several candidates reversed and string to numeric. That
the number using while loop and then added it to the other concatenation of strings is possible
number. In some cases ‘int’ was used instead of ‘long’ but does not work on numeric data,
data type. Object creation in the main ( ) function was not must be explained.
properly defined in some cases. Constructor and the
main() method was answered properly by a few
candidates.
MARKING SCHEME
Question 9.
import java.util.*;
public class Merger
{
long n1,n2,mergNum;
Merger( ) { } OR Merger(){ n1= n2 = mergNum = 0;}
void readNum()
{ Scanner x=new Scanner(System.in);
System.out.println("Enter two numbers");
n1=x.nextLong();
n2=x.nextLong();
} void JoinNum( )
void JoinNum() { int s=1; long a=n2 ;
{ String s=Long.toString(n1); while(a!=0)
{ s=s*10;
String s1=Long.toString(n2); OR a=a/10;
String s2=s+s1; }
mergNum=Long.valueOf(s2); mergeNum = (n1 * s) +
} n2;
void show() }
{ System.out.println("First Number= " + n1);
System.out.println("Second Number= " + n2);
System.out.println("Merged Number= " + mergNum);
}
static void main()
{ Merger obj=new Merger();
obj.readNum();
obj.JoinNum();
obj.show();
}
}
164
Question 10
A class TheString accepts a string of a maximum of 100 characters with only one blank [10]
space between the words.
Some of the members of the class are as follows:
Comments of Examiners
Suggestions for teachers
Different methods / logic was used to extract the words Practice should be given to extract
from the sentence. Some candidates used String tokenizer characters from words, words from
while some others used the split function and charArray sentences and sentences from
to separate words from the sentence. Several candidates paragraphs. Different methods
did not include the blank space for words. A number of /logic should be adopted so that
candidates were not able to find the frequency of wider exposure to string
consonants properly. A few candidates used ‘||’ operator manipulation related programs is
instead of ‘&&’ operator. The main() function, given to candidates. Knowledge of
constructor and object creation were not answered by constructors to initialize a string
some of the candidates. and other data members should be
given.
165
MARKING SCHEME
Question 10.
166
SECTION – C
Answer any two questions.
Each program should be written in such a way that it clearly depicts the logic of the problem stepwise.
This can be achieved by using comments in the program and mnemonic names or pseudo codes for
algorithms. The programs must be written in Java and the algorithms must be written in general /
standard form, wherever required / specified.
(Flowcharts are not required.)
Question 11
WordPile is an entity which can hold maximum of 20 characters. The restriction is that a
character can be added or removed from one end only.
Some of the members of classes are given below:
Class name : WordPile
Data members/instance variables:
ch[ ] : character array to hold the character elements
capacity : integer variable to store the maximum capacity
top : to point to the index of the topmost element
Methods/Member functions:
WordPile( int cap) : constructor to initialise the data member
capacity = cap, top = -1 and create the
WordPile
void pushChar( char v) : adds the character to the top of WordPile if
possible, otherwise output a message
“WordPile is full”
char popChar() : returns the deleted character from the top of the
WordPile if possible, otherwise it returns ‘\\’
(a) Specify the class WordPile giving the details of the constructor, [8]
voidpushChar(char) and char popChar( ).
The main function and algorithm need not be written.
(b) What is the name of the entity described above and state one of its applications. [2]
167
Comments of Examiners
Suggestions for teachers
(a) The concept of stack was not clear to most of the
More practice should be given in
candidates. Common errors made by candidates
data structure programs like the
were: (i) the condition / logic for underflow and
stacks, queues, de queues, etc.
overflow was not answered correctly; (ii) increment /
Working must be shown as to how
decrement of top index was not done properly. The
the stack or a queue performs
methods pushchar() and popchar() were found to be
(examples can be supportive).The
difficult by some candidates. Some were confused
concept of LIFO and FIFO must be
with the Character type array and were not able to
explained to the students with
return properly. The class declaration and
examples from real world.
constructors was well answered.
Implementation of stacks, queues
(b) Some candidates were unable to state the applications
and de queues using arrays should
and gave vague answers. Some candidates
be emphasized. Only the concept
overlooked this part of the question.
has to be explained taking the base
as an array. It should be made clear
to students that it is not an array
related program which can be
manipulated by shifting / inserting
or initializing by any value since
these data structures requires
pointers and pointers are not
supported in java. So, the array is
used to show the working of a
stack, queue or a de queue
Stacks and Queues must be
explained in details giving all its
applications / uses.
Students should be asked to read
the question carefully and answer
accordingly.
168
MARKING SCHEME
Question 11.
Question 12
A line on a plane can be represented by coordinates of the two-endpointsp1 and p2 as p1(x1, [10]
y1) and p2(x2, y2).
A super class Plane is defined to represent a line and a sub class Circle to find the length of
the radius and the area of circle by using the required data members of super class.
Some of the members of both the classes are given below:
Class name : Plane
Data members/instance variables:
x1 : to store the x-coordinate of the first end point
y1 : to store the y-coordinate of the first end point
169
Member functions/methods:
Comments of Examiners
The concept of inheritance was not clear to a number of
candidates. Constructor with inheritance was not Suggestions for teachers
Practice should be given to students
answered correctly. Accessing the members of the super
class by the derived class, Mathematical functions on inheritance. Use of constructor
Math.pow( ) and Math.sqrt( ) were not clear to several using the base class member should
candidates. In some cases, double data members were be made clear.
Explain to students the different
not declared properly. Invoking the show() function in
the derived class was not answered properly by a few visibility modes and their accessing
candidates. In some cases, algorithm was written instead capability. Knowledge of calling the
of a program. The rest of the function were well member function from the super class
answered. to the derived class must be made
clear. The keywords ‘extends’ and
‘super’ must be given special
attention while dealing with
inheritance.
170
MARKING SCHEME
Question 12.
}
void findArea()
{ area = 3.14 * radius * radius ;
}
void Show()
{ super.Show();
System.out.println("Second x- coordinate= "+ x2);
System.out.println("Second y- coordinate= "+ y2);
System.out.println(" Length of radius = "+radius);
System.out.println(" Area = " + area);
}
}
171
Question 13:
(a) A linked list is formed from the objects of the class: [4] [4]
class Nodes
{
int num;
Nodes next;
}
Write an Algorithm OR a Method to print the sum of nodes that contains only odd
integers of an existing linked list.
The method declaration is as follows:
void NodesCount( Nodes starPtr )
(b) (i) Give the meaning of the following common expression in Big O notation: [1]
O(N)
O(N2)
(ii) List any two cases to analyse algorithm complexities. [1]
(c) Answer the following questions from the diagram of a Binary Tree given below:
C F
R M H P
N E
(i) Name the leaf nodes of the right sub-tree. [1]
(ii) Write post order traversal of the left sub-tree of node B including itself. [1]
(iii) State the level number of nodes R and M when the root is at level 0. [1]
(iv) Name the internal nodes of the tree. [1]
172
Comments of Examiners
(a) This part was well answered by most candidates. Suggestions for teachers
A number of candidates did not create a temporary More programs / algorithms should
pointer to the first node. Some candidates had be practiced with link list and
problems in moving the pointer to the next node binary tree data structure. Diagrams
and checking for null. A few were confused to illustrate the link list and the
whether to count the nodes or to find the sum of Binary Trees must be practiced.
the nodes. Some wrote the algorithm in simple Definition of complexities / big ‘O’
English language covering all the main steps. and the three cases of complexities
(b) (i) Several candidates were confused and gave must be explained in detail along
vague answers with examples. Some with examples. The role of the term
mentioned examples of O(n) and O(n2). (N) in complexities must be
(ii) This part was answered well by most of the explained.
candidates. Some gave examples to illustrate All the three cases of complexities
their answer. A few candidates mentioned the with the factors that influence them
types of complexities instead of cases of must be explained to students.
complexities. Examples in all three cases must
(c) (i) Several candidates mentioned the leaf nodes of also be given. Also explain the
the entire tree instead of right sub tree. difference between types and cases
(ii) While most candidates answered this part of complexities to students.
correctly some wrote the post order of the Explain binary tree with the
entire tree. different parts like root,
(iii)This part was well answered by most nodes(internal and external),
candidates. height, depth ,level, size, tree
(iv) Some candidates included root ‘B’ also in the traversal (preorder, inorder and
answer for internal nodes. However, most of postorder), etc.
the candidates answered this part well.
MARKING SCHEME
Question 13.
(a) Algorithm to print the sum of the nodes of odd integers in an existing linked list.
Steps :
1 - Start
2 - Set temporary pointer to start node
3 - Repeat steps 4 & 5 until the pointer reaches null. Display the Count. Exit.
4 - Check for odd integers and accumulate
5 - Move pointer to the next node
6 - End
OR
Method to print the sum of the nodes of odd integers in an existing linked list.
173
{
Nodes temp = new Nodes(starPtr)
int c=0;
while (temp!=null)
{
if( temp.num%2 !=0)
c=c+temp.num;
temp=temp.next;
}
System.out.println(c);
}
(c) i. P,E
ii. R,N,M,C,B
iii. 2
iv. C,M,F,H
GENERAL COMMENTS:
(a) Topics found difficult by candidates in the Question Paper:
The symbols ‘ʌ’ and ‘v’ from propositional logic
Computational complexity definition.
Size of double data type for the width of an array cell.
Keywords ‘this’ and ‘super’ with respect to overriding
Extracting digits without using the % sign.
K-MAPS (Grouping , map-rolling , place value)
Deriving POS expression from a truth table
Recursive technique
Pre-defined size of an array and re-declaring the size in the constructor.
Complexity and Big ‘O’ Notation
Stack operations for adding and removing characters.
174
(b) Concepts in which candidates got confused:
The symbols in a proposition.
Difference between ‘this’ and ‘super ’.
Deriving POS expression from Truth table
Deriving expression from a given circuit and reducing it.
Concatenation of two numbers.
Left and right sub tree for a Binary Tree.
175