linkedin-skill-assessments-quizzes

Object-Oriented Programming (OOP)

Q1. What is an example of dynamic binding?

Q2. For which case would the use of a static attribute be appropriate?

Q3. 1 Why would you create an abstract class, if it can have no real instances?

Q4. 2 Why would you create an abstract class, if it can have no real instances?

Q5. When does static binding happen?

Q6. What is the best reason to use a design pattern?

Q7. What is encapsulation?

Q8. What is an IS-A relationship?

Q9. You want a method with behavior similar to a virtual method--it is meant to be overridden --expect that it does not have a method body. It just has a method signature. What kind of method should you use?

Q10. Which code creates a new object from the Employee class?

Q11. Which type of constructor cannot have a return type?

Q12. 1 When is a constructor executed?

Q13. 2 When is a constructor executed?

Q14. If a local class is defined in a function, what is true for an object of that class?

Q15. Which two blocks are used to handle and check errors?

Q16. Why would you implement composition using an id instead of a reference?

Q17. Which statement best describes the method of inheritance in OOP?

Q18. Which type of inheritance ,when done continuously, is similar to a tree structure?

Q19. Which statement is true?

reference It is even mentioned in Wikipedia: “The constructors can be called explicitly or implicitly. The method of calling the constructor implicitly is also called the shorthand method.”

Q20. Which of the following is NOT an advantage of using getters and setters?

Q21. In context of OOP, what is association?

Reference
Association is a semantically weak relationship (a semantic dependency) between otherwise unrelated objects. An association is a “using” relationship between two or more objects in which the objects have their own lifetime and there is no owner.

Q22. How are user stories different from use cases?

Q23. Which type of inheritance must be used so that the resultant is hybrid?

- Single Inheritance is where a derived class inherits properties and behaviour from a single base class. Example: Class A → Class B.
- Hierarchical Inheritance is where more than one derived class is created from a single base class. Example: Class A → Class B → Class C.
- Multiple Inheritance is for deriving a class from multiple base classes. Here, the child objects programmers create will have combined aspects of characteristics and features from multiple parent classes. These objects do follow their hierarchies of base classes.
- Multilevel Inheritance is where a child class is derived from another derived class. This feature carries combined aspects of multiple classes and follows their hierarchies.
- Hybrid Inheritance is a heterogeneous feature of using multiple inheritances. Here a child class is derived from one or more combinations of single, hierarchical, and multilevel inheritances. This inheritance is adopted for programs to mix different types of inheritance; for example, when mixing a single inheritance with multiple inheritances or maybe a situation when multiple inheritances are mixed within a single program.

reference

Q24. A language that does not support polymorphism but supports classes is considered what?

reference

Q25. Two classes combine private data members and provide public member functions to access and manipulate those data members. Where is abstraction used?

Q26. What are the five Creational Design patterns by the Gang of Four ?

Q27. In multilevel inheritance, one class inherits how many classes?

Q28. if an object is passed by reference, the changes made in the function are reflected _.

Q29. What is a method?

Q30. A mobile phone is made up of components such as a motherboard, camera, and sensors. The motherboard represents all the functions of a phone, the display shows the display only, and the phone is represented as a whole. Which of the following has the highest level of abstraction?

Q31. Which class has the highest degree of abstraction in a multilevel inheritance relationship of five levels?

Q32. Which is NOT one of the basic types of inheritance?

Q33. Why is code duplication so insidious?

Q34. When and how often is a static constructor called?

Q35. What does the code shown below demonstrate, and why?

   static void Multiply(int num1, int num2) {};
   static void Multiply(double num1, double num2, double num3) {};
   static void Multiply(float num1, float num2) {};

Q36. What is the usage of static constructor?

Q37. What are CRC Cards?

reference link

Q38. 1 How are contents of a composition different from those of aggregation?

Q39. 2 Which statement about compositions and aggregations is true?

Q40. What is the result of using more abstraction?

Q41. Which is false for a member function of a class?

Q42. Why is inheritance used when creating a new class?

Q43. In addition to attributes and behaviours, what quality must a class possess?

Q44. Which type of function among the following shows polymorphism?

Q45. Which words in the following list are candidates for objects: trumpet, clean, enrage, leaf, tree, collapse, active, and lively?

Q46. What best describes what object-oriented programming does?

Q47. Can abstract classes be used in multilevel inheritance?

Q48. What type of inheritance may lead to the diamond problem?

Q49. What is the relationship between abstraction and encapsulation?

Q50. Which of these keywords are access specifiers?

Q51. What is a reference to an object?

Q52. Why is unit testing harder in OOP than functional programming?

