ISC Computer Science 2015 Class-12 Previous Year Question Papers Solved

Question 12.
A line on a plane can be represented by coordinates of the two-end points p1 and p2 as p1(x1, y1) and p2(x2, y2).
A superclass Plane is defined to represent a line and a subclass Circle to find the length of the radius and the area of the circle by using the required data members of the superclass. [10] Some of the members of both classes are given below:
Class name: Plane
Data members/instance variables:
x1: to store the x-coordinate of the first endpoint
y1: to store the y-coordinate of the first endpoint
Member functions/methods:
Plane (int nx, int ny): parameterized constructor to assign the data members x1 = nx and y1 = ny
void show(): to display the coordinates
Class name: Circle
Data members /instance variables:
x2: to store the x-coordinate of the second endpoint
y2: to store the y-coordinate of the second endpoint
radius: double variable to store the radius of the circle
area: double variable to store the area of the circle
Member functions/methods:
Circle(…): parameterized constructor to assign values to data members of both the classes
void findRadius(): to calculate the length of the radius using the formula:
(\sqrt{(x 2-x 1)^{2}+(y 2-y 1)^{2}}) / 2
assuming that x1, x2, y1, y2 are the coordinates of the two ends of the diameter of a circle
voidfindArea(): to find the area of a circle using the formula: πr2. The value of pie(π) is 22/7 or 3.14
void show(): to display both the coordinates along with the length of the radius and area of the circle
Specify the class Plane giving details of the constructor and void show() Using the concept of inheritance, specify the class Circle giving details of the constructor, void findRadius(), void find Area() and voidShow()
The main function and algorithm need not be written.
Answer 12:

class Plane
int x1;
int y1;
public Plane(int nx, int ny)
public void show()
System.out.println("P1: "+x1 +", "+y1);
class Circle extends Plane{
int x2;
int y2;
double radius;
double area;
public Circle(int nx1, int ny1, int nx2, int ny2)
super(nx1, nx2);
public void fmdRadius()
radius=Math.sqrt(Math.pow((x2-x1), 2)+Math.pow((y2-y1), 2))/2.0;
public void findArea()
public void show(){
super. show();
System.out.println("P2: "+x2+", "+y2);
System.out.println("Area: "+area);
class Coordinate
//main method created so that the program can be executed
public static void main(String args[])
Circle obj=new Circle(2, 3, 4, 5);

Question 13.
(a) A linked list is formed from the objects of the class: [4]

class Nodes
int num;
Node 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)

(i) Give the meaning of the following common expression in Big O notation: [1]
(ii) List any two cases to analyse algorithm complexities. [1] (c) Answer the following from the diagram of a Binary Tree given below:
ISC Class 12 Computer Science Previous Year Question Papers Solved 2015 Q12
(i) Name the leaf nodes of the right sub-tree. [1] (ii) Write postorder traversal of the left subtree 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] Answer 13:

(a) public void nodesCount(Nodes startPtr)
int sum=0;

(i) O(N) is a computational complexity which is Linear in nature.
O(N2) is a computational complexity which is Quadratic in nature.
(ii) Two cases to analyze algorithm complexities: Worst Case, Best Case.
(i) Nodes P and E are the leaf nodes of the right sub-tree.
(ii) R, N, M, C, B is the required post-order traversal.
(iii) 2
(iv) C, F, M, H are the internal nodes.

-: End of ISC Computer Science 2015 Class-12 Solved Paper :-

Return to – ISC Class-12 Solved Previous Year Question Paper


Please Share with Your Friends

Read Next 👇 Click on Page Number Given Below 👇

You might also like
Leave a comment