Home » Admissions Alert Guru » SOLVED QUESTION PAPER COMPUTER SCIENCE(083)-2015

SOLVED QUESTION PAPER COMPUTER SCIENCE(083)-2015

  
        
          

SOLVED QUESTION PAPER COMPUTER SCIENCE(083)-2015

SECTION A

Answers (programming in C++)

1  

(a) name1 is a valid identifier.

(b)  Header File’s Name  

ctype.h                 //for isalpha()

stdio.h                  //for puts

 

(c)      Error Finding.   

#define Maxspeed 60.5                               

void main()

{

int MySpeed;

char Alert=’N’;

cin>>MySpeed;

if(MySpeed>Maxspeed)

Alert=’Y’;

cout<<Alert<<endl;

}

 

 (d)      Find Output.  

#include<iostream.h>

void Location(int &X, int Y=4)

{

Y+=2;

X+=Y;

}

void main()

{

int PX=10,PY=2;

location(PY);

cout<<PX<<“,”<<PY<<endl;

location(PX,PY);

cout<<PX<<“,”<<PY<<endl;

}

 

Output:                 10, 8

                                 20, 8      

 

 

(e)         Find Output.

#include<iostream.h>

class Eval

{

char Level;

int Point;

public:

Eval()

{

level=’E’;

point=0;

}

void Sink(int L)

{

level-=L;

}

void Float(int L)

{

level+=L;

point++;

}

void Show()

{

cout<<Level<<“#”<<Point<<endl;

}

};

void main()

{

Eval E;

E.sink(3);

E.show();

E.float1(7);

E.show();

E.sink(2);

E.show();

}

Output:                B#0

                                I#1

                                G#1

  (f)

(ii)           CDEFGH

                CDEFGH

 

 2

(b)          #include<iostream.h>

#include<string.h>                          //FOR strcpy

class Passanger

{

long PNR;

char Name[20];

public:

Passanger()                                        //FUNCTION 1

{

cout<<“Ready”<<endl;

}

void Book(long P, char N[])          //FUNCTION 2

{

PNR=P;

strcpy(Name, N);

}

void Print()                                         //FUNCTION 3

{

cout<<PNR<<Name<<endl;

}

~Passanger()                                     //FUNCTION 4

{

cout<<“Booking cancelled!”<<endl;

}

};

void main()

{

long A;

char B[20];

clrscr();

Passanger P;

                       {

       P.Book(A,B);                                      //Line 1

       P.Print();                                             //Line 2               

}

 

(ii)  Function 4 will be executed at the end and it is referred as Destructor.

About

I am a person who is positive about every aspect of life.I am a Computer Science lecturer in a school. I love to spend my free time in learning new things.Working for eVirtualGuru gives me a lot extra knowledge and immense joy.

Leave a Reply

Your email address will not be published. Required fields are marked *