## Year 2005

**ISC 2005**

**COMPUTER SCIENCE PAPER 1**

**THEORY**

**PART I**

**Answer all questions in this part**

**Question 1.**

a) State the distributive law. Verify it using the truth table.

b) What is the canonical form of Boolean expression? State the two types of canonical form.

c) Using NOR gates only draw AND, OR and NOT gate.

d) What is the application of Boolean Algebra in Computer Science?

e) Reduce the following to its simplest form using laws of Boolean Algebra. At each step state

the law used for simplification. AB’+A’BC’+(AC)’+BC

[ 2 X 5 = 10]

**Question 2.**

a) What is data structure? What are the different types of data structure?

b) With a suitable example state the difference between runtime and syntax error.

c) State the different applications of stack.

d) Convert the following into postfix: (A+B/C) + B –C * D +C

e) An array ARR[10][5] is stored in memory with each element requiring 2 bytes of storage. If

the first element ARR[0][0] is stored at the location 1250, calculate the location of ARR[5][6]

when the array is stored row major wise.

[ 2 X 5 = 10]

**Question 3.**

a) What will be the values stored in ar[] after the following program is executed.

public static void main(String args[])

{

int i,j=1;

int dividend=2,N=30;

int ar[]={2,0,0,0,0,0,0,0,0,0};

while(dividend<=N)

{

for(i=2;i

{

if(dividend %i==0)

{

break;

}

if(i==dividend-1)

{

ar[j++]=dividend;

}

}

dividend++;

}

}

b) The following function is a function of some class. It computes the quotient and remainder

of a division.

public void quotientrem()

{

int dividend=13,divisor=2,quo=?1?;

int rem;

while(dividend>=?2?)

{

dividend-=?3?;

rem=?4?;

quo=?5?;

}

rem=dividend + divisor;

}

i) What is the expression / value at ?1?

ii) What is the expression / value at ?2?

iii) What is the expression / value at ?3?

iv) What is the expression / value at ?4?

v) What is the expression / value at ?5?

[ 5 x 2 = 10]

**PartII**

**Answer any seven questions in this part, choosing three questions from Section A and four questions**

**from Section B.**

**Section A**

**Answer any three questions.**

**Question 4.**

a) Given the Boolean function

F(A,B,C,D)= Σ(0,1,2,4,5,7,11,13,15)

Use Karnaugh’s map to reduce this function F, using the given SOP form. Draw ligic gate

diagram for the reduced SOP form. You may use gates with more than two inputs. Assume

that variables and their complements are available as inputs.

b) Now given

X(A,B,C,D)= Π(2,3,4,7,9,10,11,12)

Use Karnaugh’s map to reduce this function F, using the given POS form. Draw logic gate

diagram for the reduced POS form. You may use gates with more than two inputs. Assume

that variables and their complements are available as inputs.

[5x 2 =10]

**Question 5.**

The Past Pupil Association of R.K.University Computer Science Department is organizing a reunion

function at the campus. The invitation card is to be issued to a person if –

The person is an ex – student of the department and had passed out in 1995.

OR

The person is not an ex- student of the department but passed out from the university in

1995 and has made a contribution of Rs. 1000.

The inputs are :

E : The person is an ex student of the department.

U : The person is not an ex student of the department, but a student of the same university.

P : The person passed out in 1995.

S : The person contributes Rs. 1000.

[1 indicates yes and 0 indicates no in all cases ]

Output:-

I : Denotes the invitation card is issued.

a) Draw the truth tables for the inputs and outputs given above and write the SOP expression

for(E(I,U,P,S).

b) Reduce I(E,U,P,S) USING Karnaugh’s map.

Draw the logic gate diagram for the reduced expression for I(E,U,P,S) using AND, OR gates. You may

use gates with 2 or more inputs. Assume that variables and their complements are available as

inputs.

[5 x 2 =10]

**Question 6.**

a) What is an encoder? State its application. [2]

b) Draw the truth table and logic circuit diagram for converting a decimal number to binary.

Explain the working principle with an example. [6]

c) Verify that :-

(Z+X).(Z+X’+Y)= (Z+X). (Z+Y) [2]

**Question 7.**

a) State the difference between half adder and full adder circuit. [2]

b) Draw the truth table and logic diagram of a full adder. [5]

c) Using two half adder and an OR gate construct a full adder. [3]

**Question 8.**

a) Prove that F(A,B,C)=Π(2,3,4,7)=Σ(0,1,5,6) [3]

b) State the dual form of the following:

XY’(XY’Z+X+X’Z’) [3]

c) State the difference between encoder and multiplexer circuit. [2]

