Professional Documents
Culture Documents
The Velammal International School Computer Science (083) Midterm Work Sheet-1
The Velammal International School Computer Science (083) Midterm Work Sheet-1
COMPUTER SCIENCE(083)
1.Simplify A+A’B+AB’C
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.
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();
};
int T;
protected:
int U;
public:
void OUTDATA();
};
int M;
public:
void DISPLAY(void);
};
(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.
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();
};
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?
class Teacher
{ int TCode;
public: Teacher();
void Enter();
void Show(); };
class Course
{ int ID;
protected:
Char Title[30];
public:
Course();
void Initiate();
void Display(); };
{ 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 :
public:
void Display() ;
};
19. Find and write the output of the following C++ program code :
Note : Assume all required header files are already included in the program.
void main()
{ int LIST[]={10,15,12,17};
int *P=LIST, C;
LIST[I]=Modify(LIST[I]);
{ 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.
cout<<S[count]<< ‘#’
cout<<endl ;
void main()
int *Point,Score[]={10,5,20,15};
Point=Score;
DispScore(Score,2);
cout<<*Point<<":";
if(Count%2==0)
Point++;
else
{ *Point +=10;
Point++ ;}
cout<<endl ;
DispScore(Score,4) ;