Official ISC Practice Papers for Class 12 Computer Science
Explore authentic exam practice materials through the ISC Class 12 Computer Science Sample Paper 2022 with Solutions. Tailored for Class 12 learners, utilizing these Computer Science sample papers ensures thorough preparation and strengthens time management skills before final ISC evaluations.
Solved Model Papers for Computer Science
Access the complete sample paper PDF for Class 12 Computer Science below. Regular practice with these targeted mock exams builds familiarity with expected question patterns and chapter weightage to help secure higher marks.
SECTION A - 7 MARKS
Question 1
(i) The keyword used by a class to acquire the properties of an interface is: [1]
(a) import
(b) implements
(c) extends
(d) include
Answer: (b) implements
The implements keyword is used in Java by a class to inherit from an interface.
Teacher's Note:
a) Remember that classes extend other classes but implement interfaces.
b) Do not confuse implements with extends which is used for class-to-class inheritance.
(ii) The ability of an object to take many forms is known as: [1]
(a) inheritance
(b) data abstraction
(c) overriding
(d) polymorphism
Answer: (d) polymorphism
Polymorphism refers to a single function or reference variable behaving in multiple forms depending on the context.
Teacher's Note:
a) Polymorphism is a core pillar of object-oriented programming alongside inheritance and encapsulation.
b) Be careful not to select overriding, which is merely one mechanism used to achieve runtime polymorphism.
(iii) int Toy(int n)
{ return (n<=0)? 1: n%10 + Toy(n/10); }
With reference to the program code given above, what will the function Toy() return when the value of n=56 ? [1]
(a) 65
(b) 12
(c) 651
(d) 11
Answer: (b) 12
Toy(56) returns 6 + Toy(5). Toy(5) returns 5 + Toy(0). Toy(0) hits the base case and returns 1. Total sum = 6 + 5 + 1 = 12.
Teacher's Note:
a) Trace recursive functions step-by-step on paper, keeping track of the return values at each level.
b) Pay close attention to the base condition where n <= 0 returns 1.
(iv) Write the statement in Java to extract the word “MISS” from the word “SUBMISSION”. [1]
Answer:
"SUBMISSION".substring(3,7)
Teacher's Note:
a) The substring(beginIndex, endIndex) method includes the character at beginIndex but excludes endIndex.
b) Indexing starts at 0, so 'M' is at index 3 and the first 'S' after 'I' is at index 7.
(v) State the principle by which the stack data structure works. [1]
Answer:
Last In First Out (LIFO)
Teacher's Note:
a) LIFO means the element inserted last is the first one to be removed.
b) State the full form clearly if asked in theory questions.
(vi) What is the output of the statement given below?
System.out.print("FAN" + ("AUTOMATIC".charAt(5) ) ); [1]
Answer:
FANA
Teacher's Note:
a) The character at index 5 of "AUTOMATIC" is 'A' (A-0, U-1, T-2, O-3, M-4, A-5).
b) String concatenation with the string "FAN" results in "FANA".
(vii) Give one reason, why iteration is better than recursion. [1]
Answer:
Recursion takes more memory and more time to execute than its iterative counterpart.
Teacher's Note:
a) Iteration uses simple loops without function call overhead.
b) Recursion maintains a stack of activation records which consumes additional memory.
SECTION B - 8 MARKS
Question 2 [2]
Differentiate between direct recursion and indirect recursion.
Answer:
| Direct Recursion | Indirect Recursion |
|---|---|
| In this case the function calls itself within its body. | In this case function A calls function B and in turn, function B calls function A again. |
Teacher's Note:
a) Direct recursion is straightforward and commonly used in problems like factorial or Fibonacci.
b) Indirect recursion involves a cycle of multiple function calls.
Question 3 [2]
Convert the following infix notation to postfix notation:
A * (B + C / D ) – E / F
Answer:
ABCD/+*EF/–
Teacher's Note:
a) Apply operator precedence rules: division inside parentheses first, then addition, multiplication, division, and finally subtraction.
b) Convert sub-expressions step by step to avoid placement errors.
Question 4
Answer the following questions on the diagram of a Binary Tree given below:
[Figure: A binary tree with root node A. Node A has left child B and right child C. Node B has right child D (no left child). Node C has left child E and right child F. Node F has right child G.]
(i) State the degree of the nodes C and G. Also, state the level of these nodes when the root is at level 0. [2]
Answer:
Degree of C = 2
Degree of G = 0
Level of C = 1
Level of G = 3
Teacher's Note:
a) Degree of a node is the number of children it has.
b) Level of a node is its distance from the root, with the root at level 0.
(ii) Write the pre order and post order traversal of the above tree structure. [2]
Answer:
Pre order traversal: A B D C E F G
Post order traversal: D B E G F C A
Teacher's Note:
a) Pre-order follows Root, Left, Right.b) Post-order follows Left, Right, Root.
SECTION C - 20 MARKS
Question 5 [6]
(i) Design a class Check which checks whether a word is a palindrome or not.
(Palindrome words are those which spell the same from either ends).
Example: MADAM, LEVEL etc.
The details of the members of the class are given below:
Class name : Check
Data members/instance variables:
wrd : stores a word
len : to store the length of the word
Methods/Member functions:
Check( ) : default constructor
void acceptword( ) : to accept the word
boolean palindrome ( ) : checks and returns ‘true’ if the word is a palindrome otherwise returns ‘false’
void display( ) : displays the word along with an appropriate message
Specify the class Check giving details of the constructor, void acceptword( ), boolean palindrome( ) and void display( ). Define the main( ) function to create an object and call the functions accordingly to enable the task.
Answer:
import java.util.Scanner;
class Check
{
String wrd;
int len;
public Check()
{
wrd = "";
len = 0;
}
public void acceptword()
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter a word");
wrd = sc.next();
len = wrd.length();
}
public boolean palindrome()
{
for(int i = 0, j = len - 1; i <= j; i++, j--)
{
if(wrd.charAt(i) != wrd.charAt(j))
return false;
}
return true;
}
public void display()
{
System.out.print(wrd);
if(palindrome())
System.out.println(" is a Palindrome word");
else
System.out.println(" is not a Palindrome word");
}
public static void main(String ar[])
{
Check ob = new Check();
ob.acceptword();
ob.display();
}
}
Teacher's Note:
a) Ensure the return type of the palindrome method matches the specification (boolean).
b) Use two pointers starting from opposite ends to check equality efficiently.
OR
(ii) Design a class Toggle which toggles a word by converting all upper case alphabets to lower case and vice versa.
Example: The word “mOTivATe” becomes “MotIVatE”
The details of the members of the class are given below:
Class name : Toggle
Data members/instance variables:
str : stores a word
newstr : stores the toggled word
len : to store the length of the word
Methods/Member functions:
Toggle( ) : default constructor
void readword( ) : to accept the word
void toggle ( ) : converts the upper case alphabets to lower case and all lower case alphabets to upper case and stores it in newstr
void display( ) : displays the original word along with the toggled word
Specify the class Toggle giving details of the constructor, void readword( ), void toggle( ) and void display( ). Define the main( ) function to create an object and call the functions accordingly to enable the task.
Answer:
import java.util.Scanner;
class Toggle
{
String str, newstr;
int len;
public Toggle()
{
str = newstr = "";
len = 0;
}
public void readword()
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter a word");
str = sc.next();
len = str.length();
}
public void toggle()
{
newstr = "";
for(int i = 0; i < len; i++)
{
char c = str.charAt(i);
if(Character.isUpperCase(c))
newstr += Character.toLowerCase(c);
else
newstr += Character.toUpperCase(c);
}
}
public void display()
{
System.out.println("Original string:" + str);
System.out.println("New string:" + newstr);
}
public static void main(String ar[])
{
Toggle Ob = new Toggle();
Ob.readword();
Ob.toggle();
Ob.display();
}
}
Teacher's Note:
a) Character wrapper class methods like isUpperCase, toLowerCase, and toUpperCase simplify case conversion.
b) Initialize newstr properly before concatenating characters inside the loop.
Question 6 [6]
(i) A class Fibo has been defined to generate the Fibonacci series 0, 1, 1, 2, 3, 5, 8, 13,…….. (Fibonacci series are those in which the sum of the previous two terms is equal to the next term).
Some of the members of the class are given below:
Class name : Fibo
Data member/instance variable:
start : integer to store the start value
end : integer to store the end value
Member functions/methods:
Fibo( ) : default constructor
void read( ) : to accept the numbers
int fibo(int n) : return the nth term of a Fibonacci series using recursive technique
void display( ) : displays the Fibonacci series from start to end by invoking the function fibo()
Specify the class Fibo, giving details of the Constructor, void read( ), int fibo(int), and void display( ). Define the main() function to create an object and call the functions accordingly to enable the task.
Answer:
import java.util.*;
class Fibo
{
int start, end;
public Fibo()
{
start = end = 0;
}
public void read()
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter start and end value");
start = sc.nextInt();
end = sc.nextInt();
}
public int fibo(int a)
{
if(a == 0 || a == 1)
return a;
else
return fibo(a - 1) + fibo(a - 2);
}
public void display()
{
for(int i = start; i < end; i++)
{
int p = fibo(i);
if(p >= start && p <= end)
System.out.print(fibo(i) + " ");
}
}
public static void main(String ar[])
{
Fibo Ob = new Fibo();
Ob.read();
Ob.display();
}
}
Teacher's Note:
a) The recursive function fibo(int a) correctly defines the base cases for 0 and 1.
b) The display method checks boundaries to print terms within the specified range.
OR
(ii) A class Gcd has been defined to find the Greatest Common Divisor of two integer numbers. Some of the members of the class are given below:
Class name : Gcd
Data member/instance variable:
num1 : integer to store the first number
num2 : integer to store the second number
Member functions/methods:
Gcd( ) : default constructor
void accept( ) : to accept the numbers
int gcd(int x,int y) : return the GCD of the two number x and y using recursive technique
void display( ) : displays the result with an appropriate message
Specify the class Gcd, giving details of the Constructor, void accept( ), int gcd(int,int), and void display( ). Define the main() function to create an object and call the functions accordingly to enable the task.
Answer:
import java.util.*;
class GCD
{
int num1, num2;
public GCD()
{
num1 = num2 = 0;
}
public void accept()
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter two numbers");
num1 = sc.nextInt();
num2 = sc.nextInt();
}
public int gcd(int x, int y)
{
int c = x % y;
if(c == 0)
return y;
else
{
x = y;
y = c;
return gcd(x, y);
}
}
public void display()
{
int temp;
if(num1 < num2)
{
temp = num1;
num1 = num2;
num2 = temp;
}
System.out.println(gcd(num1, num2));
}
public static void main(String ar[])
{
GCD Ob = new GCD();
Ob.accept();
Ob.display();
}
}
Teacher's Note:
a) This implements the Euclidean algorithm recursively.
b) Ensure the larger number is passed as the first parameter if necessary.
Question 7 [4]
A super class Godown has been defined to store the details of the stock of a retail store. Define a subclass Update to store the details of the items purchased with the new rate and update the stock. Some of the members of both the classes are given below:
Class name : Godown
Data members/instance variables:
item : to store the name of the item
qty : to store the quantity of an item in stock
rate : to store the unit price of an item
amt : to store the net value of the item in stock
Member functions/methods:
Godown( …) : parameterized constructor to assign value to the data members
void display( ) : to display the stock details
Class name : Update
Data members/instance variables:
pur_qty : to store the purchase quantity
pur_rate : to store the unit price of the purchased item
Member functions / methods
Update(…) : parameterized constructor to assign values to the data members of both the classes
void update( ) : to update the stock by adding the previous quantity by the purchased quantity and replace the rate of the item if there is a difference in the purchase rate. Also update the current stock value as: (quantity * unit price)
void display( ) : to display the stock details before and after updating
Assume that the super class Godown has been defined. Using the concept of inheritance, specify the class Update giving details of the constructor, void update ( ) and void display( ).
The super class, main function and algorithm need NOT be written.
Answer:
class Update extends Godown
{
int pur_qty;
double pur_rate;
public Update(int ai, int qt, double rt, double am, int pqt, double prt)
{
super(ai, qt, rt, am);
pur_qty = pqt;
pur_rate = prt;
}
public void update()
{
qty += pur_qty;
if(pur_rate != rate)
rate = pur_rate;
amt = qty * rate;
}
public void display()
{
System.out.println("Stock details before updation");
super.display();
update();
System.out.println("Stock details after updation");
super.display();
}
}
Teacher's Note:
a) Use the super keyword to invoke the parameterized constructor of the base class.
b) Update quantity, rate, and amount correctly as specified in the problem statement.
Question 8 [4]
A Queue is a linear data structure in which the operations are performed based on FIFO (First In First Out).
Define a class Queue with the following details:
Class name : Queue
Data member/instance variable:
dat[ ] : array to hold the integer elements
cap : stores the maximum capacity of the queue
front : to point the index of the front
rear : to point the index of the rear.
Member functions/methods:
Queue(int max) : constructor to initialize the data member cap = max, front = rear = 0 and create the integer array
void add_dat(int v) : to add integers from the rear index if possible else display the message(“Queue full”)
int pop_dat( ) : to remove and return elements from front, if any, else returns -999
void display() : to display elements of the queue
Specify the class Queue giving the details of void add_dat(int) and int pop_dat( ). Assume that the other functions have been defined.
The main( ) function and algorithm need NOT be written.
Answer:
import java.util.*;
class Queue
{
int dat[];
int cap, front, rear;
public Queue(int max)
{
cap = max;
dat = new int[cap];
front = rear = 0;
}
public void add_dat(int v)
{
if(rear == cap - 1)
{
System.out.println("Queue full");
return;
}
dat[rear++] = v;
}
public int pop_dat()
{
if(front == rear)
{
System.out.println("Queue empty");
return -999;
}
else
return dat[front++];
}
public void display()
{
for(int i = front; i < rear; i++)
{
System.out.print(dat[i] + " ");
}
}
}
Teacher's Note:
a) Check for overflow (rear == cap - 1) before adding data to the queue.
b) Check for underflow (front == rear) before popping data and return -999 as specified.
Free study material for Computer Science
ISC Class 12 Computer Science Sample Paper 2022 with Solutions & Sample Question Papers for Class 12 Computer Science
Access Sample Papers for Class 12 Computer Science
Access structured sample papers for Class 12 Computer Science. Solving the ISC Class 12 Computer Science Sample Paper 2022 with Solutions provided above helps students understand official exam blueprints and tackle anticipated question formats with confidence.
Key Advantages of Solving ISC Class 12 Computer Science Sample Paper 2022 with Solutions
- Original Practice Material: Access unique questions for Computer Science designed to challenge your understanding.
- Self-Assessment: Evaluate scores per set to pinpoint weak zones in Class 12 Computer Science.
- Exam Completion Skills: Routine problem sets train you to manage test duration efficiently without stress.
Post-Practice Strategy for Class 12 Computer Science
- Self-Evaluation: Score your answers using official guidance to track your academic progress.
- Mistake Correction: Class 12 pupils must re-solve questions answered incorrectly to master the correct method.
- Continuous Practice: Take additional Computer Science sample modules online to maximize preparedness for ISC evaluations.
FAQs
You can download the complete PDF for ISC Class 12 Computer Science Sample Paper 2022 with Solutions for free from StudiesToday.com. Our resources for Class 12 Computer Science are updated for the latest academic session and follow the official exam pattern.
Yes, ISC Class 12 Computer Science Sample Paper 2022 with Solutions comes with detailed, teacher-verified solutions. We have provided step-by-step answers for Computer Science to help students of Class 12 understand correct methodology and marking scheme.
Practicing this Computer Science paper helps in time management and identifying important topics. For Class 12, solving mock papers is the best way to gain confidence and reduce exam-day anxiety.
Yes, all our study materials for Class 12 Computer Science are provided in a mobile-friendly PDF format. You can easily download ISC Class 12 Computer Science Sample Paper 2022 with Solutions on your mobile device.