Interview Questions and Answers - Order By Rating Advanced level question frequently asked in US based companies. Recently asked in EMC and Intuit. Q31. Can you provide some implementation of a Dictionary having large number of words ? Solution
Ans. Simplest implementation we can have is a List wherein we can place ordered words and hence can perform Binary Search.
Other implementation with better search performance is to use HashMap with key as first character of the word and value as a LinkedList.
Further level up, we can have linked Hashmaps like ,
hashmap {
a ( key ) -> hashmap (key-aa , value (hashmap(key-aaa,value)
b ( key ) -> hashmap (key-ba , value (hashmap(key-baa,value)
....................................................................................
z( key ) -> hashmap (key-za , value (hashmap(key-zaa,value)
}
upto n levels ( where n is the average size of the word in dictionary. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   hashmap   binary search   search algorithm   advanced   architecture   data structure Asked in 6 Companies   frequent Try 1 Question(s) Test Q32. Which of the following syntax is correct ?import static java.lang.System.*;or static import java.lang.System.*; Core Java
Ans. import static java.lang.System.*; Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   static import   generics   import   OCJP   SCJP   Oracle certified java developer Asked in 1 Companies Very frequently asked if being interviewed for hibernate. Frequently asked in Tata Consultancy (TCS) and Overstock.com Q33. Difference between load and get ? Hibernate
Ans. If id doesnt exist in the DB load throws an exception whereas get returns null in that case.get makes the call to DB immediately whereas load makes the call to proxy. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate Asked in 16 Companies basic   frequent Frequently asked question in companies using Hibernate. Q34. What is Lazy Initialization in Hibernate ? Hibernate
Ans. It's a feature to lazily initialize dependencies , relationship and associations from the Database. Any related references marked as @OneToMany or @ManyToMany are loaded lazily i.e when they are accessed and not when the parent is loaded. Sample Code for Lazy Initialization 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   architecture Asked in 77 Companies Basic   frequent Try 2 Question(s) Test Q35. What things you will look for if you get following exception while making DB call ? table or view does not exist Database
Ans. First will check if the table or view actually exist in the DB If it does , Will make sure to see that the application has rights on the schema that holds the respective Table. Will then make sure that we have prefixed the schema with the table name while accessing it. Will then make sure that its not DB Cache that's causing it as the table DDL might have been created recently. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sql   database   oracle   technical lead Q36. What's the benefit for specifying constraints like Not Null , Primary Key explicitly instead of specifying it against the column ? Database
Ans. In case we specify them explicitly we can have control over constraint name as otherwise they will be system generated. It provides an ease in case we plan to drop the constraint in future. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sql   database   oracle Q37. How can we disable a constraint ? Database
Ans. alter table table_name DISABLE constraint constraint_name; Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sql   database   oracle Q38. Can we have foreign key reference to a non primary key column ? Database
Ans. Yes, but the respective key in the foreign table should be declared Unique. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sql   database   oracle Asked in 2 Companies Q39. What should be done for auto generating primary key id in a table ? Database
Ans. We need to create a sequence. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sql   database   oracle Q40. Which constraint cannot be specified as an explicit constraint and should be specified with the column only ? Database
Ans. NOT NULL Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sql   oracle   database   ddl   constraint   table creation Q41. How to know the structure of a Table in Oracle ? Database
Ans. DESC Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sql   database   oracle Q42. How to know the constraints on a Table in Oracle ? Database
Ans. SELECT * FROM user_constraints WHERE table_name = '