Test Series - oops

Test Number 1/78

Q: Which was the first purely object oriented programming language developed?
A. Java
B. C++
C. SmallTalk
D. Kotlin
Solution: SmallTalk was the first programming language developed which was purely object oriented. It was developed by Alan Kay. OOP concept came into the picture in 1970’s.
Q: 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
Solution: A class is Blueprint of an object which describes/ shows all the functions and data that are provided by an object of a specific class. It can’t be called as parent or instance of an object. Class in general describes all the properties of an object.
Q: Who invented OOP?
A. Alan Kay
B. Andrea Ferro
C. Dennis Ritchie
D. Adele Goldberg
Solution: Alan Kay invented OOP, Andrea Ferro was a part of SmallTalk Development. Dennis invented C++ and Adele Goldberg was in team to develop SmallTalk but Alan actually had got rewarded for OOP.
Q: 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
Solution: Member functions are allowed inside a class but were not present in structure concept. Data members, static data and public access specifiers were present in structures too.
Q: Which is not feature of OOP in general definitions?
A. Code reusability
B. Modularity
C. Duplicate/Redundant data
D. Efficient Code
Solution: Duplicate/Redundant data is dependent on programmer and hence can’t be guaranteed by OOP. Code reusability is done using inheritance. Modularity is supported by using different code files and classes. Codes are more efficient because of features of OOP.
Q: Pure OOP can be implemented without using class in a program. (True or False)
A. True
B. False
C. 1
D. 0
Solution: It’s false because for a program to be pure OO, everything must be written inside classes. If this rule is violated, the program can’t be labelled as purely OO.
Q: Which Feature of OOP illustrated the code reusability?
A. Polymorphism
B. Abstraction
C. Encapsulation
D. Inheritance
Solution: Using inheritance we can reuse the code already written and also can avoid creation of many new functions or variables, as that can be done one time and be reused, using classes.
Q: Which language does not support all 4 types of inheritance?
A. C++
B. Java
C. Kotlin
D. Small Talk
Solution: Java doesn’t support all 4 types of inheritance. It doesn’t support multiple inheritance. But the multiple inheritance can be implemented using interfaces in Java.
Q: 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
Solution: Any number of classes can be defined inside a program, provided that their names are different. In java, if public class is present then it must have the same name as that of file.
Q: When OOP concept did first came into picture?
A. 1970’s
B. 1980’s
C. 1993
D. 1995
Solution: OOP first came into picture in 1970’s by Alan and his team. Later it was used by some programming languages and got implemented successfully, SmallTalk was first language to use pure OOP and followed all rules strictly.

You Have Score    /10