oop mcqs online test

OOPs MCQs Quiz | OOPs Interview Questions and Answers

Computer Programming Quiz IT Jobs

Object Oriented Programming MCQ (Multiple Choice Questions and Answers) focus on all areas of Object Oriented Programming covering. This OOPs MCQ Test contains 25 Best Multiple Choice Questions, that are very popular & asked various times in OOPs Exam/Interview. OOPs MCQ (Multiple Choice Questions) with java tutorial, features, history, variables, object, programs, operators, oops concept, array, string, map, math etc…

Q1.Which among the following is true?

a) The private members can’t be accessed by public members of the class
b) The private members can be accessed by public members of the class
c) The private members can be accessed only by the private members of the class
d) The private members can’t be accessed by the protected members of the class

Option B – The private members can be accessed by public members of the class

Q2.If private member functions are to be declared in C++ then _

a) private:
b) private
c) private(private member list)
d) private :-

Option A – private:

Q3.In java, which rule must be followed?

a) Keyword private preceding list of private member’s
b) Keyword private with a colon before list of private member’s
c) Keyword private with arrow before each private member
d) Keyword private preceding each private member

Option D – Keyword private preceding each private member

Q4.How many private member functions are allowed in a class?

a) Only 1
b) Only 7
c) Only 255
d) As many as required

Option D – As many as required

Q5.Private member functions __

a) Can’t be called from enclosing class
b) Can be accessed from enclosing class
c) Can be accessed only if nested class is private
d) Can be accessed only if nested class is public

Option A – Can’t be called from enclosing class

Q6.Which function among the following can’t be accessed outside the class in java in same package?

a) public void show()
b) void show()
c) protected show()
d) static void show()

Option C – protected show()

Q7.If private members are to be called outside the class, which is a good alternative?

a) Call a public member function which calls private function
b) Call a private member function which calls private function
c) Call a protected member function which calls private function
d) Not possible

Option A – Call a public member function which calls private function

Q8.Which error will be produced if private members are accessed?

a) Can’t access private message
b) Code unreachable
c) Core dumped
d) Bad code

Option A – Can’t access private message

Q9.Can main() function be made private?

a) Yes, always
b) Yes, if program doesn’t contain any classes
c) No, because main function is user defined
d) No, never

Option D – No, never

Q11.If a function in java is declared private then it ______

a) Can’t access the standard output
b) Can access the standard output
c) Can’t access any output stream
d) Can access only the output streams

Option B – Can access the standard output

Q12.Which of the following best defines a class?

a) Parent of an object
b) Instance of an object
c) Blueprint of an object
d) Scope of an object

Option C – Blueprint of an object

Q13.Who invented OOP?

a) Alan Kay
b) Andrea Ferro
c) Dennis Ritchie
d) Adele Goldberg

Option A – Alan Kay

Q14.Which is not feature of OOP in general definitions?

a) Code reusability
b) Modularity
c) Duplicate/Redundant data
d) Efficient Code

Option C – Duplicate/Redundant data

Q15.Which Feature of OOP illustrated the code reusability?

a) Polymorphism
b) Abstraction
c) Encapsulation
d) Inheritance

Option D -Inheritance

Q16.When OOP concept did first came into picture?

a) 1970’s
b) 1980’s
c) 1993
d) 1995

Option A – 1970’s

Q17.Why Java is Partially OOP language?

a) It supports usual declaration of primitive data types
b) It doesn’t support all types of inheritance
c) It allows code to be written outside classes
d) It does not support pointers

Option A – It supports usual declaration of primitive data types

Q18.Which concept of OOP is false for C++?

a) Code can be written without using classes
b) Code must contain at least one class
c) A class must have member functions
d) At least one object should be declared in code

Option B – Code must contain at least one class

Q19.Which header file is required in C++ to use OOP?

a) iostream.h
b) stdio.h
c) stdlib.h
d) OOP can be used without using any header file

Option D – OOP can be used without using any header file

Q20.Which of the two features match each other?

a) Inheritance and Encapsulation
b) Encapsulation and Polymorphism
c) Encapsulation and Abstraction
d) Abstraction and Polymorphism

Option C – Encapsulation and Abstraction

Q21.Which feature allows open recursion, among the following?

a) Use of this pointer
b) Use of pointers
c) Use of pass by value
d) Use of parameterized constructor

Option A – Use of this pointer

Q22.What is the additional feature in classes that was not in structures?

a) Data members
b) Member functions
c) Static data allowed
d) Public access specifier

Option B – Member functions

Q23.Which syntax among the following shows that a member is private in a class?

a) private: functionName(parameters)
b) private(functionName(parameters))
c) private functionName(parameters)
d) private::functionName(parameters)

Option C – private functionName(parameters)

Q24.Which member can never be accessed by inherited classes?

a) Private member function
b) Public member function
c) Protected member function
d) All can be accessed

Option A – Private member function

Q25.Which is private member functions access scope?

a) Member functions which can only be used within the class
b) Member functions which can used outside the class
c) Member functions which are accessible in derived class
d) Member functions which can’t be accessed inside the class

Option A – Member functions which can only be used within the class

Leave a Reply

Your email address will not be published. Required fields are marked *