d) Using NOR gates only draw a logic diagram to construct NAND gate. [2]

**Section B**

**Answer any 4 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.**

**Question 9.**

Sum= 1 + x/1!+x3/2!+x5/3!+……..+x2n-1/n!

A class seriessum has been defined to calculate the sum of the above series. Some of the members

of the class are given below:

Class name : seriessum

Data members

x

n : int

sum : double

Member functions

sumseries() : constructor

int factorial(int n) : calculates and returns the factorial of n( n!) where n!=1 x 2 x

3 x 4 x….x n.

double term(int p, int q) : Calculates and returns the value of p/q! by making use of

factorial(int).

void accept() : Inputs the value of member data x,n

void displaysum() : displays the value of member data sum.

double calsum() : calculates the sum of the given seriesusing the appropriate

data and other member functions.

a) Specify the class sumseries giving details of the constructor, int factorial(int), double

term(int,int), void displaysum(). You may assume that other member functions are written

for you. You do not need to write the main function. [8]

b) What care do you need to take while designing double term(int, int). [2]

**Question 10.**

Class indexedarray contains the employee code of 100 employees. Some of the members are given

below:-

Class name : indexedarray

Data member

arr[] : int array

Member functions

indexedarray() : to assign the code to 0.

void fillarray() : to input the code in the arr[].

void sortarr() : to sort the array variable using selection sort

technique.

int binarysearch(int[],int) : to search and return 1 if an employee code is found

in the array object otherwise returns 0.

Specify the class indexedarray giving details of the constructor, void sortarr(), int binarysearch(). You

may assume that other member functions are written for you. You do not need to write the main

function. [10]

**Question 11.**

A class quad contains the following data members and member functions to find the roots of a

quadratic equation.

Class name : quad

Data members

a

5

b

c

x1

x2 : float

Member functions

quad(float,float,float) : constructor to assign values to data members.

float discriminant() : to return discriminant[b²-4ac].

void root_equal() : to display the root if both roots are equal.

void imag() : to display the roots, if roots are imaginary.

void root_real() : to display two real, unequal roots.

void root() : to call other appropriate functions to find the

solution of the problem.

If ax + bx +c =0 is the quadratic equation, then if b² – 4ac >0 – roots are real, unequal

Where,

x1 = -b + √(b²-4ac)/(2a)

x2 = = -b – √(b²-4ac)/(2a)

If b= -b + √(b²-4ac)/(2a) – 4ac =0 – roots are real, equal.

x1=x2=-b/2a

If b2-4ac<0 – roots are imaginary.

Specify the class quad giving the details of the functions:-

quad(float , float, float)

float discriminant()

void root_real()

void root()

You may assume that the other functions are written for you. You need write the main function.

[10]

**Question 12.**

A class recursion has been defined to find the Fibonacci series up to a limit. Some of the members of

the class are given below:

Class Name : recursion

Data Members

a

b

c

limit : int

Member functions

recursion() : constructor to assign a,b,c with appropriate values.

void input() : to accept the limit of the series.

int fib(int n) : to return the nth Fibonacci term using recursive

technique.

void genearatefibseries() : to generate the Fibonacci series up to the given limit.

a) Specify the class recursion giving details of the constructor, int fib() , void

generatefibseries(). You may assume other functions are written for you and you need not

write the main function. [8]

b) Why recursive functions result into slower execution of the program? [2]

**Question 13.**

A class Iscscores defines the scores of a candidate in six subjects and another class bestfour defines

the best four subjects.

The details of both the classes are given below:-

Class name : Iscscores

Data members

number[6][2] : int array to store marks of 6 subjects and subject code.

Member functions

Iscscores() : constructor to accept the marks

int point() : to return the point in each subject according to the

following:

Marks>=90 1 point

80-89 2 points

70-79 3 points

60-69 4 points

50-59 5 points

40-49 6 points

Class name : bestfour

Member functions

void bestsubjects() : to display the total points and best four subject codes using

the concept of inheritance.

Specify the class details of both the classes using the concept of inheritance. Specify the details of

the constructor and all other functions. You may assume that all other functions are written for you.

[10]

**Question 14.**

A class stringop is designed to handle string related operations. Some members of the class are given

below:

Date member

txt : to store the given string of maximum length 100.

Member function

stringop() : constructor

void readstring() : to accept the string

char caseconvert(int, int): to convert the letter to other case

void circular decode() : to decode the string by replacing each letter by converting it

to opposite case and then by the next character in a circular

way. Hence “AbZ” will decode “bCa”.

Specify the class giving details of all member functions . You do not need to write function main().

[ 10]

**************

Comments

very nice collection and made my work very easier