1. What are the four principles of object-oriented programming?
Answer
Correct Answer:
Abstraction, encapsulation, inheritance, and polymorphism
Note: This Question is unanswered, help us to find answer for this one
2. What parameters are required to be passed to a class constructor?Here they haven't mentioned any specific language so let's consider all languages.
Answer
Correct Answer:
None // Above 3 are incorrect so
Note: This Question is unanswered, help us to find answer for this one
3. What is the difference between an interface and an abstract class?
Answer
Correct Answer:
Abstract classes can contain code or data. Interface do not contain code or data. A class can inherit from only one abstract class but can implement an unlimited number of interfaces
Note: This Question is unanswered, help us to find answer for this one
4. What is the difference between early binding and late binding?
Answer
Correct Answer:
Early binding is when a variable is assigned its value at compile time. Late binding is when a variable is assigned a value at run time
Note: This Question is unanswered, help us to find answer for this one
5. How does dynamic typing complicate troubleshooting?
Answer
Correct Answer:
It can be difficult to identify variables that are incorrectly typed
Note: This Question is unanswered, help us to find answer for this one
6. What does a concrete class not have?
Answer
Correct Answer:
Pure virtual functions
Note: This Question is unanswered, help us to find answer for this one
7. Static polymorphism uses method _ ?
Answer
Correct Answer:
Overloading
Note: This Question is unanswered, help us to find answer for this one
8. In the context of OOP, what is composition?
Answer
Correct Answer:
Composition is a part/hole relationship where an object is composed of one or more other objects, each of which is considered a part of the whole.
Note: This Question is unanswered, help us to find answer for this one
9. An instance of which type of class cannot be created?
Answer
Correct Answer:
Abstract class
Note: This Question is unanswered, help us to find answer for this one
10. What is the function of a finalizer or destructor?
Answer
Correct Answer:
To relinquish resources that are no longer needed
Note: This Question is unanswered, help us to find answer for this one
11. Which choice is not an OOP language?
Answer
Correct Answer:
C
Note: This Question is unanswered, help us to find answer for this one
12. What is the purpose of the finally block?
Answer
Correct Answer:
To always run the finally block of code when the try block exits
Note: This Question is unanswered, help us to find answer for this one
13. What is the main idea behind separation of concerns?
Answer
Correct Answer:
All of these answers
Note: This Question is unanswered, help us to find answer for this one
14. Assume single inheritance is used with classes A and B while A is the base class. Then assume classes C, D, and E, where C is a base class and D is derived from C, then E is derived from D. Class C is made to inherit from class B. Which type of inheritance is reflected?
Answer
Correct Answer:
Multilevel
Note: This Question is unanswered, help us to find answer for this one
15. Methods and attributes that define an object are a kind of blueprint called what?
Answer
Correct Answer:
A class
Note: This Question is unanswered, help us to find answer for this one
16. What is the scope of a class nested inside another class?
Answer
Correct Answer:
Global scope
Note: This Question is unanswered, help us to find answer for this one
17. What is the difference between a parameter and an argument?
Answer
Correct Answer:
A parameter is a variable in the declaration of a function. An argument is the value of this variable that gets passed to the function.
Note: This Question is unanswered, help us to find answer for this one
18. What does the value (0.5,0.5,0.5) indicate in the class diagram specification position: Coordinate = (0.5,0.5,0.5)?
Answer
Correct Answer:
A default value of the position attribute
Note: This Question is unanswered, help us to find answer for this one
19. What is the best example of a superclass and subclass relationship?
Answer
Correct Answer:
Car:toyota
Note: This Question is unanswered, help us to find answer for this one
20. Are you required to return an object if it was passed by reference to a function, and why or why not?
Answer
Correct Answer:
No, changes will be automatically reflected in the calling function.
Note: This Question is unanswered, help us to find answer for this one
21. Which type of function can be used for polymorphism?
Answer
Correct Answer:
Virtual function
Note: This Question is unanswered, help us to find answer for this one
22. _ describes an aggregation
Answer
Correct Answer:
A collection of objects
Note: This Question is unanswered, help us to find answer for this one
23. There are five classes. Class E is derived from class D, D from C, C from B, and B from A. Which class constructor(s) will be called first if the object of E or D is created?
Answer
Correct Answer:
A
Note: This Question is unanswered, help us to find answer for this one
24. What defines the catch block most accurately?
Answer
Correct Answer:
The catch block that will be executed is the one that best matches the type of exception thrown.
Note: This Question is unanswered, help us to find answer for this one
25. What is a copy constructor?
Answer
Correct Answer:
It is a unique constructor for creating a new object as a copy of an object that already exists. There will always be only one copy constructor that can be either defined by the user or the system.
Note: This Question is unanswered, help us to find answer for this one
26. Why would you override a method of a base class?
Answer
Correct Answer:
To define a custom implementation of an inherited member
Note: This Question is unanswered, help us to find answer for this one
27. The open/closed principle states that classes should be open for _ but closed for _.
Answer
Correct Answer:
Extension; modification
Note: This Question is unanswered, help us to find answer for this one
28. How do object behaviour and attributes differ?
Answer
Correct Answer:
Attributes describe a state; behaviours describe a change.
Note: This Question is unanswered, help us to find answer for this one
29. Why is unit testing harder in OOP than functional programming?
Answer
Correct Answer:
Objects may maintain internal state, which is not easily accessible by the tests.
Note: This Question is unanswered, help us to find answer for this one
30. What is a reference to an object?
Answer
Correct Answer:
It is the address where the variables and methods of an object are stored.
Note: This Question is unanswered, help us to find answer for this one
31. Which of these keywords are access specifiers?
Answer
Correct Answer:
Public and private
Note: This Question is unanswered, help us to find answer for this one
32. What is the relationship between abstraction and encapsulation?
Answer
Correct Answer:
Abstraction is about making relevant information visible, while encapsulation enables a programmer to implement the desired level of abstraction.
Note: This Question is unanswered, help us to find answer for this one
33. What type of inheritance may lead to the diamond problem?
Answer
Correct Answer:
Multiple
Note: This Question is unanswered, help us to find answer for this one
34. Can abstract classes be used in multilevel inheritance?
Answer
Correct Answer:
Yes, always
Note: This Question is unanswered, help us to find answer for this one
35. What best describes what object-oriented programming does?
Answer
Correct Answer:
It focuses on objects that interact cleanly with one another.
Note: This Question is unanswered, help us to find answer for this one
36. Which words in the following list are candidates for objects: trumpet, clean, enrage, leaf, tree, collapse, active, and lively?
Answer
Correct Answer:
Leaf, tree, and trumpet
Note: This Question is unanswered, help us to find answer for this one
37. Which type of function among the following shows polymorphism?
Answer
Correct Answer:
Virtual function
Note: This Question is unanswered, help us to find answer for this one
38. In addition to attributes and behaviours, what quality must a class possess?
Answer
Correct Answer:
A name
Note: This Question is unanswered, help us to find answer for this one
39. Why is inheritance used when creating a new class?
Answer
Correct Answer:
To avoid writing duplicate code To separate class behavior from the more general
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
40. Which is false for a member function of a class?
Answer
Correct Answer:
Member functions do not need to be declared inside the class definition.
Note: This Question is unanswered, help us to find answer for this one
41. What is the result of using more abstraction?
Answer
Correct Answer:
It can limit code readability
Note: This Question is unanswered, help us to find answer for this one
42. Which statement about compositions and aggregations is true?
Answer
Correct Answer:
If a composition dies, the contents die
Note: This Question is unanswered, help us to find answer for this one
43. How are contents of a composition different from those of aggregation?
Answer
Correct Answer:
If a composition dies, the contents die
Note: This Question is unanswered, help us to find answer for this one
44. What are CRC Cards?
Answer
Correct Answer:
Class Responsibility collaboration cards are a brainstorming tool used in the design of oop software
Note: This Question is unanswered, help us to find answer for this one
45. What is the purpose of static constructor?
Answer
Correct Answer:
To initialize all the members with static value
Note: This Question is unanswered, help us to find answer for this one
46. When and how often is a static constructor called?
Answer
Correct Answer:
It is called initially when an object is created and only one time.
Note: This Question is unanswered, help us to find answer for this one
47. Why is code duplication so insidious?
Answer
Correct Answer:
One has to maintain all the duplicates.
Note: This Question is unanswered, help us to find answer for this one
48. Which is NOT one of the basic types of inheritance?
Answer
Correct Answer:
Double inheritance
Note: This Question is unanswered, help us to find answer for this one
49. Which class has the highest degree of abstraction in a multilevel inheritance relationship of five levels?
Answer
Correct Answer:
The class at the first level
Note: This Question is unanswered, help us to find answer for this one
50. What is a method?
Answer
Correct Answer:
The exact same thing as a function and subroutine
Note: This Question is unanswered, help us to find answer for this one
51. If an object is passed by reference, the changes made in the function are reflected _.
Answer
Correct Answer:
To the main object of the caller function, too
Note: This Question is unanswered, help us to find answer for this one
52. In multilevel inheritance, one class inherits how many classes?
Answer
Correct Answer:
One class only
Note: This Question is unanswered, help us to find answer for this one
53. What are the five Creational Design patterns by the Gang of Four ?
Answer
Correct Answer:
Abstract Factory, Builder, Factory Method, Prototype, and Singleton.
Note: This Question is unanswered, help us to find answer for this one
54. Two classes combine private data members and provide public member functions to access and manipulate those data members. Where is abstraction used?
Answer
Correct Answer:
Abstraction is using public member functions to access and manipulate the data members.
Note: This Question is unanswered, help us to find answer for this one
55. A language that does not support polymorphism but supports classes is considered what?
Answer
Correct Answer:
An object-based language
Note: This Question is unanswered, help us to find answer for this one
56. Which type of inheritance must be used so that the resultant is hybrid?
Answer
Correct Answer:
Multiple
Note: This Question is unanswered, help us to find answer for this one
57. How are user stories different from use cases?
Answer
Correct Answer:
User Stories are shorter and less detailed.
Note: This Question is unanswered, help us to find answer for this one
58. In context of OOP, what is association?
Answer
Correct Answer:
Association is a relationship where all objects have their own life cycle and there is no owner.
Note: This Question is unanswered, help us to find answer for this one
59. Which of the following is NOT an advantage of using getters and setters?
Answer
Correct Answer:
Getters and setters can speed up compilation.
Note: This Question is unanswered, help us to find answer for this one
60. Which statement is true?
Answer
Correct Answer:
A default parameter's constructor is not equivalent to the default constructor
Note: This Question is unanswered, help us to find answer for this one
61. Which type of inheritance ,when done continuously, is similar to a tree structure?
Answer
Correct Answer:
Hierarchical
Note: This Question is unanswered, help us to find answer for this one
62. Why would you implement composition using an id instead of a reference?
Answer
Correct Answer:
All of these answers
Note: This Question is unanswered, help us to find answer for this one
63. Which two blocks are used to handle and check errors?
Answer
Correct Answer:
Try and catch
Note: This Question is unanswered, help us to find answer for this one
64. F a local class is defined in a function, what is true for an object of that class?
Answer
Correct Answer:
The object can be accessed, declared, and used locally in that function.
Note: This Question is unanswered, help us to find answer for this one
65. When is a constructor executed?
Answer
Correct Answer:
When an object is created from a class using the new keyword
Note: This Question is unanswered, help us to find answer for this one
66. Which type of constructor cannot have a return type?
Answer
Correct Answer:
Constructors do not have a return type
Note: This Question is unanswered, help us to find answer for this one
67. Which code creates a new object from the Employee class?
Answer
Correct Answer:
Employee currentEmployee = new Employee();
Note: This Question is unanswered, help us to find answer for this one
68. What is an IS-A relationship?
Answer
Correct Answer:
A subclass object has an IS-A relationship with its superclass or interface
Note: This Question is unanswered, help us to find answer for this one
69. What is encapsulation?
Answer
Correct Answer:
Hiding the data and implementation details within a class
Note: This Question is unanswered, help us to find answer for this one
70. What is the best reason to use a design pattern?
Answer
Correct Answer:
It will result in code that is more extensible and maintainable
Note: This Question is unanswered, help us to find answer for this one
71. When does static binding happen?
Answer
Correct Answer:
At compile time
Note: This Question is unanswered, help us to find answer for this one
72. Why would you create an abstract class, if it can have no real instances?
Answer
Correct Answer:
To avoid redundant coding in children
Note: This Question is unanswered, help us to find answer for this one
73. For which case would the use of a static attribute be appropriate?
Answer
Correct Answer:
The weather conditions for each house in a small neighborhood
Note: This Question is unanswered, help us to find answer for this one
74. What is an example of dynamic binding?
Answer
Correct Answer:
Method overriding
Note: This Question is unanswered, help us to find answer for this one
75. A(n) ____ is a variable that is used within a function.
Answer
Correct Answer:
Parameter
Note: This Question is unanswered, help us to find answer for this one
76. A class and its members can be described graphically using a notation known as the ____ notation.
Answer
Correct Answer:
UML
Note: This Question is unanswered, help us to find answer for this one
77. In a sequence diagram, the _____ indicates when an object sends or receives a message.
Answer
Correct Answer:
Request link
Note: This Question is unanswered, help us to find answer for this one
78. In oop, you declare a class that extends another class. this is called ________.
Answer
Correct Answer:
Inheritance
Note: This Question is unanswered, help us to find answer for this one
79. A ____ method is also known as a help method.
Answer
Correct Answer:
Work
Note: This Question is unanswered, help us to find answer for this one
80. Class ________ represents an image that can be displayed on a jlabel.
Answer
Correct Answer:
ImageIcon
Note: This Question is unanswered, help us to find answer for this one
81. By convention, a class diagram contains the ____ following each attribute or method.
Answer
Correct Answer:
Data type
Note: This Question is unanswered, help us to find answer for this one
82. ________ members of a base class are never accessible to a derived class.
Answer
Correct Answer:
Private
Note: This Question is unanswered, help us to find answer for this one
83. Protected members of a base class are like ________, but they may be accessed by derived classes.
Answer
Correct Answer:
Private members
Note: This Question is unanswered, help us to find answer for this one
84. The ________ class constructor is called before the ________ class constructor.
Answer
Correct Answer:
Base, derived
Note: This Question is unanswered, help us to find answer for this one
85. When an object of one class is a data field within another class, they are related by ____.
Answer
Correct Answer:
Composition
Note: This Question is unanswered, help us to find answer for this one
86. Multiple inheritance is when a ________ class has ________ base classes.
Answer
Correct Answer:
Derived, two or more
Note: This Question is unanswered, help us to find answer for this one