Object Oriented Programming MCQ (Multiple Choice Questions) - SchoolingAxis

 

Object Oriented Programming MCQ (Multiple Choice Questions)

Que- Which was the first purely object oriented programming language developed? 

a. Java 

b. C++ 

c. SmallTalk 

d. Kotlin 


Ans- SmallTalk  


Que- 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 


Ans- Blueprint of an object  


Que- Who invented OOP? 

a. Alan Kay 

b. Andrea Ferro 

c. Dennis Ritchie 

d. Adele Goldberg 


Ans- Alan Kay  


Que- 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 


Ans- Member functions  


Que- Which is not feature of OOP in general definitions? 

a. Code reusability 

b. Modularity 

c. Duplicate/Redundant data 

d. Efficient Code 


Ans- Duplicate/Redundant data  


Que- Which Feature of OOP illustrated the code reusability? 

a. Polymorphism 

b. Abstraction 

c. Encapsulation 

d. Inheritance 


Ans- Inheritance  


Que- Which language does not support all 4 types of inheritance? 

a. C++ 

b. Java 

c. Kotlin 

d. Small Talk 


Ans- Java  


Que- How many classes can be defined in a single program? 

a. Only 1 

b. Only 100 

c. Only 999 

d. As many as you want 


Ans- As many as you want  


Que- When OOP concept did first came into picture? 

a. 1970's 

b. 1980's 

c. 1993 

d. 1995 


Ans- 1970's  


Que- 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 


Ans- It supports usual declaration of primitive data types  


Que- 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 


Ans- Code must contain at least one class  


Que- Which of the following is not type of class? 

a. Abstract Class 

b. Final Class 

c. Start Class 

d. String Class 


Ans- Start Class  


Que- Class is pass by _______ 

a. Value 

b. Reference 

c. Value or Reference, depending on program 

d. Copy 


Ans- Reference  


Que- What is default access specifier for data members or member functions declared within a class without any specifier, in C++ ? 

a. Private 

b. Protected 

c. Public 

d. Depends on compiler 


Ans- Private  


Que- Which is most appropriate comment on following class definition :class Student {    int a;     public : float a; }; 

a. Error : same variable name can't be used twice 

b. Error : Public must come first 

c. Error : data types are different for same variable 

d. It is correct 


Ans- Error : same variable name can't be used twice  


Que- Which is known as generic class? 

a. Abstract class 

b. Final class 

c. Template class 

d. Efficient Code 


Ans- Template class  


Que- Size of a class is : 

a. Sum of size of all the variables declared inside the class 

b. Sum of size of all the variables along with inherited variables in the class 

c. Size of largest size of variable 

d. Classes doesn't have any size 


Ans- Classes doesn't have any size  


Que- Which class can have member functions without their implementation? 

a. Default class 

b. String class 

c. Template class 

d. Abstract class 


Ans- Abstract class  


Que- Which of the following describes a friend class? 

a. Friend class can access all the private members of the class, of which it is a friend 

b. Friend class can only access protected members of the class, of which it is a friend 

c. Friend class don't have any implementation 

d. Friend class can't access any data member of another class but can use it's methods 


Ans- Friend class can access all the private members of the class, of which it is a friend  


Que- What is scope of a class nested inside another class? 

a. Protected scope 

b. Private scope 

c. Global scope 

d. Depends on access specifier and inheritance used 


Ans- Depends on access specifier and inheritance used  


Que- Which among the following is false, for member function of a class? 

a. All member functions must be defined 

b. Member functions can be defined inside or outside the class body 

c. Member functions need not be declared inside the class definition 

d. Member functions can be made friend to another class using friend keyword 


Ans- Member functions need not be declared inside the class definition  


Que- Which syntax for class definition is wrong? 

a. class student{ }; 

b. student class{ }; 

c. class student{ public: student( int a ){ } }; 

d. class student{ student( int a ){} }; 


Ans- student class{ };  


Que- Which of the following pairs are similar? 

a. Class and object 

b. Class and structure 

c. Structure and object 

d. Structure and functions 


Ans- Class and structure  


Previous Post Next Post

Responsive Ad