Paper 1 Sample Paper 2022-2023
Paper 1 Sample Paper 2022-2023
CLASS 12
COMPUTER SCIENCE (THEORY)
Reading Time: 15 minutes
Writing Time: Three Hours MM- 70
-------------------------------------------------------------------------------------------------------------------
Answer all questions in Part I (compulsory) and six questions from
Part-II, choosing two questions from Section-A, two from Section-B and
two from Section-C.
All working, including rough work, should be done on the same sheet
as the intended marks for questions or parts of questions are given in
brackets [ ].
---------------------------------------------------------------------------------------------------------
PART I – 20 MARKS
Answer all questions.
While answering questions in this Part, indicate briefly your working and
reasoning, wherever required.
-------------------------------------------------------------------------------------------------
Question 1
(i) The propositional operator <==>, is also known as: [1]
(a) Logical Equivalence
(b) Implication
(c) Conjunction
(d) Disjunction
(ii) If F(A,B,C) = ∑(0, 2, 3, 5), then Canonical POS will be: [1]
(a) A'B'C' + A'BC' + A'BC + AB'C
(b) (A+B+C').(A'+B+C).(A'+B'+C).(A'+B'+C')
(c) (A'+B'+C).(A+B'+C').(A+B+C').(A+B+C)
(d) None of These
(iii) The dual of XY' + X'Z is :
[1]
(a) (X' + Y).(X + Z')
(b) (X + Y') . (X + Z')
(c) X'. Y + X. Z'
(d) (X + Y') . (X' + Z)
(iv) Which of the following statement represents idempotent law: [1]
(a) A + 1 = 1
Page 1 of 7
(b) A + A = A
(c) A.1 = A
(d) A + A’ = 1
(v) On reducing (A' + B). (A' + B'), the reduced expression which we get is [1]
(a) B
(b) A’
(c) 1
(d) A + B’
(vi) Represent the following Boolean expression into its cardinal SOP form: [1]
F(A, B,C) = AB’C + AB’C’ + A’B’C + A’B’C’
(vii) Name the basic gate that is equivalent to two NAND gates connected in series. [1]
(viii) What is the difference between protected and default access to data member of the class
with respect to Inheritance? [1]
(ix) Define function overriding. [1]
(x) Write the contrapositive of X’→Y [1]
Question 2
(i) Convert the following infix expression into postfix. [2]
A-B*C/D+E
(ii) A matrix A[m][n] is stored with each element requiring 4 bytes of storage. If the base
address at a[1][1] is 1500 and the address at A[4][5] is 1608, determine the number of
Rows of the matrix when the matrix is stored in Column Major Wise. [2]
(iii) With reference to the code given below answer the questions that follow.
int solve(int n)
{
int sum=0;
while(n!=0)
{
int d=n%10;
if(d==2|||d==3||d==5||d==7)
sum=sum+n;
n=n/10;
}
return sum;
}
(a) What will the function solve() return when the value of n=32769? [2]
(b) What is the method solve() computing? [1]
(iv) With reference to the code given below answer the questions that follow.
int find(int n)
{
if(n!=0)
{
if(n%10%2==0)
Page 2 of 7
return n%10+find(n/10);
else
return find(n/10);
}
else
return 0;
}
(a) What will the function find() return when the value of n is 94562? [2]
(b) What is the method find() computing? [1]
PART II – 50 MARKS
Answer six questions in this part, choosing two questions from
Section A, two from Section B and two from Section C.
SECTION - A
Answer any two questions.
Question 3
(i) Given the Boolean function F(A,B,C,D) = Σ (0, 2, 5, 7, 8, 10, 11, 13, 14, 15)
(a) Reduce the above expression by using 4-variable Karnaugh map, showing the [4]
various groups (i.e. octal, quads and pairs).
(b) Draw the logic gate diagram for the reduced expression. Assume that the [1]
variables and their complements are available as inputs.
Page 3 of 7
Output: X- Denotes eligible for Medal [1 indicates yes and 0 indicates No in all cases]
Draw the truth table for the inputs and outputs given below and write the POS expression for
X(A,B,C,D). [5]
(ii) What is a full adder? Design full adder using two half adder. [3]
(iii) Design two input XNOR using NAND only. [2]
Question 5
(i) What is a encoder? How is it different from a decoder? Draw the logic circuit of [5]
decimal to binary encoder.
(ii) Prove that A. {B + C. (A.B + A.C)’} = A. B [3]
(iii) Write the maxterm and minterm for the function F (A, B, C, D) when, A=1, B=0, [2]
C=1 and D=1.
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 Algorithms are not required.)
The programs must be written in Java.
Question 6 [10]
A class BubSort has been defined to sort the list of integers using bubble sort technique. Some of the
members of the class are:
class : BubSort
Data members
arr[ ] : An array to store integers.
size : to store the size of the array
Member functions
BubSort(int s) : constructor to initialise size with s and declare arr[].
void accept() : to input integers in arr[].
void bubbleSort (int i, int j) : recursive function to sort the array arr[] using bubble sort
technique.
void display() : to display the elements of the array arr.
Specify the class BubSort giving details of the constructor and other member functions. Also write
the main().
Question 7
A manager of an internet service provider company wants to analyze the system usage from the log
records to find the utilization of the system. He wants to know: For how long did each user use the
system? When the user wants to use the system he must login to the system and after finishing the work
he must log out the system. The time format is the 24-hour system hour and minutes. You may assume
that data is valid and a user will login for less than 24 hours. If endtime is less than the starttime it means
that the user logged in over the night.
Page 4 of 7
Class name Time
Data members
hh-hours
mm-minutes
Member functions:
Time() constructor
void readtime() to read time in 24 hour mode
void disptimeansi() to display the time in 24 hour mode
int timetominutes(Time) to find total number of minutes.
void minutestotime(int) to convert total number of minutes into hh, mm.
void diff(Time endtime, Time starttime) to find the difference between endtime and
starttime in hours and minutes.
Specify the class Time giving details of the constructors and all the functions. Do write the main
function.
Question 8 [10]
A class Password is defined to accept a string for a password and categorize it as a weak password,
normal password or a strong password on the following basis:
weak - if the string contains only digits or only letters or only special characters.
normal - if the string contains a combination of any two of the three (letters,
digits, special characters)
strong - if string contains all three (digits, letters as well as special characters)
Class : Password
Data members/instance variables:
str : store the password as string
strength : store the strength of the password as “weak”, “normal” or strong
Members functions/methods:
Password() : constructor
boolean hasDigit() : returns true if the string contains one or more digits otherwise
returns false.
boolean hasLetter() : returns true if the string contains one or more letters otherwise
returns false.
boolean hasSpecial() : returns true if the string contains one or more special otherwise
returns false.
void printStrength() : prints the strength of the password as per the above criteria by
using the methods defined in the class.
Specify the class Password giving details of the constructors and all the functions. Do write the main
function.
Page 5 of 7
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.)
Question 9 [5]
A class TaxiMeter contains details of a taxi and another class Journey contains the details of a journey.
Some of the members of the class TaxiMeter are
Class name : TaxiMeter
Data members:
String Name : To store the name of the driver
int RegNo : To store the registration number of the taxi
Member functions:
TaxiMeter(String, int) : Parameterized constructor to assign values to data members
void display() : To display Name and RegNo.
Some of the members of the derived class Journey are
Class name : Journey
Data members:
String name : To store the name of the passenger
double distance : To store the total distance travelled
double amt : To store the total fare as per the given criteria
Distance Fare
<=2km Rs. 50
>2 km Rs. 50 + Rs. 5 for every ½ km or part of it.
Member Functions
Journey(……) : Parameterized constructor to initialize data members of both the classes
void calculate() : To calculate the total fare
void display() : To display Driver’s name, Taxi Registration No., passenger name,
distance travelled and total fare.
Using the concept of inheritance specify the class Journey giving details of the constructor and
other functions.
Question 10 [5]
A Doubly Queue is a linear data structure which enables the user to add and remove elements from
either ends i.e., from front or rear. Define a class “DeQueue” with the following details.
Class name : DeQueue
Data members
arr[ ] : array to hold integers
lim : stores the size of DeQueue
front : to point to the index of front end
rear : to point to the index of rear end
Page 6 of 7
Member functions
DeQueue (int n) :
constructor to initialise lim with n and rear and front with
0.
void addFront(int val) : to add integer from front if possible else displays an error
message.
void addRear(int val) : to add integer from rear if possible else displays an error
message.
int popFront( ) : returns element from front, if possible else returns -9999.
int popRear( ) : returns element from rear, if possible else returns -9999.
Specify the class DeQueue giving details of the constructor and other member functions. No need to
write main().
Question 11:
a) A linked list is formed from the object of the class [2]
class Node {
int num;
Node nextNode;
}
Write a function / algorithm to calculate the sum of even Node data elements of a given
Linked list.
b) Answer the following questions from the given Binary Tree: [3]
(i) List the nodes of left subtree. A
B J
C F K
D G L
E H
Page 7 of 7