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

Computer 12th 2017

The document contains solved questions from the 2017 ISC Computer Science exam. It has two parts - Part I with 5 short answer questions worth 30 marks total, and Part II with longer questions worth 70 marks total. Students must answer all of Part I and choose 6 questions from Part II, with 2 each from 3 different sections (A, B, C). The summary provides an overview of the document's structure and content to efficiently understand the exam format and requirements.

Uploaded by

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

Computer 12th 2017

The document contains solved questions from the 2017 ISC Computer Science exam. It has two parts - Part I with 5 short answer questions worth 30 marks total, and Part II with longer questions worth 70 marks total. Students must answer all of Part I and choose 6 questions from Part II, with 2 each from 3 different sections (A, B, C). The summary provides an overview of the document's structure and content to efficiently understand the exam format and requirements.

Uploaded by

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

ISC

Solved PAPER 2017


Fully Solved (Question-Answer)

Computer Science-XII
Time : 3 hrs Max. Marks : 100

General Instructions
1. Answer all questions in Part I (compulsory) and seven questions from Part II.
2. Attempt any seven questions from Part II, choosing three questions from Section A, two
from
Section B and two from Section C.
3. The intended marks for questions or parts of question are given in brackets [ ].

Part -I (30 Marks)


Answer all questions
While answering questions in this Part, indicate briefly your working
and reasoning, wherever required.

1. (a) State the law represented by the following proposition and prove it with
the help of a truth table
PVPP
(b) State the Principle of Duality.
(c) Find the complement of the following Boolean expression using De
Morgan’s law.
F(a, b, c)  (b  c)  a
(d) Draw the logic diagram and truth table for a 2 input XNOR gate.
(e) If (~ P  Q) then write its
(i) Inverse
(ii) Converse
Ans. (a) P V P = P proposition represents the idempotent law.
Truth table for P VP = P

P P P=PVP
0 0 0
1 1 1

Hence, P = P V P Proved
(b) Principle of Duality
It is states that a boolean relation can be derived by
(i) changing every OR (+) by AND (.)
(ii) changing every AND (.) by OR (+)
(iii) changing every 0 by 1 and 1 by 0
(c) Given expression is, F (a, b, c) =(b + c) + a
The complement of F i.e. F
 F = [(b + c) + a] = (b + c) . a
= (b) . c . a = b.c.a
= a b c
(d) Logic diagram for a 2 input XNOR gate :
A
Y
B

Y = A B = AB + AB
Truth table for a 2 input XNOR gate
A B Y
0 0 1
0 1 0
1 0 0
1 1 1

(e) (i) To form the inverse of the statement, take the negation of both the antecedent and the
consequent.
So, ~ P Q
Here, P is a antecedent and Q is a consequent
Hence, inverse would be ~ (~ P)  ~ Q
 P ~Q
(ii) To form the converse of the statement, interchange the antecedent to consequent.
Hence, converse would be Q  ~ P

2. (a) What is an interface? How is it different from a class?


(b) Convert the following infix expression to postfix form
P * Q/R  (S  T)
(c) A matrix P[15] [10] is stored with each element required 8 bytes of
storage. If the base address at P[0][0] is 1400, determine the address at
P[10][7] when the matrix is stored in Row Major Wise.
(d) (i) What is the worst case complexity of the following code segment
for (int x  1; x <a; x++)
{
statements;
}
for (int y = 1; y <=b; y++)
{
for (int z  1; z  c; z++ )
{
statements;
}
}
(ii) How would the complexity change if all the three loops went to N
instead of a, b and c?
(e) Differentiate between a constructor and a method of a class.
Ans. (a) Interfaces are basically a collection of method which are public and abstract by default. These
interfaces do not have any method body.
Syntax interface interface_name
{
returntype method_name(arg_list);
}
Differences between interface and class are as follows
Interface Class
The members of an interface are always The members of a class can be declared
declared as constant i.e. their values are as constant or variables.
final.
It cannot be used to declare objects. It can It can be instantiated by declaring objects.
only be inherited by a class

(b) Given, infix expression : P * Q/R + (S + T)


