Escolar Documentos
Profissional Documentos
Cultura Documentos
[All India]
Maximum Marks : 70 Duration : 3 Hours
Note. All the questions are compulsory.
Programming Language : C++
Examination Paper 1
private :
char name[20];
int check (int e);
public :
void getdata( );
void putdata( );
protected :
int total;
void calc( );
};
class School : private Student
{
protected :
char class_stu[10];
public :
void getdata( );
void putdata( );
};
In the above example Student is the base class and School is the derived class.
(b) (i) iostream.h (ii) fstream.h (iii) math.h (iv) string.h
(c) The errors are :
#include<iostream.h>
void main( )
{
int x;
cin>>x;
for(int y=0, y<10, y++); // Error 2
cout << x+y;
}
Error 1 : Comma is missing,
Corrected program :
#include<iostream.h>
void main( )
{
int x;
cin>>x;
for(int y=0;y<10;y++);
cout<< x+y;
}
(d) 5, 3, 4, 4
(e) 18, 4
(f) The function is :
#include <iostream.>
void zero_small(int &a, int &b)
{
if (a<b)
a = 0;
else
b = 0;
}
void main( )
{
int x, y;
Examination Paper 3
float percentage;
float calculate( );
public :
void readmarks( );
void displaymarks( );
};
float student :: calculate( )
{
float total = 0;
for (int I = 0; I < 5; I++)
total += marks[I];
return (total / 5);
}
void student :: readmarks( )
{
cout << "Enter 5 marks :";
for (int I=0; I < 5; I++)
cin >> marks[I];
percentage = calculate( );
}
void student :: displaymarks( )
{
cout << "The 5 marks are : ";
for (int I=0; I < 5; I++)
cout << marks[I] << endl;
cout << "\nPercentage = " << percentage << endl;
}
(c) The output is :
C1 = 0
C2 = 0
C1 = 1
C2 = 2
3. (a) Define array and pointer. 2
(b) Given the following class, 4
char *msg[ ] = {"over flow", "under flow"};
class Stack
{
int top, //the stack pointer
stk[5]; //the elements
void err_rep(int e_num) { cout << msg[e_enum]; } //report error message
public:
void init( ) { top = 0; } //initialize the stack pointer
void push(int); //put new value in stk
void pop( ); //get the top value
};
Define pop outside the Stack. In your definition take care of under flow condition. Function pop
should invoke error_rep to report under flow.
(c) Change the following infix expression into postfix expression. 3
(A+B)*C+D/E-F
(d) The array A[20][10] is stored in the memory with each element requiring one byte of storage if the
base address of A is C0, determine the location of A[10][5] when the arrayA is stored by column major.
3
Examination Paper 5
(e) Using bubble sort, the sequence of steps are :
42 29 74 11 65 58
29 42 74 11 65 58
29 42 74 11 65 58
11 29 42 74 65 58
11 29 42 65 74 58
11 29 42 58 65 75
Examination Paper 7
(f) Given the following truth table, write the product of sums form of the function F(x, y, z) 2
x y z F
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
Ans. (a) The distributive law states
X.(Y + Z ) = X.Y + X.Z (ii) X + Y.Z = (X + Y) . (X+Z)
The truth table for X(Y+Z) = XY + XZ is given below :
Input Output
X Y Z Y+Z XY XZ X(Y+Z) XY+XZ
0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0
0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0
1 0 0 0 0 0 0 0
1 0 1 1 0 1 1 1
1 1 0 1 1 0 1 1
1 1 1 1 1 1 1 1
Both the columns X(Y+Z) and XY+YZ are identical, hence proved.
(b) L.H.S. = X.Y + Y.Z + Y'.Z
= X.Y + (Y.+Y')Z
= X.Y + 1.Z
= X.Y + Z = R. H. S.
(c) F = Σ(2, 3, 6, 10, 11, 14)
YZ
WX 00 01 11 10
00 1 1
01 1
11 1
10 1 1
F = YZ' + X'Y
x
z sum = x + y + z
y
carry = x . y + y . z + x . z
(e) (X+Y)(Y+Z)(X+Z)
Take the double complement.
= [(X+Y)(Y+Z)(X+Z)''
= ((X+Y)’ + (Y+Z)’ + (X+Z)']'
i.e.,
x (x + y)'
y
y (y + z)' (x + y) + (y + z) + (z + x)
z
z (z + x)'
x
Examination Paper 9
(d) Write two advantages and disadvantages of the following topologies in network : 1
(i) Bus
(ii) Ring
Ans. (a) A modem is a device which is used to convert data from digital bit strream into an analog signal and
vice versa.
(b) FTP. File Transfer Protocol
WAN. Wide Area Network
WWW. World Wide Web.
(c) Circuit Switching. In this technique, firstly the complete physical connection between two computers
is established and then data is transmitted from the source computer to the destination computer.
A Packet Switching network divides the data traffic into blocks called packets that have a maximum
length. Each packet of user data travels in a data envelope, which gives the destination address of
the packet and a variety of control information.
(d) Advantages of BUS topology :
(i) Short cable length – Because there is single common data path connecting all nodes.
(ii) Easy to extend – Additional nodes can be connected to an existing bus network at any point
along its length.
Disadvantages of BUS topology :
(i) Fault diagnosis is difficult – Although the bus topology is very simple, but in this topology
fault detection is very difficult.
(ii) Nodes must be intelligent – Each node on the network is directly connected to the central bus.
This means that some way of deciding who can use the network at any given time must be
performed in each node. It tends to increase the cost of the nodes irrespective of whether this
is performed in hardware or software.
Advantages of Ring topology :
(i) Short cable length – In ring topology less connections will be needed which increases network
reliability.
(ii) The amount of cable needed in this topology is comparable to bus and relatively smallto star.
Disadvantages of Ring topology :
(i) Node failure causes network failure – Since each node in this network is connected to its
neighbouring node and data travels through each node, there is one traffic flow until defective
node is removed.
(ii) Each node must handle the data being transferred on the ring.