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?

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

Q4. When does static binding happen?

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

Q6. What is encapsulation?

Q7. What is an IS-A relationship?

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

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

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

Q11.1 When is a constructor executed?

Q11.2 When is a constructor executed?

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

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

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

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

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

Q17. Which statement is true?

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

Q19. In context of OOP, what is association?

Q20. How are user stories different from use cases?

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

NOTE: Hybrid inheritance is a composition of multiple and hierarchical inheritances

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

Q23. If two classes combine some private data members and provides public member functions to access and manipulate those data members. Where is abstraction used?

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

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

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

Q27. What is a method?

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

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

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

Q31. Why is code duplication so insidious?

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

Q33. 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) {};

Q34. What is the purpose os static constructor?

Q35. What are CRC Cards?

reference link

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

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

Q37. What is the result of using more abstraction?

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

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

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

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

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

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

Q44. Can abstract classes be used in multilevel inheritance?

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

Q46. What is the relationship between abstraction and encapsulation?

Q47. Which of these keywords are access specifiers?

Q48. What is a reference to an object?

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

Q50. What is the function of a user diagram?

Q51. How do object behaviour and attributes differ?

Q52. The open/closed principle states that classes should be open for __ but closed for __.

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

Q54. What is a copy constructor?

Q55. What defines the catch block most accurately?