Monday 06th May 2024
REGISTRATION
Online Fashion Store

Important Questions

CBSE Guess > Papers > Important Questions > Class XII > 2010 > Computer Science > Computer Science By Naveen Gupta

CBSE CLASS XII

(iii) In the following program, find the correct possible output(s) from the options:

#include<stdlib.h>
#include<iostream.h>
void main()
{
randomize();
char Area[][10]={“NORTH”,”SOUTH”,”EAST”,”WEST”};
int ToGo;
for(int I=0;I<3;I++)
{
ToGo=random(3)+1;
cout<<Area[ToGo]<<”:”;
}
}

a)SOUTH:EAST:SOUTH:
b)NORTH:SOUTH:NORTH:
c)SOUTH:EAST:WEST:
d)WEST:EAST:EAST:

Q. 2.( a). Define a class ELECTION with the following specifications. Write a suitable main ( ) function also to declare 3 objects of ELECTION type and find the winner and display the details.

Private members:
Data: candidate_name, party, vote_received
Public members:
Functions :enterdetails ( ) – to input data
Display ( ) – to display the details of the winner
Winner ( ) – To return the details of the winner through the object after comparing the votes received by three candidates.

(b). class data2
{
int num ;
public:
data ( int n )
{num = n ;
}
void show ( )
{cout << n <<endl;
}};
class database : public data
{
char name[12];
data d ;
public :
________________________
};
Fill in the blanks to define a constructor for the derived class assigning values of the data passed from main ( ) and to assign a data 15 of base class constructor data n.

Paper By Mr. Naveen Gupta
Email Id : [email protected]