CS304- Object Oriented Programming
Question No: 1 ( Marks: 1 ) - Please choose one
Suppose there is an object of type Person, which of the following can be considered as one of its attributes
► Both Name and Age
Question No: 2 ( Marks: 1 ) - Please choose one
What a derived class can add?
► New data members
► New member functions and New friend functions
► New constructors and destructor
► All of given
Question No: 3 ( Marks: 1 ) - Please choose one
________ is/are used to access information hidden within an object?
► Private data members
► Private member functions
► Both public and private members
Question No: 4 ( Marks: 1 ) - Please choose one
this pointers are not accessible for static member functions.
Question No: 5 ( Marks: 1 ) - Please choose one
A static member function cannot be declared.
Question No: 6 ( Marks: 1 ) - Please choose one
C++ compiler does not allow to dynamically allocate memory for objects
Question No: 7 ( Marks: 1 ) - Please choose one
Given the following class
How you can improve above class with respect to accessing the field Age?
► Define the variable Age as private
► Define the variable Age as protected
► Define the variable Age as private and create a get method that returns it and a set method that updates it
► Define the variable Age as protected and create a set method that returns it and a get method that updates it
Question No: 8 ( Marks: 1 ) - Please choose one
Friend class and friend function can be used as an alternate to each other
Question No: 9 ( Marks: 1 ) - Please choose one
Which of the following operators always takes no argument if overloaded?
Question No: 10 ( Marks: 1 ) - Please choose one
Suppose that the Test class does not have an overloaded assignment operator. What happens when an assignment a=b; is given for two Test objects a and b?
► The automatic assignment operator is used
► The copy constructor is used
► Compiler error
► Run-time error
Question No: 11 ( Marks: 1 ) - Please choose one
Assume a class C with objects obj1, obj2, and obj3. For the statement obj3 = obj1 - obj2 to work correctly, if the overloaded - operator must
► take two arguments.
► return a value.
► create a named temporary object.
► take four arguments
Question No: 12 ( Marks: 1 ) - Please choose one
Which operator can not be overloaded?
► The relation operator ( >= )
► Assignment operator ( = )
► Script operator (  )
► Conditional operator (? : )
Question No: 13 ( Marks: 1 ) - Please choose one
We achieve independence of internal implementation from its external interface through-----------
► Information Hiding
► both encapsulation and information hiding
Question No: 14 ( Marks: 1 ) - Please choose one
Which one of the following is not an object association?
► Simple Assocation
Question No: 15 ( Marks: 1 ) - Please choose one
We capture the object attributes and behavior in Object Oriented programming using---------------
► Data Members
Question No: 16 ( Marks: 1 ) - Please choose one
The return type of a constructor is of -------------
► No type
Question No: 17 ( Marks: 2 )
Can we create an array of objects for a class having default constructor?. Justify your answer.
Question No: 18 ( Marks: 2 )
Friend functions increase ‘Data vulnerability’, what is your opinion ?
Question No: 19 ( Marks: 2 )
Explain two benefits of setter functions.
Question No: 20 ( Marks: 3 )
Consider the class given below what will be the values in variables x,y and z after creating object of this class,
Question No: 21 ( Marks: 3 )
Explain what type of copy the default assignment operator "=" does when applied to objects. (shallow copy or deep copy)
Question No: 22 ( Marks: 5 )
What is composition? Explain it with the help of an example.
Question No: 23 ( Marks: 5 )
How we can overload Stream Extraction and Insertion Operators in c++?Give example code for Complex Number Class.