0% found this document useful (0 votes)
14 views

Computer Science ISC25

The document is an examination paper for a Computer Science Theory course, consisting of two parts with a total of 11 questions. Part I is compulsory and contains multiple-choice questions, while Part II has three sections from which candidates must answer two questions each. Instructions for candidates and the supervising examiner are provided, along with specific questions covering various computer science concepts.

Uploaded by

Rahin Anushah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Computer Science ISC25

The document is an examination paper for a Computer Science Theory course, consisting of two parts with a total of 11 questions. Part I is compulsory and contains multiple-choice questions, while Part II has three sections from which candidates must answer two questions each. Instructions for candidates and the supervising examiner are provided, along with specific questions covering various computer science concepts.

Uploaded by

Rahin Anushah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

U4009292

COMPUTER SCIENCE
PAPER1
(THEORY)
Maximum Marks: 70
Time Allotted: Three Hours
Reading Time: Additional Fifteen minutes
Instructions to Candidates

1. Youare allowed an additional fifteen minutes for only


reading the question
paper.
2. You must NOT start writing during the reading time.
blank page.
3. Thisquestion paper has 15 printed pages and one
4. It is divided into two parts: Part Iand Part II.
5. It has 11 questions in all.
6. Part Iis compulsory and has two questions.
required to
7. While attempting Multiple Choice Questions in Part I, you are
writeonly ONE option as the answer.
8. PartII is divided into three sections: A, B andC.
have to be
9. Each section in Part II has three questions. Any two questions
attempted from each section.
10. The intended marks for questions are given in brackets .

Instruction to Supervising Examiner

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.

(iii) According to the Principle of Duality, the Boolean equation (1]


(1 + Y) " (X+ Y)=Y+X will be equivalent to:
(a) (1 + Y) "(X'+ Y") =Y+X
(b) (0 " Y) + (X " Y)=Y" X
(c) (0+ Y) "(X + Y)=Y +X
(d) (1 " Y)+ (X"Y)=Y "X

1225-868A 2
(iv) The Associative Law states that: [1]

(a) A " B = B" A

(b) A + B= B+A

(c) A "(B+C)=A "B + A "C

(d) A +(B+C)=(A +B)+C


[1]
(v) Consider the following code statement:
public class Person
{ int age;
publicPerson (int age)

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

1225-868A 3 Turn ver


the two
(vi) GIven below are two statements marked. ASsertion and Reason. Read
statements carefully and choose the correct option.
Assertion: The break statement prevents fall through effect in switch case
construct.

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.

(c) Assertion is true and Reason is false.


(d) Both Assertion and Reason are false.
(vii) The canonical expression of F( P, Q, R)= (2, 5, 7) is: [1]

(a) (P+Q'+ R)"(P' +Q+ R')"(P'+Q'+ R')


(b) (P " Q'"R) +(P'"Q"R')+(P'"Q'"R')
(c) (P+Q+ R')"(P+Q'+R)" (P+Q+R)
(d) (P'"Q"R') +(P "Q'"R)+ (P"Q"R)
Assertion and Reason that [1]
(viii) Study the given propositions and the statements marked,
your analysis.
follow it. Choose the correct option on the basis of
P-It is aholiday
Q-It is a Sunday
(Q'> P)
Assertion: If it is not a Sunday,then it is not a holiday.
and consequent are interchanged.
Reason: Inverse is formed when antecedent
and Reason is the correct explanation
(a) Both Assertion and Reason are true
for Assertion.
correct
true but Reason is not the
(b) Both Assertion and Reason are
explanation for Assertion.
false.
Assertion is true and Reason is
(c)
are false.
(d) Both Assertion and Reason

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));

(a) What will the function solve( ) return if: (2]


(1) m =16, n =1

(2) m=9, n=1


(b) What is the function solve( ) performingapart from recursion?
(iv) The following function duck( ) is a part of some class which is used to check if a
given numnber is a duck number or not. There are some places in the code marked
by ?12, ?2?, ?3? which may be replaced by a statement / expression so that the
function works properly.
A number is said to be Duck if the digit zero (0) is present in it.
boolean duck(int a)
{int f=-l;
ifla==0)
return true;
for(int i=a; i!=0;?1?)
{ int c = i%10;
iflc=-?2?)
ff-1; break; }

return (f==?3?)? false:true:

6
1225-868A
(a) What is the expression or statement at ?1?

