CS304 VU Current Midterm Fall 2012 Paper 8 December 2012

CS304 VU Current Midterm Fall 2012 Paper – 8 December 2012


Q. Write 2 plus plus code to overload subscript[] operator for string class. (5 marks)
Q.Suppose we have a base class vehicle and a derived van.describe the accessibility of public, protected and private members of base class. “vehicle” in derived class “van ” in case of public inheritance. (3 marks)
Q.Can we create an array of objects for a class having default constructor? Justify your ans. (2 marks)
Q. differentiate between overloaded ++ operator in prefix and post-fix. (2 marks)

……. Another Paper…..

MCQ are mostly from past papers. 20 marks

List of two operators that can’t be overloaded? (2 marks)
Consider the following cal of an overloaded “+” operator. (2 marks)

Rational_number1+ Rational_number2;
Identify which object will be passed as an argument to the overloaded function. Justify your answer with at least 1 solid reason?

Consider the following scenario: (3 marks)

A class X does not have any overloaded operator and has a member function “Subtract” to subtract two objects of X, and then placing the result in third object.
Where third is a calling object.

Consider the following diagram. (5 marks)

What type of relationship exist
Implemented data members and member function in C++ with appropriate data types.
Implement the relationship between classes in C++.

Ik function ta string ka (3 marks)

Ik istara ka question ta k Relationships define karna ta in which women is a derived class and lady doctor is a base class. List banana the. (5 marks)