ISC 2006
COMPUTER SCIENCE
PAPER-I
(THEORY)
(Three hours)
(Candidates are allowed additional 15 minutes for only reading the paper. They must not start writing during this time)
------------------------------------------------------------------
Answer all Question in Part I (compulsory) and seven questions from Part II, choosing three questions from Sections A and four questions from
Section B. All working, including rough work, should be done on the same sheet as the rest of the answer. The intended marks for questions or for parts of questions are given in brackets[].
------------------------------------------------------------------
PART I
Answer all questions.
while answering questions in this part indicate briefly your working reasoning wherever required.
Question 1. [10]
(a) State the two Absorption Laws of Boolean Algebra. Verify any one of
them using the truth table.
Ans: two absorption Laws are: (i) X + XY = X (II) X (X
+ Y) = X
Column X and X + XY are identical. hence proved. | ||||||||||||||||||||||||
|
(b) Find the complement of F(m,n,o)=m'.n.o'+m'.n'.o
Ans: (m'.n.o'+m'.n'.o)' =(m'.n.o')'.(m'.n'.o)' =(m+n'+o).(m+n+o') =mm+mn+mo'+n'm+n'n+n'o+om+on+oo' =m+mn+mo'+n'm+n'o+om+on [o.o'=0] =m+mo'+n'm+n'o+om+on [m+mn=m] =m+m(o'+o)+n'm+n'o+on [o+o'=1] =m+m+n'm+n'o+on [m+m=m] =n'm+o(n'+n) =n'm+o [n'+n=1] |
(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
Ans: The truth table for the expression is:
Product of Sum (POS) for the boolean function F(A,B,C) is (A+B+C)(A+B'+C)(A'+B+C)(A'+B'+C') |
(d) Simplify a.b+a'.c+b.c using the laws of Boolean Algebra.
At each step state clearly the laws used for simplification.
Ans: a.b + a'.c + b.c a.b.(c+c')+a'c+bc abc+abc'+a'c+bc bc+abc'+a'c |
(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.
Ans: |
Question 2.
(a) Convert the following infix expression to its postfix form:
A+[(B+C)+(D+E)*F]/G
Ans: |
|
(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.
Ans: |
(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 deque different from a queue?
Ans: |
(e) Define Encapsulation and Polymorphism.
Ans: The wrapping up to data and methods into a single units
(called class) is known as encapsulation. Encapsulation property hides the
inner working of objects from the real world. Polymorphism: It is the ability for a message or data to be processed in more then one form. Example Function Overloading. |
Question 3.
(a) Give the output of the following program segment: [5]
#include <iostream.h>
#include <conio.h>
const int SIZE=50;
class Stack
{
private:
int stak [SIZE];
int top;
public:
Stack()
{
top=0;
}
void push(int x)
{
stak[++top]=x;
}
int pop()
{
return stak[top--];
}
};
void main()
{
clrscr();
Stack sl;
sl.push(51);
sl.push(27);
sl.push(5);
cout<<"\n"<<sl.pop();
cout<<"\n"<<sl.pop();
sl.push(18);
sl.push(72);
sl.push(517);
cout<<"\n"<<sl.pop();
getch();
}
Ans:
5 27 517 |
|
(b) Give the output of the following program segment. [5]
int x = 0;
do
{
if(x<3)
{
x += 2;
cout<<x;
}
else
{
cout<<++x;
break;
}
}while(x<10);
Ans: 245 |
PART II
Answer seven questions in this Part, choosing three questions from Section A and four from Section B.
SECTION A
Answer any three questions.
Question 4.
(a) Given the Boolean function F(A,B,C,D)= E(1,6,7,8,9,10,14,15) [5]
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 two inputs. Assume that the variables and their complements
are available as inputs.
|
Quad is m7+m6+m15+m14
Pair 1 is m10+m8 Pair 2 is m1+m9 Reduce Expression for Quad is BC Reduce Expression for Pair 1 is AB'D' Reduce Expression for Pair 2 is B'C'D Final SOP expression is BC+AB'D'+BC'D | |||||||||||||||||||||||||
(b) Given:- X(A,B,C,D)=II(0,2,3,4,5,11,12,13) [5]
Use Karnaugh's map to reduce this function X using the given POS form.
Draw a logic gate diagram for the reduced POS form. You may use gates
with more than two inputs. Assume that the variables and their
components are available as inputs.
|
Quad is m4+m5+m12+m13
Pair 1 is m0+m2 Pair 2 is m3+m10 Reduce Expression for Quad is A+C Reduce Expression for Pair 1 is A+B+D Reduce Expression for Pair 2 is B+C'+D' Final POS expression is (A+C).(A+B+D).(B+C'+D') | |||||||||||||||||||||||||
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 aggregate percentage of 75 or above and with a record of literacy 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 tables for the inputs and outputs given above and write the SOP expression for R(A,B,C,D). [5]
|
The Function value is: R(A,B,C,D)=E(6,7,11,14,15) The SOP Expression for R(A,B,C,D) is A'BCD' + A'BCD + AB'CD + ABCD' + ABCD |
(b) Reduce R(A,B,C,D) using Karnaugh's 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 two or more inputs. Assume that the variables and their complements are available as inputs. [5]
|
1 Quad (m6+m7+m14+m15) 1 pair (m11+m15) Simplified Expression for Quad is BC Simplified Expression for Pair is ACD So final Reduced Expression is BC+ACD
| |||||||||||||||||||||||||
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 an 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]
(c) Draw the logic gate diagram for the Boolean function [3]
F(A,B,C)=(A'+B).(B'+C) making use of NOR gates only.
Questions 8.
(a) Using the truth table, prove that [2]
(A+B)'+(A+B')'=A'
(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 sort and Insertion sort. [2]
SECTION B
Answer only four 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. (Flow charts and Algorithms are not required).
(The program must by written in C++ OR Java)
Question 9.
A class Telcall calculates the monthly phone bill of a consumer. Some of the members of the class are given below:
Class name | Telcall |
Data members/instance variable | |
phno name n amt |
phone number
name of consumer number of calls made bill amount |
Member functions/methods | |
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 Rs. 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 calculations need 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
XXXXXXXXXXXX XXX XXXXXXXX XXXX
#include<iostream.h> #include<conio.h> #include<string.h> #include<stdio.h> #include<iomanip.h> class Telcall { long int phno; int n; double amt; char name[30]; public: Telcall(long int pno,int nc,char nam[30]) { phno=pno; n=nc; amt=0.0; strcpy(name,nam); } void compute() { if(n<=100) amt=500; if(n>=101 && n<=200) amt=500+(n-100)*1.00; if(n>=201 && n<=300) amt=500+100+(n-200)*1.20; if(n>300) amt=500+100+120+(n-300)*1.50; } void dispdata() { cout<<setw(13)<<"Phone Number"<<setw(20)<<"Name"<<setw(15)<<"Total Calls"<<setw(15)<<"Amount"<<endl; cout<<setw(13)<<phno<<setw(20)<<name<<setw(15)<<n<<setw(15)<<amt; } }; void main() { clrscr(); long int pn; int n; char name[30]; cout<<"Enter Phone Number : "; cin>>pn; cout<<"Enter number of Calls : "; cin>>n; cout<<"Enter Consumer Name : "; gets(name); Telcall T(pn,n,name); T.compute(); |
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/instance variables: | |
title, author, publisher noc price |
char type title, author, publisher name. total number of copies available. unit price per copy. |
Member functions/methods: | |
Stock() |
Constructor to assign values to data members. |
void check(char tit[],char aut[],int n) | check the title, author, number of copies required. If available, find the total price and update the stock. If not available, display an appropriate message. |
void disp() |
to display title, author, publisher, unit price of book, total price to be paid for copies required and the remaining copies in stock. |
Write a program defining a class Stock and giving details of the constructor and other associated functions.
#include<iostream.h> #include<conio.h> #include<string.h> #include<stdio.h> #include<iomanip.h> class Stock { char title[50],author[50],publisher[100]; int noc,price; double amt; public: Stock() { strcpy(title,"COMPUTER APPLICATION"); strcpy(author,"SUMITA ARORA"); strcpy(publisher,"DHANPAT RAI"); noc=50; price=140; } void Check(char tit[50],char aut[50], int n) { if(strcmp(title,tit)==0 && strcmp(author,aut)==0 && n<=noc) { amt=price*n; noc-=n; } else cout<<"Invalid Book details/not sufficient stock"<<endl; } void Disp() { cout<<"Title : "<<title<<endl; cout<<"Author : "<<author<<endl; cout<<"Publisher : "<<publisher<<endl; cout<<"Price : "<<price<<endl; cout<<"Paid Amount : "<<amt<<endl; cout<<"Copies Remaining on Stock : "<<noc<<endl; } }; void main() { clrscr(); int n; char tit[50],aut[50]; cout<<"Enter Title : "; gets(tit); cout<<"Enter Author : "; gets(aut); cout<<"Enter No. of Copies : "; cin>>n; Stock S; S.Check(tit,aut,n); S.Disp(); getch(); } |
Questions 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 initial() | 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 the amount collected when a ticket is sold. |
void disp_totals() |
To display the 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 the functions void initial(), void sold(), void notsold(), void disp_totals() and void disp_ticket(). The main function need not be written.
Questions 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 the two numbers. Some members of the class are given below:
Class name | Hifact |
Data members/instance variables | |
a,b,hcf,lcm | integers |
Member functions/methods: | |
Hifact |
constructor to assign initial values to the data members. |
void getdata() | to input values of a and b. |
void change() | to swap a and b if a>b |
int rechef(int,int) |
to find hcf using the 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 the 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.
#include<iostream.h> #include<conio.h> class Hifact { int a,b,hcf,lcm; public: Hifact() { a=0; b=0; hcf=1; lcm=1; } void getdata() { cout<<"Enter First Number : "; cin>>a; cout<<"Enter Second Number : "; cin>>b; } void change() { if(a>b) { int t=a; a=b; b=t; } } int rechcf(int x,int y) { int t; if(y%x==0) { return(x); } else { t=y; y=x; x=t%x; return(rechcf(x,y)); } } int fn_lcm(int x,int y,int HCF) { return((x*y)/HCF); } void result() { hcf=rechcf(a,b); lcm=fn_lcm(a,b,hcf); cout<<"The LCM of two numbers "<<a<<" & "<<b<<" is "<<lcm<<endl; cout<<"The HCF of two numbers "<<a<<" & "<<b<<" is "<<hcf<<endl; } }; void main() { clrscr(); Hifact H; H.getdata(); H.result(); getch(); } |
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/instance variables | |
arr[] | integers |
item | number to be searched for in the array |
Member functions/methods | |
void inpdata() |
to input 50 integers (no duplicate members are to be entered) |
void bubsort() |
to sort the array in ascending order using the bubble sort 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 the details of the functions void inpdata(),
void bubsort() and void binsearch(). The main function need not be written.
#include <iostream.h> #include <conio.h> class Sort { public: int arr[5],item; void inpdata() { int i=0,n,flag; while(i<5) { cout<<"Enter a Number : "; cin>>n; flag=0; for(int j=0;j<i;j++) { if(arr[j]==n) { flag=1; } } if(flag==0) { arr[i]=n; i++; } else cout<<"Duplicate number entered"<<endl; } } void bubsort() { int small,pos,i,j; for(i=0;i<4;i++) { for(j=0;j<5-i-1;j++) { if(arr[j]>arr[j+1]) { int k=arr[j]; arr[j]=arr[j+1]; arr[j+1]=k; } } } cout<<"Array after Sorting"<<endl; for(i=0;i<5;i++) cout<<arr[i]<<endl; } void binsearch() { int m,l=0,h=4; char ans='n'; while(h>=l && ans=='n') { m=(l+h)/2; if(arr[m]>item) h=m-1; else if(arr[m]<item) l=m+1; else { ans='y'; break; } } if(ans=='y') cout<<"Number found in Position "<<m+1; else cout<<"Number not present in list"; } }; |
Question 14.
Design a class Stringfun to perform various operations on strings without
using built-in functions except for finding the length of the string. Some
of the member functions/data members are given below:
Class name | Stringfun |
Data members/instance variables | |
str | to store the string |
Member functions/methods | |
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 frequency of each character within the string. |
Specify the class Stringfun giving the details of the functions void input(), void words() and void frequency(). You do not need to write the main function.
#include<iostream.h> #include<conio.h> #include<stdio.h> class Stringfun { char str[50]; public: void input() { cout<<"Enter a Sentence : "; gets(str); } void words() { int word=0,upper=0,vowel=0; for(int i=0;str[i]!='\0';i++) { if(str[i]==' ') word++; if(str[i]>=65 && str[i]<=90) upper++; if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u') vowel++; if(str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U') vowel++; } cout<<"Number of Words : "<<(word+1)<<endl; cout<<"Number of Vowels : "<<vowel<<endl; cout<<"Number of Uppercase Letter : "<<upper<<endl; } void frequency() { int c,ctr; for(c=65;c<=90;c++) { ctr=0; for(int i=0;str[i]!='\0';i++) if(str[i]==c) ctr++; if(ctr!=0) cout<<"Number of times Character ("<<(char)c<<") present "<<ctr<<endl; } for(c=97;c<=122;c++) { ctr=0; for(int i=0;str[i]!='\0';i++) if(str[i]==c) ctr++; if(ctr!=0) cout<<"Number of times Character ("<<(char)c<<") present "<<ctr<<endl; } } }; void main() { Stringfun S; S.input(); S.words(); S.frequency(); getche(); } |
=*=*=*=*=*=