We are Permanently Move to www.VUpk.net Please Join us there.

CS304 Mid term Paper 2010 - 2

Sunday 5 August 2012
 MIDTERM EXAMINATION 
Spring 2010
CS304 - Object Oriented Programming



Q.No.1. 
Which part of an object exhibits its state?
  • Data
  • Operations
  • Any public part
  • Any private part
Q.No.2.  Inheritance is a way to
  • organize data. 
  • pass arguments to objects of classes. 
  • add features to existing classes without rewriting them. 
  • improve data-hiding and encapsulation.
Q. no.3.  Suppose you have been given the following design,

"A person has a name, age, address and -----. You are designing a class to represent a type of person called a patient. This kind of person may be given a diagnosis, have a spouse and may be alive".
Given that the person class has already been created, what of the following would be appropriate to include when you design the patient class?
  • registration date and diagnosis
  • age and -----
  • ----- and diagnosis
  • diagnosis and age


Q.No.4. What problem(s) may occur when we copy objects without using deep copy constructor?
  • Dangling pointer
  • Memory Leakage
  • All of the given
  • System crash


Q.No.5. this pointers are not accessible for static member functions.
  • True
  • False

Q.No.6. A static member function cannot be declared.
  • Static
  • Implicit
  • Explicit
  • Virtual

Q.No.7._______ remain in memory even when all objects of a class have been destroyed.
  • Static variables
  • Instance variable
  • Primitive variables
  • None of given

Q.no.8.Friend functions are _____________ functions of a class.
  • None of given
  • object member
  • non-member
  • data member

Q.No.9.___________, which means if A declares B as its friend it does NOT mean that A can access private data of B. It only means that B can access all data of A.
  • Friendship is one way only
  • Friendship is two way only
  • NO Friendship between classes
  • Any kind of friendship


Q.No. 10. The statement objA=objB; will cause a compiler error if the objects are of different classes.
  • True
  • False


Q.No.11. Identify which of the following overloaded operator function’s declaration is appropriate for the given call?
Rational_number_1 + 2.325
Where Rational_number_1 is an object of user defined class Rational_number.
  • Rational_number operator+( Rational_number & obj);
  • Rational_number operator+(double& obj);
  • Rational_number operator+(Rational_number &obj, double& num);
  • operator+(double& obj);


Q.No.12  http://vuzs.net  > Which operator can not be overloaded?
  • The relation operator ( >= )
  • Assignment operator ( = )
  • Script operator ( [] )
  • Conditional operator (? : )

Q.No. 13. To convert from a user-defined class to a basic type, you would most likely use
  • a built-in conversion operator. 
  • a one-argument constructor. 
  • an overloaded = operator. 
  • a conversion operator that’s a member of the class. 

Q.No. 14. http://vuzs.net  > The technique in which we visualize our programming problems according to real life’s problems is called
----------------
  • structured programming
  • object oriented Programming 
  • procedural programming
  • non of the given

Q.no.15. In object orientated programming, a class of objects cans _____________ properties from another class of objects
  • Utilize
  • Borrow
  • Inherit
  • Adopt

Q.No.16. A C++ class is similar to --------------------
  • Structure
  • Header File
  • Library File
  • None of the given


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


Q.No. 18.
 Friend functions increase ‘Programming bugs’. What is your opinion?


Q.No. 19.
 Explain two benefits of setter functions.


Q.No. 20. 
What are binary operators? Give an example of binary operators overloading using any class.


Q.No. 21. 
Give c++ code to overload assignment operator for string class.

Q.No. 22. 
Writ c++ code to overload subscript[] operator for String class.


Q.No. 23. 
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;
}

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...