First, we eliminate bracket content and then convert it into postfix expression
= P*Q/R + (ST+) = PQ*/R + (ST+)
= PQ*R/+(ST+) = PQ*R/(ST+)+
The postfix expression is, = PQ*R/ST++
(c) Given, B  1400, W  8, Lr  0, Lc  0, U r  15, U c  10, I  10, J  7
For row major wise,
A[I][J] = B  W [U r (I  Lr ) + (J  Lc )]
A[10][7]  1400  8[15 (10  0)  (7  0)]
 1400  8[15  10  7 ]  1400  8[150  7 ]
 1400  8  157  1400  1256  2656
(d) (i) In the given code, first loop will execute c times and its sequence will take constant time t 1 .
So, execution time will be c * t 1 .
Second loop is nested loop. The outer loop of second loop will execute a times and inner
loop will execute b times and sequence of statements will take constance time i.e t 2. So,
execution time will be a* b  t 2.
Hence, total time  c * t 2  a * b  t 2
Worst case complexity  o(c  ab)
(ii) If all the loop execute N times, the body of the loop get executed N  1times, the condition
will evaluate to false and loop terminated without executing the body. So, the time
complexity for such code would be :
Total time  c * N  cN i.e. O(N)
(e) Differences between constructor and method of a class are as follows :
Constructor Method
It has no return type It has a return type.
Constructor name should be same as the Method name can be any valid identifier.
class name.
Constructor is automatically called upon Method are invoked explicitly.
object creation.

3. The following function magicfun() is a part of some class. What will the
function magicfun() return, when the value of n=7 and n=10,
respectively? Show the dry run/working:
int magicfun(int n)
{
if (n==0)
return 0;
else
return magicfun(n/2) * 10 + (n % 2);
}
Ans. When n=7 then,
Return 111
magicfun (3)  10 + (1)

Return 11
Call magicfun (1) * 10+(1)
Return 1
Call magicfun (0) * 10 + (1)

Hence, function magicfun( ) return 111, when the value of n=7


when n  10 then,
Return 1010
magicfun (5)*10+(0)

Return 101
Call magicfun (2)*10+(1)

Return 10
Call magicfun (1)*10+(0)

Return 1
Call magicfun (0)*10+(1)

Hence, function magicfun( ) return 1010, when the value of n=10.


Part - II (70 Marks)

Answer six questions in this part, choosing two questions from Section A,
two from Section B and two Section C.

Section - A
Answer any three questions

4. (a) Given the Boolean function F(A, B, C, D) =  (2, 3, 4, 5, 6, 7, 8, 10, 11)


