Interview Questions and Answers - Order By Newest Q721. Can we have null keys in TreeMap ? Core Java
Ans. No, results in exception. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   treemap Asked in 6 Companies Basic   frequent Q722. Can value be null in TreeMap ? Core Java
Ans. Yes. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   treemap   yes-no Q723. Which interface TreeMap implements ?
Ans. TreeMap implements NavigableMap, SortedMap, Serializable and Clonable. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   treemap Q724. Do we have form beans in Struts 2 ?
Ans. No, because they are not longer required. As action classes are no more singleton in Struts 2, user inputs can be captured in action itself. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  struts   struts2   struts 2Frequently asked in Phone Interviews. Q725. What the Bean scopes provided by Spring ? Spring
Ans. Singleton , Prototype , Request , Session , global-session Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  spring framework   bean scope   general electric   geFrequently asked in Phone Interviews. Q726. What are the various Auto Wiring types in Spring ?
Ans. By Name , By Type and Constructor. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   spring   spring container   dependency injection   auto wiring   auto wiring types   general electric   ge Q727. What are the the methods to clear cache in Hibernate ? Hibernate
Ans. Evict() and clear(). Evist is used to clear a particular object from the cache whereas clear clears the complete local cache. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   orm   hibernate cache Q728. What are different types of second level cache ? Hibernate
Ans. 1. EHCache ( Easy Hibernate )
2. OSCache ( Open Symphony )
3. Swarm Cache ( JBoss )
4. Tree Cache ( JBoss ) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   orm   hibernate cache   technical lead Asked in 7 Companies Q729. Can we disable first level cache ? What should one do if we don't want an object to be cached ? Hibernate
Ans. No.We can either call evict after the object retrieval or can use separate sessions. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   orm   hibernate cache   architectureAns. Hibernate is a Java ORM Framework. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   orm   frameworks   architecture Q731. What are the different types of inheritance in Hibernate ? Hibernate
Ans. Table Per Class , Table per Sub Class , Table per Concrete Class Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   orm   inheritance hibernate Asked in 1 Companies Basic   frequent Q732. What is lazy fetching in Hibernate ? Hibernate
Ans. Lazy fetching is the technique of not loading the child objects when parent objects are loaded. By default Hibernate does not load child objects. One can specify whether to load them or not while doing the association. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   lazy fetching   architecture Asked in 11 Companies   frequent Try 2 Question(s) Test Q733. Different types of Hibernate Instance States ? Hibernate
Ans. Transient - In this state, an instance is not associated with any persistence context Persistent - In this state, an instance is associated with a persistence context Detached - This is a state for an instance which was previously associated with a persistence context an has been currently closed dissociated Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate Q734. Is It Good to use Reflection in an application ? Why ? Core Java
Ans. no, It's like challenging the design of application. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   reflection api   yes-no   architecture Asked in 1 Companies intermediate Q735. Why is Reflection slower ?
Ans. Because it has to inspect the metadata in the bytecode instead of just using precompiled addresses and constants. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   reflection   reflection api   architecture Q736. When should we use prototype scope and singleton scope for beans ? Spring
Ans. We should use singleton scope for beans when they are stateless and prototype when they are stateful. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  spring   bean scope   general electric   ge  singleton Q737. Difference between Assert and Verify ? Testing
Ans. Assert works only if assertions ( -ea ) are enabled which is not required for Verify.Assert throws an exception and hence doesn't continue with the test if assert evaluates to false whereas it's not so with Verify. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  assert   junit   mockito   verify   testing   unit testing Asked in 5 Companies Q738. Which class elements are not persisted ? Hibernate
Ans. Static and Transient. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   orm Q739. What entries we make in the hibernate config file if we are not using hbm files but Annotations ? Hibernate
Ans. We configure Entity classes having annotated mappings. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   hibernate annotations Q740. How many SessionFactory and Session objects are created ? Java EE
Ans. Single SessionFactory object and multiple session objects for opening different session. Hibernate creates new Session object per thread. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   sessionfactory hibernate   session hibernate Q741. What is the use of hbm2ddl Configuration in Hibernate ? Hibernate
Ans. This configuration specifies if hibernate should creates the Schema / Table on its own if the respective table is not found. "update" doesn't create the table if it's not found whereas configuration set as "create" creates the schema automatically. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   hibernate configuration   hibernate.cfg.xml   hbm2ddl Q742. What is the difference between these 2 annotations ?
@Entity
@Entity ( name="EMPLOYEES" ) Hibernate
Ans. The first annotation will try to map the Class with the Table as of same name as Class whereas the second annotation will specify the Entity name as "EMPLOYEES" and hence will try to map with Table Name "EMPLOYEES". Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   hibernate annotations   entity annotations Q743. What is the difference between these 2 annotations ?
@Entity ( name ="EMPLOYEES")
@Entity @Table ( name=""EMPLOYEES"" )
@Entity ( name="EMP")
@Table ( name="EMPLPYEES" ) Hibernate
Ans. First Annotation will set the Entity name as EMPLOYEES and hence will try to map with the same Table name. The second annotation will make the Entity mapped to table EMPLOYEES irrespective of the Entity Name ( which is class name in this case ). Third Annotations will set the different names for Enitity and Table and will explicitly map them. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   hibernate annotations   entity annotation   table annotation Q744. What are the different ID generating strategies using @GeneratedValue annotation ? Hibernate
Ans. Auto , Identity , Sequence and Table. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   generatedvalue annotations   architecture Q745. How to do Eager loading in Hibernate ? Hibernate
Ans. Using lazy = false in hibernate config file or @Basic(fetch=FetchType.EAGER) at the mapping Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   lazy loading hibernate   basic annotation hibernate   architectureAns. Instead of Saving Parent as well as Child Entities individually , Hibernate provides the option to persist / delete the related entities when the Parent is persisted. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   cascade   hibernate relationship   hibernate associations Q747. What are the different Cascade types ? Hibernate
Ans. Detach, Merge , Persist , Remove , Refresh Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   cascade   cascade type Q748. Which type of associated Entities are Eagerly loaded by Default ? Hibernate
Ans. OneToOne Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   hibernate associations   hibernate relationship Q749. After which Hibernate version , related Entities are initialized lazily ? Hibernate
Ans. After Hibernate 3.0 Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   lazy loading hibernate   lazy initialization hibernate Q750. Can we declare Entity class as final ? Hibernate
Ans. Yes but as Hibernate creates the Proxy Classes inherited from the Entity Classes to communicate with Database for lazy initialization. Declaring entity classes as final will prohibit communication with database lazily and hence will be a performance hit. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate   proxy objects   proxy classes   entity hibernate