TGViewer
Coding Interview Resources Coding Interview Resources @crackingthecodinginterview ยท 52.2K subscribers
Post #2735 2.13K
โœ… OOP Interview Questions with Answers Part-3 ๐Ÿ’ก๐Ÿ’ป

21. What is a final class or method?
โ€ข A final class can't be extended.
โ€ข A final method can't be overridden.
Useful for security, immutability (e.g., String class in Java is final).

22. What is object cloning?
โ€ข Creating an exact copy of an object.
โ€ข In Java: use .clone() method from Cloneable interface.
โ€ข Shallow vs Deep cloning:
โ€“ Shallow copies references.
โ€“ Deep copies full object graph.

23. What is a singleton class?
โ€ข A class that allows only one instance.
โ€ข Ensures shared resource (like a config manager or DB connection).
โ€ข Common in design patterns.
public class Singleton {
private static Singleton instance = new Singleton();
private Singleton() {}
public static Singleton getInstance() {
return instance;
}
}

24. What are access specifiers?
Control visibility of class members:
โ€ข public โ€“ accessible everywhere
โ€ข private โ€“ only inside the class
โ€ข protected โ€“ inside class subclasses
โ€ข (default) โ€“ same package

25. What is cohesion in OOP?
โ€ข Degree to which class elements belong together.
โ€ข High cohesion = focused responsibility โ†’ better design.

26. What is coupling?
โ€ข Dependency between classes.
โ€ข Low coupling = better modularity, easier maintenance.

27. Difference between tight and loose coupling?
โ€ข Tight coupling: classes are strongly dependent โ†’ harder to modify/test.
โ€ข Loose coupling: minimal dependency โ†’ promotes reusability, flexibility.

28. What is composition vs aggregation?
โ€ข Composition: "part-of" strong relationship โ†’ child can't exist without parent.
Example: Engine in a Car
โ€ข Aggregation: weak association โ†’ child can exist independently.
Example: Student in a University

29. Difference between association, aggregation, and composition?
โ€ข Association: General relationship
โ€ข Aggregation: Whole-part, but loose
โ€ข Composition: Whole-part, tightly bound

30. What is the open/closed principle?
โ€ข From SOLID:
โ€œSoftware entities should be open for extension, but closed for modification.โ€
โ€ข Means add new code via inheritance, not by changing existing logic.

๐Ÿ’ฌ Double Tap โ™ฅ๏ธ for Part-3
  • โค 5
More from @crackingthecodinginterview
  1. Oct 9, 2026๐Ÿ”ฅ SQL Interview Case Studies (Advanced Business Scenarios) ๐Ÿ’ฏ ๐Ÿง  Case Study 1: Find Repeaโ€ฆ
  2. Oct 9, 2026๐Ÿ‡ฎ๐Ÿ‡ณ ๐—š๐—ข๐—ฉ๐—˜๐—ฅ๐—ก๐— ๐—˜๐—ก๐—ง ๐—ข๐—™ ๐—œ๐—ก๐——๐—œ๐—” โ€” ๐—”๐—œ๐—–๐—ง๐—˜ ๐—œ๐—ก๐—ง๐—˜๐—ฅ๐—ก๐—ฆ๐—›๐—œ๐—ฃ๐—ฆ ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ ๐Ÿš€โ€ฆ
  3. Oct 8, 2026๐ŸŽ“ ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐˜„๐—ถ๐˜๐—ต ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ฒ๐˜€! ๐Ÿš€๐Ÿ”ฅ Upgrโ€ฆ
  4. Oct 7, 2026๐Ÿš€ DSA Topics Every Programmer Should Know ๐Ÿ’ป๐Ÿ”ฅ ๐Ÿ“ฆ 1. Arrays โœ” Traversal โœ” Searching โœ” Sorโ€ฆ
  5. Oct 7, 2026๐Ÿš€๐—ฃ๐—ฎ๐˜† ๐—”๐—ณ๐˜๐—ฒ๐—ฟ ๐—ฃ๐—น๐—ฎ๐—ฐ๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—ง๐—ฟ๐—ฎ๐—ถ๐—ป๐—ถ๐—ป๐—ด | ๐—•๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฒ ๐—ฎ ๐—™๐˜‚๐—น๐—น๐˜€๐˜๐—ฎ๐—ฐโ€ฆ
  6. Oct 7, 2026๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—ฃ๐—ผ๐˜„๐—ฒ๐—ฟ ๐—•๐—œ ๐—ณ๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜! ๐Ÿ”ฅ Learn Power BI through these FREE learninโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’