Professional Documents
Culture Documents
Set 4 Ans
Set 4 Ans
Another difference between member functions and non-member functions is how they
are called (or invoked) in the main routine.
Ex :
int main()
{
int i;
myarray a; //declare a myarray object
Maths obj1(obj)
ii) Using the objects obj and obj1 we have to call the member functions
c. Do it yourself 4
d. (i) data members : read, show, print data, reading, read data , printing 4
(ii) multilevel
(iii) data membersfabric, cost stock , manufacturer,
Member functions : read , read data, reading , show , print data, printing
(iv) 42 bytes
Q3.
a. Do it yourself 3
class queue
{
node *rear, *front;
public:
queue()
{
rear =front = NULL;
}
void ins();
void del();
};
void queue::ins()
{
node *temp;
temp = new node;
if (temp==NULL)
{
cout << "No memory!";
return -1;
}
cout << "enter elements\n\n";
cin >> temp->x ;
temp->next=NULL;
if (rear==NULL)
{
rear=front=temp;
}
else
{
rear->next=temp;
rear=temp;
}
}
void queue::del()
{
if (f==NULL)
{
cout << "queue empty!";
return;
}
front = front->next;
}
d. Do it yourself 2
e. true 2
Q.4.
a. What is the purpose of seekp() and seekg( ) 1
b. void main() 2
{ fstream fin;
fin.open("text1.txt",ios::in);
if (!fin)
cout<<”File not found”;
else
cout << sizeof("text1.txt");
}
c. Do it yourself 3
Q.5.
a. 2
b.
6.
a. 2
b. (AC)’+(AB)’+(BC)’ 2
c. 1
d. 3
7.
a.
b.
c.
d.
e.
f.
g.