CFQ ISC Computer Science XII 23 29
CFQ ISC Computer Science XII 23 29
S.No. Questions
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( ).
S.No. Questions
(b) Observe the given tree and answer the following questions.
(i) Why can the following tree not be termed as a full binary tree?
S.No. Questions
(Application)
S.No. Questions
S.No. Questions
Column A Column B
(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:
S.No. Questions
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.
• 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.
Inputs
D Door opening
(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)