(i) Reduce the above expression by using 4-variable Karnaugh map,
showing the various groups (i.e. octal, quads and pairs).
(ii) Draw the logic gate diagram for the reduced expression. Assume
that the variable and their complements are available as inputs.
(b) Given the Boolean function F(P, Q, R, S)   (0, 1, 2, 4, 5, 6, 8, 10)
(i) Reduce the above expression by using 4-variable Karnaugh map,
showing the various groups (i.e. octal, quads and pairs).
(ii) Draw the logic gate diagram for the reduced expression. Assume
that the variable and their complements are available as inputs.
Ans. Given Boolean function F(A, B, C, D)   (2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
(i) K-map
CD
AB CD CD CD CD

AB 1 1
0 1 3 2

AB 1 1 1 1
4 5 7 6

AB
12 13 15 14

AB 1 1 1
8 9 11 10

There are 2 quads and 1 pair


Quad 1(m4  m5  m6  m7 )  AB
Quad 2 (m2  m3  m10  m11 )  BC
Pair (m8  m10 )  A B D
Hence, the final reduced expression F ( A, B,C, D)  AB  BC  A B D
(ii) Logic gate diagram for
F ( A, B,C, D)  AB  BC  A B D

AAB B C C D D
AB

BC

F=AB + BC + ABD

ABD

(b) Given Boolean function F(P,Q, R,S )  (0, 1, 2, 4, 5, 6, 8, 10)


(i) K-map
RS
PQ R+S R+S R+S R+S

P+Q 0 0 0
0 1 3 2

P+Q 0 0 0
4 5 7 6
P+Q
12 13 15 14

P+Q 0 0
8 9 11 10

There are 3 quads


Quad 1 (m0  m1  m4  m5 )  P  R
Quad 2 (m0  m2  m4  m6 )  P  S
Quad 3 (m0  m2  m8  m10 )  Q  S
Hence, the final reduced expression
F(P,Q, R,S )  (P  R ) . (P  S ) . (Q  S )
(ii) Logic gate diagram for F(P,Q, R,S )  (P  R ).(P  S ).(Q  S )

P Q R S
P+R

P+S
F= (P+R) . (P+S) . (Q+S)

Q+S
5. (a) A school intends to select candidates for an Inter-School Essay
Competition as per the criteria given below
The student has participated in an earlier competition and is very
creative.
Or
The student is very creative and has excellent general awareness, but
has not participated in any competition earlier.
Or
The student has excellent general awareness and has won prize in
an inter-house competition.
The inputs are
INPUTS
A participated in competition earlier
B is very creative
C won prize in an inter-house competition
D has excellent general awareness

(In all the above cases 1 indicates yes and 0 indicates


no). Output : X [1 indicates yes, 0 indicates no for all
cases]
Draw the truth table for the inputs and outputs given above and write the
POS expression for X (A, B, C, D).
(b) State the application of a Half Adder. Draw the truth table and
circuit diagram for a Half Adder.
(c) Convert the following Boolean expression into its canonical POS
form F (A, B, C) = (B + C ) . (A + B)
Ans. (a) Truth table for given inputs in below
A B C D X
0 0 0 0 0 ✓
0 0 0 1 0 ✓
0 0 1 0 0 ✓
0 0 1 1 1
0 1 0 0 0 ✓
0 1 0 1 1
0 1 1 0 0 ✓
0 1 1 1 1
1 0 0 0 0 ✓
1 0 0 1 0 ✓
1 0 1 0 0 ✓
1 0 1 1 1
1 1 0 0 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 1
The POS expression for above truth table is
X( 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)
(b) Application of a Half Adder
The ALU (Arithmetic Logic Circuit) of a computer uses half adder to compute the binary
addition operation on two bits.
Truth table for a half adder
X Y S C
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1

Sum (S )  XY  XY  X  Y
Carry (C )  XY
Logic/Circuit diagram
X
S=X+Y
Y

C=XY

(c) Given Boolean expression is


F( A, B,C )  (B  C  ) . ( A  B)
 ( A . A  B  C  ) . ( A  B  CC  ) [by complement law]
 ( A  B  C  )( A  B  C  ) ( A  B  C )( A  B  C  )
[by distributive law]
 ( A  B  C  ) ( A  B  C  )( A  B  C )

6. (a) What is a Multiplexer? How is it different from a decoder? Draw the


circuit diagram for a 8 : 1 Multiplexer.
(b) Prove the Boolean expression using Boolean laws. Also, mention the
law used at each step.
F = (x + z) + [(y + z) . (x + y)] = 1
(c) Define maxterms and minterms. Find the maxterm and minterm
when P = 0, Q = 1, R = 1 and S = 0
Ans. (a) Multiplexer It is a combinational circuit that selects binary information from one of many input
lines and directs it to a single output line. A multiplexer is also called a data selector.
Circuit diagram for a 8 : 1 multiplexer
Boolean function for a 8 : 1 multiplexer
F  S S S  I  S S S  I  S S S I  S S S  I  S S S I  S S S  I  S S S I
2 1 0 0 2 1 0 2 210 3 2 1 0 4 2 1 0 5 210 6 2107
From the expression the logic diagram is formed as follows.
S2 S1 S0

I
0

I
1

I
2

I3
F
I
4

I
5

I
6

I
7

Difference between Multiplexer and Decoder


Differences between multiplexer and decoder are as follows

Multiplexer Decoders
A digital multiplexer is a combinational A decoder is a combinational circuit that
circuit that selects binary information from coverts binary information from ‘n’ input
one of many input lines and directs it to a line to a maximum of 2n unique output
single output line. lines.
It is called as data selector, since it selects This decoder is called n-to-m line decoder
one of many inputs. where m  2n.
A multiplexer is used to share several Decoders are used to keep abstraction and
signals to one device like A/D convertor. modularity in hardware design.
e.g.4-to-1 line multiplexer. e.g. 3-to-8 decoder.

(b) Given Boolean expression is


F  (x   z)  [( y  z)  (x   y)]  1
LHS (x   z)  [( y  z) . (x   y)]
(x   z)  ( y  z)  (x   y) [Using Demorgan’s law]
(x   z)  ( y ). z  (x  ) . y [Using Demorgan’s law]
(x   z)  y. z  x. y [Using Involution law]
 x   z  yz  xy
 x ( y  y )  z( y  y )  yz  xy [Using Complementary law]
 x  y  x  y  yz  y z  yz  xy
 x  y  y(x   x )  y( z  z )  y z [Using Complementary law]
 x  y  y  y  y z
 y(x   1)  y (1 z) [Using Postulates]
 y  y  1  RHS [Using Postulates]
Hence, LHS  RHS
(c) Minterms The variables are combined to form a standard product when we take AND
operation between the variables. These AND terms are known as minterms.
Maxterms The variables are combined to form a standard sum when we take OR operation
between the variables. These OR terms are known as maxterms.
When, P  0, Q  1, R  1 and S  0
Maxterm P  Q  R  S
Minterm PQRS

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 Algorithm are not required)
The programs must be written in Java

