Computer Science ISC25
Computer Science ISC25
COMPUTER SCIENCE
PAPER1
(THEORY)
Maximum Marks: 70
Time Allotted: Three Hours
Reading Time: Additional Fifteen minutes
Instructions to Candidates
1. Kindly read aloud the Instructions given above to all the candidates present
in the examination hall.
Turn over
1225-868A 1
© Copyright reserved.
PART I 20MARKS
Answer all questions.
While answering questions in this Part, indicate briefly your working and reasoning,
wherever required.
Question I
(i) The complement of the Boolean expression (A B') + (B' "C) is: [1]
(a) (A + B') "(B'+ C)
(b) (A' B) +(B"C)
(c) (A'+ B) " (B +C)
(d) (A " B') +(B" C)
(ii) Given below are two statements marked, Assertion and Reason. Read the two [1]
statements carefully and choose the correct option.
Assertion: The expression ~(XVY)is logically equivalent to (-X ^~Y)
Reason: The commutative property of logical operators states that the order of the
operands does not change the result of a binary operation.
(a) Both Assertion and Reason are true and Reason is the correct explanation for
Assertion.
(b) Both Assertion and Reason are true but Reason is not the correct explanation
for Assertion.
Assertion is true and Reason is false.
(c)
(d) Both Assertion and Reason are false.
1225-868A 2
(iv) The Associative Law states that: [1]
(b) A + B= B+A
this.age = age;
Which of the following statements are valid for the given code?
I. The keyword this in the constructor refers to the current instance of the
class.
II. The keyword this differentiates between the instance variable age and
the parameter age.
III. The keyword this can be used only in constructors.
(a) Only I and II
(b) Only II and III
(c) Only I and III
(d) Only III
Reason: The break statement enables unnatural exit from the loop.
explanation for
(a) Both Assertion and Reason are true and Reason is the correct
Assertion.
(b) Both Assertion and Reason are true but Reason is not the correct explanation
for Assertion.
4
1225-868A
(1]
(ix) For the given code segment, write Big O notation for worst case complexity.
for (int i=l;i<=P; it)
( Statements )
for (int j=l;j<=P; +tj)
for (int k=l; k<=0; k++)
{Statenents }
Function X (A, B), from the [1|
(x) Write the minterms in canonical form for the Boolean
truth table given below:
A B X
1 1
Question 2
(2]
() Convert the following infix notation to postfix form.
(A - B/C) +(D *E/F) *G
memory with each element requiring [2|
(i) A matrix M[-1...10, 4....13] is stored in the
find the address of M[2][7] when the
2 bytes of storage. If the base address is 1200,
matrix is stored Row Major Wise.
Turn over
1225-868A 5
(iii) The following function int solve() is a part of some class. Assume 'm' and 'n' are
positive integers. Answer the questions given below with dry run /working.
int solve(int m, int n)
intk=1:
ifm<0)
return -k:
else if(m==0)
return m;
else
return kt (solve(m-n, n+2));
6
1225-868A
(a) What is the expression or statement at ?1?
PART II 50 MARKS
A
(1)
(2)
(a) Derive Boolean expression for (1), (2) and R. Reduce the derived expression. [4]
(b) Name the logic gate that represents the reduced expression.
Question 5
(i) What is an encoder? Draw the logic gate diagram for an octal to binary encoder. (5]
State one application of a decoder.
(ii) By using truth table, verify if the following proposition is valid or not. [3]
(-X=> Y) AX=X A~Y) v(XA Y
(iii) Study the logic gate diagram given below and answer the questions that follow:
A
- Output
(a) A=1,B=0
1225-868A 8
SECTION B
num
to store a binary number
Methods / Member functions:
constructor to initialise the data member with 0
Perni( )
void accept( ) to accept a binary number (containing 0's and
l's only)
in 'k
int countOne(int k) to count and return the number of 1's
using recursive technique
void check() to check whether the given number is a
pernicious number by invoking the function
countOne( ) and to display an appropriate
message
), void accept( ),
Specify the class Perni giving the details of the constructor( create an object and
int countOne(int) and void check(). Defne a main( ) function to
call the functions accordingly to enable the task.
9 Turnover
1225-868A
|10j
Question 7
twO
Colsum to check if the sum ofelements in each corresponding column of
wesign a class matrices have the same dimenslOIS.
matrices is equal or not. Assume that thetwo
Example:
MATRIX B
Input: MATRIX A
2 3 1 7 4
4 2 2 5
Member functions/methods:
parameterised constructor to initialise the
Colsum(int mm, int nn) data members m = mm and n=nn
to accept the elements into the array
void readArray()
B) to check if the sumn of elements in each
boolean check(Colsum A, Colsum column of the objects A and B is equal and
return true otherwise, return false
10
1225-868A
Question 8 [10]
Aclass Flipgram has been defined to flip the letters of the left and right halves of a
non-heterogram word. If the word has odd number of characters, then the middle letter
remains at its own position.
Aheterogram is a word where no letter appears more than once.
Example l: INPUT:BETTER
OUTPUT: TERBET
Example 2: INPUT:NEVER
OUTPUT: ERVNE
Example 3: INPUT: THAN
OUTPUT: HETEROGRAM
The details of the members of the class are given below:
Class name Flipgram
Data member/instance variable:
Methods/Member functions:
Flipgram(String s) parameterised constructor to assign word=s
boolean ishetero( ) to return true if word is a heterogram else
return false
String flip() to interchange the left and right sides of a
non-heterogram word and return the resultant
word
void display( ) to print the flipped word for a
non-heterogram
word by invoking the method flip( ). An
appropriate message should be printed for a
heterogram word
Specify the class Flipgram giving the details of
boolean ishetero( ), String flip( ) and void the constructor(String),
an object and callthe functions display). Define a main( ) function to create
accordingly to enable the task.
1225-868A 11
Turn over
SECTION -C
Question 9
A circular queue is a linear data structure that
allows data insertion at the rear and removal
forming a circular arrangement.
from the front, with the rear end connected to the front end
The details of the members of the class are given below:
Class name : CirQueue
Data members/instance variables:
cap
maxinum capacity of the circular queue
front : to point the index of the front
rear
:. to point the index of the rear
Methods/Member functions:
constructor to initialise cap = n, front = 0 and
CirQueue(int n) rear = 0
to add integers from the rear index if possible
void push(int v) else display the message "QUEUE IS FULL"
int remove( ) to remove and return the integer from front
if any, else return 999
12
1225-868A
Question 10
A superclass Flight has been defined to store the details of a flight. Define a subclass
Passenger tocalculate the fare for apassenger.
The details of the members of both the classes are given below:
Class name Flight
Data mnembers/instance variables:
flightno to store the flight number in string
dep_time to store the departure time in string
arr time to store the arrivaltime in string
basefare tostore the base fare in decimal
Methods/Member functions:
char m;
Cell right;
Write an Algorithm OR a Method to print the sum of the ASCII values of the
lower case alphabets present in the linked list.
The method declaration is as foilows:
void lowercase(Cell str)
(ii) Answer the following questions based on the Binary Tree given below:
F G
I K L M
1225-868A 14
(a) Write the in-order traversal of the right subtree.
(b) State the depth of the entire binary tree and depth of node E. (1|
(c) Name the external nodes of the left subtree and internal nodes of the right [1]
subtree.
1225-868A