(b) What is the expression or statement at ?2? (1|

(c) What is the expression or statement at ?3?

PART II 50 MARKS

Answer six questions in this part, choosing two questions from


Section A, two from Section B and two fron Section C.
SECTION - A
Answe any tw0 questions.
Question 3
facility if he /she meets any of [5]
(i) A superhero is allowed access to a secure Avengers
the following criteria:
high-security
The superhero has Avengers' membership and possesses a
clearance badge
OR
permit
Thesuperhero does not have Avengers membership but holds a special
issued by S.H.I.E.L.D. along with ahigh-security clearance badge
OR
issued by
The superhero is not a recognised ally but holds a special permit
S.H.IE.L.D. along with a high-security clearance badge
The inputs are:
INPUTS
A Superhero has Avengers membership.
S Superhero holds a special permit issued by S.H.I.E.L.D.
C Superhero possesses a high-security clearance badge
L Superhero is a recognised ally
(In all the above cases, 1indicates YES and Oindicates NO)
NO in all
Output: X Denotes allowed access 1 indicates YES and0 indicates
cases
Draw the truth table for the inputs and outputs given above. Write the
POS expression for X (A, S, C, L).
(ii) Reduce the above expression X (A, S, C, L) by using 4-variable Karnaugh map, [5]
showing the various groups (1.e., octal, quads and pairs).
Draw the logic gate diagram using NOR gates only for the reduced expression.
Assume that the variables and their complements are available as inputs.

1225-868A 7 Turn over


Question 4
(4|
S) = E(0,1,2,5,7,8,9, 10,13,15)
(i) (a) Keduce the Boolean function FOp. o. R. the various groups
by using 4-variable Karnaugh map, showing
(i.e., octal, quads and pairs). [1|
gates only for the reduced
(0) Draw the logic gate diagram using NAND complements are available as
CXpress1on. Assume that the variables and their
inputs.
(ii) From the logic gate diagram given below:

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

What will be the output of the above gate when:

(a) A=1,B=0

(b) A=1, B=1

1225-868A 8
SECTION B

Answer any two questions.


logicofthe problem.
Each program should be written in such away that it clearly depicts the
This can be achieved by using mnemonic names and comments in the program.
(Flowcharts and Algorithms are not required.)
The programs must bewritten in Java.
Question 6
number system from [10]
A class Perni has been defined to accept a positive integer in binary
the user and display if it is a Pernicious number or not.
of two digits and has prime
[A permicious number is a binary number that has minimum
number of l's in it.]
Examples:
and 2 is prime number.
101 is a pernicious number as the number of 1's in 101 =2
10110 = 3 and 3 is prime
10110 is a pernicious number as the number of1's in
number.
of1's in 11ll = 4 and 4 is
1111 is a NOT apernicious number as the number
NOT a prime number.

The details of the members of the class are given below:


Class name Perni
Data member/instance variable:

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

Output: Sum of corresponding columns is equal.


The details of the members of the class are given below:
Class name Colsumn

Data members/instance variables:

to store the integer array elements


mat[ ] [ ]
m
to store the number of rows

to store the number of columns

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

todisplay the array elements


void print() constructor(ínt, int), void readArrav( )
Colsum giving details of the
Specify the class void print( ). Define the main() function
to create
boolean check(Colsum, Colsum), and
accordingly to enable the task.
objects and callthe functions

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:

word to store a word

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

Answer any woquestions.


clearly depicts the logic oj lhe problem
Lacn prOgram should be written in such awav that it
stepwise.
achieved by using comments in the progran and mnemonic names or pseudo codes jOr
TnIS Can be
the algorithms must be written in generat 7
agorithms. The programs must be written in Java and
standardform, wherever required / specified.
(Flowcharts are not required.)

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:

array to hold integer values

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

void print( ) todisplay the elements of the circular queue in


the order of front to rear
of the functions void push(int) and
Specify the class CirQueue giving the detailshave |4]
functions been defined
int remnove( ). Assume that the other
need NOT be written.
The main( )function and algorithm
queue.
(ii) State one application of a circular [1|

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:

Flight(...) parameterised constructor to assign values to the


data members

void show( ) to display the flight details


Class name Passenger
Datamembers/instance variables:
id to store the ID of the passenger
naine
to store the name of the passenger

tax to store the tax to be paid in decimal


tot to store the total amount to be paid in decimal
Methods/Member functions:
parameterised constructor to assign values to the
Passenger(...) data members of both the classes
total
to calculate the tax as 5% of base fare and
void cal) amount (base fare + tax)
the
void show( ) to display the flight details along with
passenger details and total amount to be paid
defined. Using the concepts of
Assume that the super class Flight has been the details of constructor(..),
Inheritance, specify the class Passenger giving
void cal() and void show().
need NOT be written.
The super class, main function and algorithm
Turn over
1225-868A 13
Question 11
(i) A linked list is class structure of the
formed from the objects of the class Cell. The [2]
Cell is given below:
class Cell

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

You might also like