Page 207 - C++
P. 207
costing ( );
void entercost( );
void dispcost( );
};
i) Which type of inheritance is shown in the above example?
ii) Write the names of all the members which are accessible from objects of
class costing.
iii) Write names of all the members which are accessible from member function
of the class design.
iv) How many bytes will be required by an object belonging to class design?
Q3)
a) WAF rearrange accepts two parameters an array of numbers and size of the
array which should reposition the content after swapping each adjacent pair of
numbers in it.
(2)
Note : assuming the size of array is multiple of 4
e.g. if an array of 8 integers is as follows :
86, 93, 40, 36, 52, 21, 70, 10
After executing the function, the array content should be changed as follows:
40, 36, 86, 93, 70, 10, 53, 21
b) An array S[−1..35][−2..15] is stored in the memory along the row with each of
the element occupying 4 bytes, find out the address of element S[20][5] if an
element S[2] [2] is stored at a memory location 3000. Find out the total number
of elements stored in S and number of bytes allocated to S.
(3)
c) Write function which accepts an integer 1 D array and its size as parameter and
assign the elements into a 2 D array of integers in the following format
(3)
If the 1 D array is 1, 2, 3, 4, 5
The resultant 2 D array is given below
0 0 0 0 1
0 0 0 1 2
0 0 1 2 3
0 1 2 3 4
1 2 3 4 5
d) Convert the following infix expression to its equivalent postfix expression. Show
status of stack after every step. (2)
M / N – (P + Q) * R
e) Write a function to perform insert operation in a circular Queue containing
players information(player ID and player name). Write the necessary
declaration also.
(4)
Q4)
a) Observe the program segment given below carefully and fill the blanks marked
as statement1 and statement2 using tellg( )and seekp( ) functions for
performing the required task.
(1)
# include <fstream.h>
class customer
{
long cno;;
char name[25], mobile[12];
public :
//function to allow user to enter the cno, name and mobile number
void enter( );
// function to allow user to enter (modify) mobile number
void modify( );
// function to return value of cno
long getcno( ) { return cno; }
};
void changemobile ( )
{