## Year 2006

0

**ISC 2006**

**COMPUTER SCIENCE PAPER 1**

**THEORY**

**PART I**

**Answer all questions in this part**

**Question 1.**

a) State the two Absorption Laws of Boolean Algebra. Verify any one of them using the truth

table.

b) Find the complement of F(M,N,O) = M’NO’ + M’N’O

c) Write the Product of Sum for the Boolean function, F(A,B,C) whose output is 0 only when:

A=1, B=0, C=0

A=0, B=1, C=0

A=0, B=0, C=1

A=1, B=1, C=1

d) Simplify AB + A’C +BC using laws of Boolean Algebra. At each step state clearly the law used

for simplication.

e) Why is the NOR gate regarded as a Universal Gate? Draw the logic gate symbol and make

the truth table for the two input NOR Gate.

[ 2 x 5 = 10]

Question 2.

a) Convert the following infix expression to its postfix form:

A + [ (B+C) + (D+E)*F)]/G

b) In an array of real numbers ARR[25][25], ARR[1][1] is stored in location 1000. Find the

address of ARR[12][12] when the array is stored row major wise. Assume each real number

requires 4 bytes.

c) Reduce the following three input function into its simplest form:

F(X,Y,Z) = Σ(0,1,3,5)

d) Define a queue. How is a dequeue different from a queue?

e) Define encapsulation and polymorphism.

[ 2 x 5 = 10]

**Question 3.**

a) Give the output of the following program segment:-

class Stack

{

final int size = 50;

private int stak[];

private int top;

public Stack()

{

top=0;

stak=new int[size];

}

public void push(int x)

{

stak[++top]= x;

}

public int pop()

{

return stak[top–];

}

public void main()

{

Stack s1=new Stack();

s1.push(51);

s1.push(27);

s1.push(5);

System.out.println(“\n”+s1.pop());

System.out.println(“\n”+s1.pop());

s1.push(18);

s1.push(72);

s1.push(517);

System.out.println(“\n”+s1.pop());

}

}

b) Give the output of the following program segment:-

int x=0;

do

{

if(x<3)

{

x+=2;

System.out.println(x);

continue;

}

else

{

System.out.println(++x);

break;

}

}

while(x<10);

[ 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) = Σ(1,6,7,8,9,10,14,15)

Use Karnaugh’s map to reduce the function F, using the SOP form. Draw a

logic gate diagram for the reduced SOP form. You may use gates with more than 2 inputs.

Assume that the variables and their complements are available as inputs.

b) Given X(A,B,C,D)= Π(0,2,3,4,5,11,12,13)

Use Karnaugh’s map to reduce the function X, using the POS form. Draw a

logic gate diagram for the reduced POS form. You may use gates with more than 2 inputs.

Assume that the variables and their complements are available as inputs.

[ 5 X 2 = 10]

**Question 5.**

The National College of Journalism is offering courses in three different categories of journalism,

which are the print, the web and the broadcasting media.

A student is eligible to apply if he/she satisfies any one of the following conditions:-

The student is a graduate in any discipline with an aggegrate percentage of 75 or above and

with a record of literary skills.

OR

The student is a graduate in Mass Communication with an aggregate percentage of 75 or

above

The inputs are :

A : Graduate in any discipline

B : Graduate in Mass Communication

C : Aggregate percentage of 75 and above

D : Record of literary skills

Output:-

R : Denotes eligible to apply [ 1 indicates Yes and 0 indicates No in all cases]

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

R(A,B,C,D)

b) Reduce R(A,B,C,D) using Karnaugh map.

Draw a logic gate diagram for the reduced SOP expression for R(A,B,C,D) using AND & OR

gates. You may use gates with more than 2 inputs. Assume that the variables and their

complements are available as inputs.

[ 5 x 2 = 10]

**Question 6.**

a) What is a decoder? Draw the truth table and a logic circuit diagram for a 2 by 4 decoder.

[ 4 ]

b) What is a half adder? Draw the truth table, derive its Boolean expression and draw a logic

diagram for Half adder. [ 6 ]

Question 7.

a) What is XNOR gate? Draw a truth table representing a 2 input XNOR operation. Derive its

SOP expression and draw its logic gate diagram. [ 5 ]

b) Write the SOP expression corresponding to the following truth table and draw its logic gate

diagram. [ 2 ]

A | B | C | F |

0 | 0 | 0 | 0 |

0 | 0 | 1 | 0 |

0 | 1 | 0 | 1 |

0 | 1 | 1 | 1 |

1 | 0 | 0 | 0 |

1 | 0 | 1 | 0 |

1 | 1 | 0 | 1 |

1 | 1 | 1 | 1 |

4

c) Draw the logic gate diagram for the Boolean function F(A,B,C)= (A’+B).(B’+C) making use of

NOR gates only. [ 3 ]

Question 8.

a) Using truth table prove that

