Sunday, May 15, 2011

CS304 Past Mid Term Paper


CS304 Past Mid Term Paper

Explain the statement below, ?
vector<int> ivec(4, 3);

Give the names of any two types of template?

Describe the way to declare a template function as a friend of any class?

What are binary operators? Give an example of binary operators overloading using any class?

Can we create an array of objects for a class having user defined constructor? Justify your answer?

Detect and correct compile time error(s) in the following code?

class  Exam
{
      char *ExamName;
      int No_of_paper;
     
public:
       Exam()
       {
             ExamName = "Final Term";
             No_of_paper = 5;
             }
      
void setname( char* name)  const
{
     ExamName = name;
     }
void setpaper(int paper)   const
{
     No_of_paper = paper;
     }
char* getname() 
{
      return ExamName;
      }
int getpaper()
{
    return No_of_paper;
}     
 };

int main()
{
const Exam exam1;

cout << " Exam            = "<<exam1.getname()<<endl;
cout << " Numbe of paper  = " << exam1.getpaper();
 
getch();
return 0;
}

No comments:

Post a Comment

Contact Form

Name

Email *

Message *