Q53. What is the function of a user diagram?

Q54. How do object behaviors and attributes differ?

Q55. The open/closed principle states that classes should be open for _ but closed for _.

Q56. Why would you override a method of a base class?

Q57. What is a copy constructor?

Q58. What defines the catch block most accurately?

Q59. 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?

Q60. You have modules that are dependent on each other. If you change one module, you have to make changes in the dependent modules. What term is used to describe this problem, and what is a potential solution?

Q61. _ describes an aggregation

Q62. Which type of function can be used for polymorphism?

Q63. Which choice is a benefit of using dependency injection?

Q64. Are you required to return an object if it was passed by reference to a function, and why or why not?

Q65. Why is inheritance?

Q66. What is the best example of a superclass and subclass relationship?

Q67. Which statements best describe the Gang of Four design patterns called Memento and Observer?

Q68. What does the value (0.5,0.5,0.5) indicate in the class diagram specification position: Coordinate = (0.5,0.5,0.5)?

Q69. What is the most accurate example of the Liskov substitution principle?

public class Car{
}
public class FlyingCars extends Car{
   public void fly(){}
}
public class Tesla FlyingCar{}
public class Honda Car{}
public class Car{
   public void fly(){}
}
public class Tesla extends Car{}
public class Honda extends Car{}
public class Car{
public void fly(){}
}
public class Tesla Car{}
public class Honda Car{}
public class Car{
}
public class FlyingCars extends Car{
   public void fly(){}
}
public class Tesla extends FlyingCar{}
public class Honda extends Car{}

reference link

Q70. What is the difference between a parameter and an argument?

Q71. What is the scope of a class nested inside another class?

Explanation: It depends on the access specifier and the type of inheritance used with the class, because if the class is inherited then the nested class can be used by subclass too, provided it’s not of private type.

Q72. Methods and attributes that define an object are a kind of blueprint called what?

Q73. 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?

Q74. What is the main idea behind separation of concerns?

Q75. What is the purpose of the finally block?

Q76. Which choice is not an OOP language?

Q77. What is the function of a finalizer or destructor?

Q78. An instance of which type of class cannot be created?

Q79. In the context of OOP, what is composition?

Q80. Static polymorphism uses method _ ?

Q81. What does a concrete class not have?

Q82. How does dynamic typing complicate troubleshooting?

Q83. What is the difference between early binding and late binding?

Q84. What is the difference between an interface and an abstract class?

Q85. 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.

Q86. What are the four principles of object-oriented programming?

Q87. From the SOLID principles of object-oriented programming, which statement best describes the Liskov substitution principle?

Q88. In addition to responsibilities, what should be listed on Class-responsability-collaboration (CRC) cards?

Q89. What is the best name for the function that corrects this assessment?

Q90. Which relationship best illustrates an abstract-concrete class relationship?

Q91. What cannot be used for polymorphism?

Q92. How many levels does multilevel inheritance allow in a program?

Q93. What is a virtual Method?

Q94. Which of these is not a basic principle of Object Oriented Programming?

Reference

Q95. How do object behaviours and attributes differ?

Q96. How coupled should your classes be and why?

Q97. Which statement best describes a friend class?

Reference

Q98. Which code sample demonstrates multiple inheritance?

Q99. What is multilevel inheritance?

Reference

Q100. Can you have two classes with the same name in the same project?

Q101. Objects are passed by _

Q102. If a language just implements pass-by-value parameters to functions, can the objects passed as parameters be set to new instances inside the function and their new value will return to the caller?

Q103. What is encapsulation?

Q104. What is a method?

Q105.What is the most accurate example of the Liskov substitution principle?

Q106 what describes an agrregation

107. Which choice is a benefit of using dependency injection?

Q108. What cannot be used for polymorphism?

Q109. An instance of which type of class cannot be created?

Q110. From the SOLID principles of object-oriented programming, which statement best describes the Liskov substitution principle?

Q111. What are the five Creational Design patterns by the Gang of Four ?

Q112. What is the difference between an interface and an abstract class?

Q113. Which relationship best illustrates an abstract-concrete class relationship?

Q114. Which choice is a benefit of using dependency injection?

Q115. _ describes an aggregation

Q116. Which type of function can be used for polymorphism?

Q117. Which choice is a benefit of using dependency injection?

Q118. Are you required to return an object if it was passed by reference to a function, and why or why not?

Q119. From the SOLID principles of object-oriented programming, which statement best describes the Liskov substitution principle?

Q120. In addition to responsibilities, what should be listed on Class-responsability-collaboration (CRC) cards?

Q121. What is the best name for the function that corrects this assessment?

Q122. Who invented OOP?