Isc 2006
Isc 2006
COMPUTER SCIENCE
PAPER-I
(THEORY)
(Three hours)
Show/Hide Answer
(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
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
(c) Write the product-of-sum for the Boolean function F(A,B,C) whose output
is 0 only when:
(A+B+C)(A+B'+C)(A'+B+C)(A'+B'+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+[(B+C)+(D+E)*F]/G
Ans:
(c) Reduce the following three-input function into its simplest form:
F(X,Y,Z)= (0,1,3,5)
X\YZ 00 01 11 10
0 0 1 3 2
1 4 5 7 6
Question 3.
#include <iostream.h>
#include <conio.h>
class Stack
private:
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:
27
517
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
Question 4.
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
1
3 2
[01]A'B
4
5
6
[11]AB
12
13
15
14
[10]AB'
9
11
10
Quad is m7+m6+m15+m14
Pair 1 is m10+m8
Pair 2 is m1+m9
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
0
1
2
[01]A+B'
7
6
[11]A'+B'
12
13
15
14
[10]A'+B
8
9
11
10
Quad is m4+m5+m12+m13
Pair 1 is m0+m2
Pair 2 is m3+m10
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 literary skills.
OR
Output:-
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]
Input
Output
A B C D R
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 1
0 1 1 1 1
1 0 0 0 0
1 0 0 1 0
1 0 1 0 0
1 0 1 1 1
1 1 0 0 0
1 1 0 1 0
1 1 1 0 1
1 1 1 1 1
1
3
2
[01]C'D
6
[11]CD
12
13
15
1
14
[10]CD'
8
9
11
10
1 Quad (m6+m7+m14+m15)
1 pair (m11+m15)
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]
Questions 8.
(A+B)'+(A+B')'=A'
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).
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
amt
phone number
name of consumer
bill amount
Member functions/methods
Telcall()
to calculate the phone bill amount based on the slabs given below.
void dispdata()
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:
#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();
T.dispdata();
getch();
}
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:
noc price
char type title, author, publisher name.
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
Member functions/methods:
Hifact
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()
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.
using built-in functions except for finding the length of the string. Some
to find and display the number of words, number of vowels and number of uppercase characters in the
string.
void frequency()
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();
}
=*=*=*=*=*=