(For multiple choice questions, unless otherwise specified, circle all
a.) Software entities (classes, modules, functions) should be open for
extension, but closed for modification.
2.) Is it good OOD practice to favor composition over inheritance? Why or why not?
Oop design principles states some of the principles one of it is "favor composition over inheritance". Both composition and inheritance are important methods of reuse Inheritance was overused in the early days of OO development. Over time we've learned that designs can be made more reusable and simpler by favoring composition
Of course, the available set of composable classes can be enlarged using inheritance. So composition and inheritance work together. But our fundamental principle is Favor Composition Over Inheritance
3.) Is it good design practice to program towards an implementation rather than an interface? Why or why not?
No, it is not good design practice to program towards implementation. Design principle says...
Once you depend on interfaces only, you're decoupled from the implementation. That means the implementation can vary, and that's a healthy dependency relationship.
4.) The _______ pattern centralizes distributed service object lookups, provides a centralized point of control, and may act as a cache that eliminates redundant lookups. It also encapsulates any vendor-specific features of the lookup process.
a.) Dependency Injection
5.) What does RMI stand for?
Remote method invocation. Java Remote Method Invocation (Java RMI) enables the programmer to create distributed Java technology-based to Java technology-based applications, in which the methods of remote Java objects can be invoked from other Java virtual machines, possibly on different hosts. RMI uses object serialization to marshal and unmarshal parameters and does not truncate types, supporting true object-oriented polymorphism.
6.) What is an "unchecked runtime exception"? Give at least one example.
The exceptions which occur at runtime and not at compile time are called unchecked runtime exceptions. NullPointerException is one such example.
7.) Given an example of a non mutable class?
jar -tf <NAME OF JAR FILE>
It kills the process with pid 12345 , -9 sends the SIG_KILL signal.
13.) Is HTTP a state full protocol?
No, it is a stateless protocol, so to maintain the state one need to use Session object or coockies or url rewrite.
*-- Sumant Khapre
More Java Questions
Do you have a Java Question?
All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.