7. A class Palin has been defined to check whether a positive number is a


Palindrome number or not.
The number ‘N’ is palindrome if the original number and its reverse are
same. Some of the members of the class are give below;
Class Name Plain
Data members/instance variables
num integer to store the number
revnum integer to store the reverse of the number
Methods/Member functions
Palin() constructor to initialize data members with legal
initial values
void accept() to accept the number
int reverse(int y) reverses the parameterized argument ‘y’ and
stores it in ‘revnum’ using recursive technique
void check() checks whether the number is a Palindrome by
invoking the function reverse() and display the
result with an appropriate message

Specify the class Palin giving the details of the constructor(), void
accept(), int reverse(int) and void check(). Define the main() function to
create an object and call the functions accordingly to enable the task.
Ans. import java.io.*;
class Palin
{
int num;
int revnum;
int reverse = 0;
Palin()
{
num=0;
revnum=0;
}
void accept() throws IOException
{
InputStreamReader IR=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(IR);
System.out.println(“Enter the number”);
num=Integer.parseInt(br.readLine());
}
int sum=0,rem;
int reverse(int y)
{
if(y>0)
{
rem=y%10;
sum=sum*10+rem;
reverse(y/10);
}
else
return sum;
return sum;
}
void check()
{
revnum=reverse(num);
if(num==revnum)
System.out.println(num+" is a palindrome number");
else
System.out.println(num+" is not a palindrome number");
}
public static void main(String args[]) throws IOException
{
Palin P = new Palin();
P.accept();
P.check();
}
}

8. A class Adder has been defined to add any two accepted


time Example : Time A - 6 hours 35 minutes
Time B - 7 hours 45 minutes
Their sum is - 14 hours 20 minutes (where 60 minutes = 1
hour)
The details of the members of the class are given below
Class Name Adder
Data members/instance variable
a[ ] integer array to hold two elements (hours
and minutes)
Member functions/methods
Adder() constructor to assign 0 to the array
elements
void readtime() to enter the elements of the array
void addtime(Adder X, Adder Y) adds the time of the two parameterized
objects X and Y and stores the sum in the
current calling object
void disptime() displays the array elements with an
appropriate message (i.e. hours = and
minutes = )

