Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

THE VELAMMAL INTERNATIONAL SCHOOL

COMPUTER SCIENCE(083)

Midterm Work Sheet-1

1.Simplify A+A’B+AB’C

2.Prove that (R+S’)(R+S)(R’+S)=RS

3. Correct the following boolean statements:

(i) X+1 = X (ii) (A')'=A' (iii) A+A'=0 (iv) (A+B)' = A.B

4. If F(p,q,r,s)=∏ (3,4,5,6,7,13,15),obtain the simplified form using K-map.

5. If F(a,b,c,d)=Σ(0,2,4,5,7,8,10,12,13,15), obtain the simplified form using K-map.

6. Draw the equivalent logic circuit for the following Boolean expressions a.A.(B+C’)

b.X+Y(W.Z)

7. Convert the following Boolean expression into its equivalent Canonical Product of Sum form (POS):
A.B’.C + A’.B.C +A’.B.C’

8.Convert the following Boolean expression into its equivalent Canonical Sum of Product Form((SOP)

(X’+Y+Z’).(X’+Y+Z).(X’+Y’+Z).(X’+Y’+Z’)

9. Write the POS and SOP form of a Boolean Function F, which is represented in a truth table.

P Q R F
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1

10. A majority gate is a digital circuit whose output is 1 if the majority of inputs are 1’s. The output is 0
otherwise. By means of a truth table, find the Boolean function implemented by 3‐input majority gates.

11.Represent the following Boolean expression

X(Y’+Z) using NORgates only

XY’Z+X’YZ using NAND gates only

12. Answer the questions (i) to (iv) after going through the following class.

Class NATION

{
int H;

protected:

int S;

public:

void INPUT();

void OUTPUT();

};

class WORLD: private NATION

int T;

protected:

int U;

public:

void INDATA(int, int);

void OUTDATA();

};

class STATE: public WORLD

int M;

public:

void DISPLAY(void);

};

(i) Name the type of inheritance depicted here?


(ii) Name the data member(s) that can accessed from function DISPLAY()

(iii)Name the member function(s) which can be accessed from the objects of class STATE.

(iv)Is the member function OUTPUT() accessible by the objects of the class WORLD.Justify.

13. class indoor_sports

int i_id;

char i_name[20];

char i_coach[20];
protected:

int i_rank,i_fee;

void get_ifee();

public:

indoor_sports();

void iEntry();

void ishow();

};

class outdoor_sports public indoor_sports

int o_id;

char o_name[20];

char o_coach[20];

protected:

int orank,ofee;

void get_ofee();

public:

outdoor_sports();

void oEntry();

void oshow();

};

class sports:outdoor_sports

{ char rules[20];

public:

sports();

void registration();

void oshow();

};

(i) Name the type of inheritance illustrated in the above C++ code.

(ii) Write a statement to access oshow() of class outdoor_sports using the object S of class sports.
(iii) Write the names of all the member functions, which are accessible from the member function of class
sports.

(iv) What will be the size of the object belonging to class indoor_sports?

14. Answer the questions (i) to (iv) based on the following

class Teacher

{ int TCode;

protected: char Name[20];

public: Teacher();

void Enter();

void Show(); };

class Course

{ int ID;

protected:

Char Title[30];

public:

Course();

void Initiate();

void Display(); };

class Schedule : public Course, private Teacher

{ int DD,MM,YYYY;

public: Schedule();

void Start();

void View(); };

void main()

{ Schedule S; }

i)Which type of Inheritance out of the following is illustrated in the above example ? Single Level
Inheritance, Multilevel Inheritance, Multiple Inheritance .
ii)Write the names of all the members, which are directly accessible by the member function View() of
class Schedule.
iii)Write the names of all the members, which are directly accessible by the object S of class Schedule
declared in the main() function.
iv)What will be the order of execution of the constructors, when the object S of class Schedule is declared
inside the main() function ?
15. A text file named MATTER.TXT contains some text, which needs to be displayed such that every
next character is separated by a symbol ‘#’. Write a function definition for HashDisplay() in C++ that
would display the entire content of the file MATTER.TXT in the desired format.

Example : If the file MATTER.TXT has the following content stored in it : THE WORLD IS ROUND
The function HashDisplay() should display the following content : T#H#E# #W#O#R#L#D# #I#S#
#R#O#U#N#D#

16. Assuming that a text file named First.TXT contains some text written into it, write a function named
vowelwords, that reads the file FIRST.TXT and creates a new file named SECOND.TXT, to contain only
those words from the file FIRST.TXT which start with a lowercase vowel (i.e., with ‘a’, ‘e’, ‘i’, ‘o’, ‘u’)

17. Write a function in C++ to count and display the number of lines starting with alphabet ‘A’ present in
a text file “LINES.TXT”.

18. Write a definition for a function TotalTeachers( ) in C++ to read each object of a binary file
SCHOOLS.DAT, find the total number of teachers, whose data is stored in the file and display the same.
Assume that the file SCHOOLS.DAT is created with the help of objects of class SCHOOLS, which is
defined below :

class SCHOOLS { int SCode; //School Code

char SName[20]; //School Name

int NOT; //Number of Teachers in the school

public:

void Display() ;

int RNOT(){return NOT;}

};

19. Find and write the output of the following C++ program code :

Note : Assume all required header files are already included in the program.

#define Modify(N) N*3+10

void main()

{ int LIST[]={10,15,12,17};

int *P=LIST, C;

for(C=3; C>=0; C--)

LIST[I]=Modify(LIST[I]);

for (C=0; C<=3; C++)

{ cout<<*P<<":";
P++; } }

20. Find and write the output of the following C++ program code :

Note : Assume all required header files are already being included in the program.

void DispScore(int S[],int N)

for(int Count = 0;Count<N ;Count++)

cout<<S[count]<< ‘#’

cout<<endl ;

void main()

int *Point,Score[]={10,5,20,15};

Point=Score;

DispScore(Score,2);

for(int Count=0; Count<4 ;Count++)

cout<<*Point<<":";

if(Count%2==0)

Point++;

else

{ *Point +=10;

Point++ ;}

cout<<endl ;

DispScore(Score,4) ;

You might also like