0% found this document useful (0 votes)
97 views7 pages

CFQ ISC Computer Science XII 23 29

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

CFQ ISC Computer Science XII 23 29

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

Computer Science ISC-Class XII

V: Long Answer Questions (5 Marks Each)

S.No. Questions

62. [Linked List]


At Get It All supermarket, a POS (Point of Sale) system is designed. The cart management
is visible to the POS operator. The newer carts get added and once the bill payment is done
the current cart gets checked out from the system. The operator has 4 options like add cart,
check out cart, view cart queue and close the counter. The class Cart is created to represent
the node of the linked list.

public class Cart


{
int cartNo;
Cart next;
Cart(int cartNo)
{
this.cartNo=cartNo;
next=null;
}
}

The class POS is created to represent the POS for cart management. Observe the given code
and answer the following questions.
import java.util.*;
public class POS
{
Cart first;
static int count=0;
static Scanner sc=new Scanner(System.in);
void viewQueue( )
{
Cart temp=first;
boolean flag=false;
System.out.println("The carts at the counter are");
while(temp!=null)
{
System.out.println(temp.cartNo);
?1?
?2?
}
if(!flag)
System.out.println("The checkout counter is empty");
else
System.out.println("number of carts currently="+count);
}
void addCart()
{
System.out.print("Enter the new cart number: ");
ISC Competency-Focused Practice Questions 20
Computer Science ISC-Class XII

S.No. Questions
int no=sc.nextInt( );
Cart newCart = new Cart(no);
if(first==null)
first=newCart;
else
{
Cart temp=first;
while(temp.next!=null)
temp=temp.next;
temp.next=newCart;
}
count++;
}
void checkOutCart()
{
?1?
System.out.println("Cart being removed ="+temp.cartNo);
?2?
temp.next =null;
temp=null;
?3?
System.out.println("Carts remaining "+count);
}
}
(a) Write the code for the blanks given in the method void viewQueue( ).
(b) Mention the code for the blanks given in the method void checkOutCart( ).

(Analysis & Evaluate)

ISC Competency-Focused Practice Questions 21


Computer Science ISC-Class XII

S.No. Questions

63. [Binary Tree]


(a) Observe the following binary tree and identify its type. Justify your answer.

(b) Observe the given tree and answer the following questions.
(i) Why can the following tree not be termed as a full binary tree?

(ii) What is the size of the given binary tree?


(iii) Name the internal nodes of the given binary tree.
(c) State any one condition for a balanced binary tree.
(Evaluate)

ISC Competency-Focused Practice Questions 22


Computer Science ISC-Class XII

S.No. Questions

64. [Inheritance, Interfaces and Polymorphism]


(a) Complete the missing parts of the code given below:
class SI ?1? Account
{
double sINT;
public SI ( double sP, double sR ,double sT)
{
?2?
sINT=0;
}
public void Interest( )
{ sINT=(P*R*T)/100; }
public void display( )
{
?3? //invoke display( ) of base class
Interest ( );
System.out.println( "Simple Interest=" +sINT);
}
} // class ends

(b) Answer the following questions, based on the above code:


(i) Name the base class and derived class
(ii) Write the prototype of the base class constructor.

(Application)

ISC Competency-Focused Practice Questions 23


Computer Science ISC-Class XII

S.No. Questions

65. [Inheritance, Interfaces and Polymorphism]


Fix the following keywords at the right places:
(i) extends
(ii) super
(iii) protected
(iv) abstract
(v) implements

(a) class D1 ______ i1,i2


{ }
(b) _________ void printInfo( );
(c) class S1
{ }
class D2 ______ S1
{ }
(d) class S2
{
public void show( )
{ }
}
class D3 extends S2
{
public void show( )
{
____.show( );
}
}
(e)

(Understanding & Application)

ISC Competency-Focused Practice Questions 24


Computer Science ISC-Class XII

S.No. Questions

66. [Inheritance, Interfaces and Polymorphism ]


(a) In Java, polymorphism is exhibited in two different ways. Identify them in the code
snippets given in Column A and Column B?

Column A Column B

Shapes myShape = new Shapes( ); class Vehicle


myShape.area( ); {
myShape.area(5); void drive( )
myShape.area(6.0,1.2); {
myShape.area(6,2); System.out.println("Vehicle is moving");
}
}
class Bus extends Vehicle
{
void drive( )
{
System.out.println("Bus is running safely");
}
public static void main( )
{
Bus b = new Bus( );
b.drive( );
}
}

(b) Differentiate between the keywords this and super (... ) with respect to constructor.

(c) Base class Student and derived class ICSEStudent are illustrated as given below:

Similarly, show the classes Shapes, Triangle, TwoD_Shapes, Sphere, ThreeD_Shapes


exhibiting inheritance at multi-levels, depending on the type of shapes.
(Analysis, Application, Evaluate & Create)

ISC Competency-Focused Practice Questions 25


Computer Science ISC-Class XII

S.No. Questions

67. [Karnaugh Map]

A student from the Electronics department is asked to design a digital alarm for a smart home
security system for the outside area. It comprises a sensor and a digital identification (ID)
card with six-digit personal identification number (PIN). The alarm is supposed to buzz if
wrongful entry is attempted, either by breaking the glass window or by entering the wrong
PIN.

Following statements are the criteria for the alarm to buzz:

• The sensor detects the door opening without scanning a digital ID card.
or
• The sensor detects the door opening by breaking of the door lock.
or
• The sensor detects the wrong pin entry thrice of the digital ID card while opening
the door.

The inputs are:

Inputs

D Door opening

B Breaking of door lock

S Scanning security card

P Entering correct six-digit pin less than three times

(In all the above cases 1 indicates Yes and 0 indicates No).

Output: A – Denotes the buzz of security alarm system (1 indicates yes and 0 indicates
no)

Draw the truth table for the inputs and outputs given above. Write the canonical POS
expression for the A (D, B, S, P).
(Understanding, Recall, Apply, Create)

ISC Competency-Focused Practice Questions 26

You might also like