OOP Theory Mid Part 1 Objective Sol
OOP Theory Mid Part 1 Objective Sol
OOP Theory Mid Part 1 Objective Sol
Instructions:
Part-1 is objective and time allowed is 30 minutes. Part-1 should be solved on question
paper. Write name & roll no on the question paper.
Paper is closed book & closed notes. Part-1 must be returned before attempting Part-II.
Students can get Part-2 earlier if Part-1 is returned.
Cutting/Correction is not allowed in this section. Corrections will be marked zero.
Part- I (Objective)
What is the issue with the above code? 3. Which of the following are fundamental principles of
a) All members of the structure must be of the same object-oriented programming?
type
b) The structure name/tag is missing a) Encapsulation b) Inheritance
c) The initialization list for the customer variable c) Polymorphism d) Templates
must be enclosed in braces.
d) Missing semi-colon after structure declaration
Page 1 of 2
4. Which of the following oop feature provides reusability 5. Classes in C++ are________?
of code?
a) derived data types b) User defined data types
a) Abstraction b) Inheritance c) built-in data types d) All of these
c) Dynamic binding d) Encapsulation
6. Which of the following statement is correct about the 7. What must be done for hiding member data of a class?
constructors and destructors?
a) The member function must be declared as private in the
a) Destructors can take arguments but constructors cannot. class
b) Constructors can take arguments but destructors b) The member data must be declared as private in the
class
cannot. c) The member function must be declared as public in the
c) Constructors can return a value. class
d) The member data must be declared as public in the
d) None of them. class
8. Consider Car as an entity. Which of the following could 9. Suppose a class named Car whose specifications are
be considered as the member variables of the Car class? stored separately from its implementation. Which of the
following can be the implementation of a member
a) Name of car function of the Car? (…. in the body of function
b) The Engine Switch On/off operation indicate the code is omitted)
c) The gear change operation
d) The price of the car a) void Speed-UP(int sp);
e) The Speed-up operation b) void Speed-UP(int sp){ …};
c) void Car::Speed-UP(int sp){ …};
d) void car(int so){ …}
10. Find the error from the following code. 11. When the definition of the member function is written
inside the class definition, then that function becomes
class Time {
private: a) the private function of that class
int hour = 0;
int minute = 0; b) the inline function of that class
int second = 0; c) Not inline function of that class
public:
void Time( ); d) None of them
void set_values(int, int, int);
void display( );
}; 12. Which among the following member variables are
accessible inside a static member function of a class?
a) Definition of class member functions should be
written inside class definition.
a) Private data members
b) Constructor is not allowed to return value. b) Private Static data members
c) Destructor is missing c) Public data member
d) Public Static data members
d) Both (a) and (b)
e) All of the above
e) Both (a) and (c)
Page 2 of 2