Specify the class Adder giving details of the constructor( ), void readtime(
), void addtime(Adder, Adder) and void disptime( ). Define the main( )
function to create objects and call the functions accordingly to enable the
task.
Ans. import java.io.*;
class Adder
{
int a[] = new int[2];
Adder()
{
a[0]=0;
a[1]=0;
}
void readtime() throws IOException
{
InputStreamReader IR=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(IR);
System.out.println("Enter the Time in Hours and Minutes");
a[0]=Integer.parseInt(br.readLine());
a[1]=Integer.parseInt(br.readLine());
}
void addtime(Adder X, Adder Y)
{
a[0]=X.a[0]+Y.a[0];
a[1]=X.a[1]+Y.a[1];
if(a[1]>=60)
{
a[0]=a[0]+a[1]/60;
a[1]=a[1]%60;
}
}
void disptime()
{
System.out.println(a[0]+" hours "+a[1]+" minutes");
}
public static void main(String args[]) throws IOException
{
Adder A = new Adder();
Adder B = new Adder();
Adder C = new Adder();
A.readtime();
B. readtime();
C. addtime(A, B);
System.out.print("Time A - ");
A.disptime();
System.out.print("Time B - ");
B.disptime();
System.out.print("Their sum is - ");
C.disptime();
}
}

9. A class SwapSort has been defined to perform string related operations


on a word input. Some of the members of the class are as follows
Class Name SwapSort
Data members/instance variables
wrd to store a word
len integer to store length of the word
swapwrd to store the swapped word
sortwrd to store the sorted word
Member functions\Methods
SwapSort( ) default constructor to initialize data members with
legal initial values
void readword( ) to accepts a word in UPPER CASE
void swapchar( ) to interchange/swap the first and last characters of
the word in ‘wrd’ and stores the new word in
‘swapwrd’
void sortword( ) sorts the character of the original word in
alphabetical order and stores it in ‘sortwrd’
void display( ) displays the original word, swapped word and the
sorted word.
Specify the class SwapSort, giving the details of the constructor( ), void
readword( ), void swapchar( ), void sortword( ) and void display( ). Define
the main( ) function to create an object and call the functions accordingly
to enable the task.
Ans. import java.io.*;
public class SwapSort
{
char [] wrd;
int len;
char [] swapwrd;
char [] sortwrd;
SwapSort()
{
len=0;
}
void readword() throws IOException
{
InputStreamReader IR=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(IR);
System.out.println(“Enter the word in UPPER CASE”);
String t=br.readLine();
len=t.length();
wrd = new char[len];
for(int i=0; i<len;i++)
wrd[i]=t.charAt(i);
swapwrd = new char[len];
sortwrd = new char[len];
}
void swapchar()
{
for(int i=0;i<len;i++)
{
if(i==0)
swapwrd[i]=wrd[len-1];
else if(i==len-1)
swapwrd[len-1]=wrd[0];
else
swapwrd[i]=wrd[i];
}
}
void sortword()
{
for(int i=0;i<len;i++)
{
sortwrd[i]=wrd[i];
}
for(int i=0;i<len;i++)
{
for(int j=0;j<len-i-1;j++)
{
if(sortwrd[j]>sortwrd[j+1])
{
char t = sortwrd[j];
sortwrd[j]=sortwrd[j+1];
sortwrd[j+1]=t;
}
}
}
}
void display()
{
System.out.print("Original Word : ");
for(int i=0;i<len;i++)
System.out.print(wrd[i]);
System.out.println();
System.out.print("Swapped Word : ");
for(int i=0;i<len;i++)
System.out.print(swapwrd[i]);
System.out.println();
System.out.print("Sorted Word : ");
for(int i=0;i<len;i++)
System.out.print(sortwrd[i]);
System.out.println();
}
public static void main(String args[]) throws IOException
{
SwapSort S = new SwapSort();
S.readword();
S.swapchar();
S.sortword();
S.display();
}
}

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)

10. A super class Product has been defined to store the details of a product sold by
a wholesaler to a retailer. Define a sub class Sales to compute the total amount
paid by the retailer with or without fine along with service tax.
Some of the members of both the classes are given below
Class Name Product
Data members/instance variables
name stores the name of the product
code integer to store the product code
amount stores the total sale amount of the product (in
decimals)
Member functions/Methods
Product(String n, int c, double p) parameterized constructor to assign data
members name=n, code=c and amount=p
void show() displays the details of the data members
Class Name Sales
Data members/instance variables
day stores number of days taken to pay the sale
amount
tax to store the services tax (in decimals)
totamt to store the total amount (in decimals)
Member functions/methods
Sales (…) paramaterized constructor to assign values to
data members to both the classes
void compute( ) calculates the services tax @ 12.4% of the actual
sale amount
calculates the fine @ 2.5% of the actual sale
amount only if the amount paid by the retailer to
the wholesaler exceeds 30 days
calculates the total amount paid by the retailer as
(actual sale amount  service tax  fine)
void show( ) displays the data members of super class and the
total amount