(A+B)’ +(A+B’)’=A’

[2]

b) Convert (X’+Y+Z’).(X+Y’+Z).(X+Y+Z’).(X+Y+Z) into SOP form. [3]

c) Prove that [(P’+Q).(Q’+R)]’ + (P’+R) = 1 [3]

d) Differentiate between selection and insertion sort. [2]

**Section B**

**Answer any 4 questions**

**Question 9.**

A class Telcall calculates the monthly telephone bill of a consumer. Some of the members of the

class are given below:

Class Name : Telcall

Data Members

phno : phone number

name : name of consumer

n : number of calls made

amt : bill amount

Member functions

Telcall( ) : Parameterised constructor to assign values to data

members

void compute() : to calculate the phone bill amount based on the slabs given

below.

void dispdata() : to display the details in the specified format.

Number of calls Rate

1-100 Rs. 500/- rental charge only

101-200 Re. 1.00/- per call + rental charge

201-300 Rs.1.20/- per call + rental charge

Above 300 Rs.1.50/- per call + rental charge

The calculation needs to be done as per the slabs.

Specify the class Telcall, giving the details of the constructor, void compute() and void dispdata().

In the main function, create an object of type Telcall and display the phone bill in the following

format:

Phone number Name Total calls Amount

XXXXXXXXX XXXXX XXXXX XXXXX

[ 10 ]

**Question 10.**

A class Stock is designed to maintain the inventory of books that are being sold at a shop. Some

members of the class are given below:

Class Name : Stock

Data members

title to store the book title

author to store author’s name

publisher to store publisher name

noc : total number of copies available

price : unit price per copy

Member functions

Stock() : constructor to assign values to data members

void check(String tit, String auth,int n) check title, author, number of copies required. If

available , find the total price and update the stock.

If not available display the appropriate message.

void disp() : to display title, author, publisher, unit price of book,

total price to be paid for copies required and the

remaining in stock.

Write a program defining a class Stock and giving details of the constructor and other functions.

[10]

**Question 11.**

A ticket at a ticket selling booth at a fair is priced at Rs. 2.50/-. The booth keeps track of the total

number of people who have visited the booth, the number of people who have actually purchased a

ticket and the total amount of money collected. Design a class called Ticbooth which includes the

following Members:

Class name : Ticbooth

Data members

no_people : number of people who have visited the booth

amount : total amount of money collected

Member functions

void intial() : to assign initial values to data members

void notsold() : increment total number of people only visiting the

booth and not purchasing a ticket.

void sold() : increment total number of people purchasing a

ticket

and amount collected when ticket is sold.

void disp_totals() : to display total number of people visiting the booth

(the

total number of people purchasing the ticket as well

as

those not purchasing a ticket).

void disp_ticket() : to display the total number of tickets sold and the

amount collected.

Specify the class Ticbooth giving details of functions void initial(), void sold(), void notsold(), void

disp_totals() and void disp_ticket(). The main function need not be written. [10]

**Question 12.**

A class Hifact has been defined to find the HCF of two numbers using the recursive technique. This

HCF is used to find the LCM of two numbers. Some members of the class are given below:-

Class name : Hifact

Data members

a

b

hcf

lcm : integers

Member functions

Hifact() : constructor to assign initial values to data members

void getdata() : to input values of a and b

void change() : to swap a and b if a> b

int rechcf(int, int) : to find hcf using recursive technique

int fn_lcm(int,int,int) : to find lcm using a,b and hcf

void result() : to invoke rechcf() and fn_lcm() and to print lcm, hcf

of

the two numbers a and b.

Specify the class Hifact giving details of constructor, void getdata(), void change(), int rechcf() and int

fn_lcm(). Write the main function and find the hcf and lcm of any two integers a and b. [10]

**Question 13.**

A class Sort contains an array of 50 integers. Some of the member functions/ data members are

given below:

Class name : Sort

Data members

arr[] : integers

item : number to be searched for in the array

Member functions

void inpdata() : to input 50 integers (no duplicate number to be

entered)

void bubsort() : to sort the array in ascending order using the

bubblesort technique And to display the sorted list.

void binsearch() : to input item and search for it using the binary

search

technique; if found to print the item searched and

its position in the sorted list, otherwise to print an

appropriate message.

Specify the class Sort giving details of the functions void inpdata(), void bubsort() and void

binsearch(). The main function need not be written.

[10]

**Question 14.**

Design a class Stringfun to perform various operations on strings without using built –in functions

except for finding length of the string. Some of the member functions and data members are given

below:

Class name : Stringfun

Data members

str : to store a string

Member functions

void input() : to accept the string

void words() : to find and display the number of words, number of

vowels and number of uppercase characters in the

string.

void frequency() : to display the frequency of each character within the string.

Specify the class Stringfun giving details of the functions void input(), void words() and void

frequency(). You do not need to write the main function.

[10]

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