Assume that the super class Product has been defined. Using the concept
of inheritance, specify the class Sales giving the details of the
constructor(…), void compute( ) and void show( ).
The super class, main function and algorithm need NOT be written.
Ans. class Sales extends Product
{
int day;
double tax;
double totamt;
Sales (String n, int c; double p, int d)
{
Super (n, c, p);
day = d;
tax = 0.0;
totamt = 0.0;
}
void compute( )
{
tax = (amount*12.4)/100;
int fine = 0;
if (day > 30)
fine = (amount * 2.5)/100;
totamt = amount + tax + fine;
}
void show( )
{
System.out.println("Name of the product:" + name);
System.out.println("Product code :" + code);
System.out.println("Sale amount of the product :" +amount);
System.out.println("Total amount :" + totamt);
}
}

11. Queue is an entity which can hold a maximum of 100 integers. The queue
enables the user to add integers from the rear and remove integers from the
front. Define a class Queue with the following details
Class Name Product
Data members/instance variables
Que[ ] array to hold the integer elements
size stores the size of the array
front to point the index of the front
rear to point the index of the rear
Member functions
Queue (int mm) constructor to initialize the data size = mm,
front = 0, rear = 0
void addele(int v) to add integer from the rear if possible else
display the message “Overflow”
int delele( ) returns elements from front if present,
otherwise displays the message “Underflow”
and return-9999
void display( ) displays the array elements

Specify the class Queue giving details of ONLY the functions void
addele(int) and int delele ( ). Assume that the other functions have been
defined.
The main function and algorithm need NOT be written.
Ans. class Queue
{
void addele (int v)
{
if (rear = =  1)
{
front = 0;
rear = 0;
Que [rear] = v;
}
else if (rear + 1 < Que.length)
Que [++rear] = v;
else
System.out.println("Overflow");
}
int delele ( )
{
int element;
if (front = = 0)
{
System.out.println("Underflow");
return 9999;
}
else if (front = = rear)
{
element = Que [front];
front = rear = 0;
return element;
{
else
return (Que [front ++]);
}
};

12. (a) A linked list is formed from the objects of the class Node. The class
structure of the Node is given below :
class Node
{
int num;
Node next;
}
Write an Algorithm OR a Method to count the nodes that contain only
odd integers from an existing linked list and returns the count.
The method declaration is as
follows : int CountOdd(Node
startPtr)
(b) Answer the following questions from the diagram of a Binary Tree
given below

N G

W Y Z D

F R
(i) Write the postorder traversal of the above tree structure.
(ii) State the level numbers of the nodes N and R if the root is at 0 (zero)
level.
(iii) List the internal nodes of the right sub-tree.
Ans. (a) Algorithm
CountOdd (Node startPtr)
Step 1 Set count = 0 (Initialise counter)
Step 2 Set num = startPtr (Initialise pointer)
Step 3 Repeat steps 4 and 5 while num ! = NULL
Step 4 If num % 2 ! = 0 then
count = count + 1
Step 5 num = next [num]
/* updates pointer to point to next node */
Step 6 Return count
Or
Method
int CountOdd(Node startPtr)
{
int count = 0 ;
num = startPtr;
while (num ! = NULL)
{
if (num%2 != 0_
{
count = count + 1;
}
num = next [num];
}
return count;
}
(b) (i) Post order traversal of tree is
= NGM
=WYNZDGM
=WFYNRZDGM
(ii)
M Level 0

N G Level 1

W Y Z D Level 2

F R Level 3

Level number of the node N  1


Level number of the node R  3
(iii) Internal nodes of the right sub-tree  G, Z

You might also like