Вы находитесь на странице: 1из 13

Questions:-

1. What is exception handling?


2. What do you understand by final, finally and finalize?
3. What are the features of Object Oriented Language?
4. What are abstract classes and how they are different from
interfaces?
5. What is multithreading, with example?
6. How do you create threads (extending Thread class or implementing
Runnable interface), and why?
7. What are different collections?
8. What are key differences between HashMap and HashTable?
9. Why and how HashCode/Equals method should be overridden?
10. How would you store and fetch objects in a HashMap/HashTable
(implementation of Comaparable and Comparator interface)?
11. Describe Singleton/MVC/Factory Methods design pattern?
12. How a Singleton can be created (in multithreaded environment
also)?
13. What are joins in SQL (with example)?
14. Basic Unix commands (e.g. ps, kill, ftp, su).
15. Case studies for Subqueries?
a. There are 4 columns in a table and one of them is a
telephone number. Write a query to retrieve the name of the
employee whose age is less than 25 and does not have a
phone number.
b. You cannot utilize functions such as IS NULL, has to be
done logically using a sub query.
16. What are different types of Statements in JDBC, with usage?
17. Multithreading with Static variables.
18. What is Compile time and Runtime Polymorphism?
19. Basics of Memory Management in JVM.
20. Can a class be Final?

CABS

21. What are some of the Implicit objects in a JSP?


22. What are some of the design patterns that Struts uses?
23. Which class in struts acts as a front controller?
24. Are action classes in struts stateful or stateless? What is its
implication?
25. What is the difference between forward and redirect?
26. Explain different attributes in struts config file? Relationship
between form beans and action classes? One to one, one to many?
27. Design an object model for message formatting and processing
module. (Messages have header and footer, can be of different
formats, processing depends on the content inside the header,
processing may need to be done in multiple steps, again depending
on the content)
28. Design a multithreaded server which can handle messages in Q27
concurrently. (related to a specific project in the work exp)
29. Explain the lifecycle of a thread.
30. Explain left outer join. Write a query involving the use of
subqueries.
31. Explain the ACID properties of transactions.
32. Explain the various isolation levels. (Dirty read, Phantom read,
completely serializable). Explain the significance of each.
33. Are you aware of end points in a transaction?
34. How will you provide transactional support in a standalone java
application? What are the issues to keep in mind? (The application
depends on external IO systems). Specific to the project in work
exp.

COBRA

35. How does a hashmap work?


36. How do u override equals and hashcode methods?
37. What is the difference between overload and override?
38. What is stringbuilder and stringbuffer?difference between
them?
39. How do u implement threads?
40. What is singleton pattern?how do u implement it?
41. What is factory pattern?
42. A puzzle. There is a 4*4 jail.each cell has one
prisoner.the top right cell has JamesBond in it. The left bottom
cell is the only exit from the prison. Every cell has a door to
its adjacent wall except the boundaries. Whenever JB moves to
another cell, he kills that prisoner if he is alive. If the
prisoner is dead, JB himself dies. The next morning jailer sees
that all prisoners are dead and JB has escaped. How is it?
43. Difference between PATH and CLASSPATH. How do u set them?
44. Unix commands. What is ls command? What is “ls –la”?
45. Employee table

Name deptid salary deptid name

------------------------------ ----------------
-------------------

Xxx tech 100 tech technology


Xxx tech 200 hr human resource

Xxx hr 300

Xxx 400

46. Write a query to get unique rows. Display the name of the
employee and the sum of the salary department wise
47. Write a query to get employee name and department name
48. Same as question 1 , but also get the row with deptid as
null
49. What is hashing.Write Hash code and equals method code for
Emp class. What exception may be thrown here.
50. Exception handling(Runtime and compile time exceptions).
51. ClassNotFoundException when thrown and is this runtime or
compile time.
52. Overriding and overloading
53. Polymorphism.
54. Difference between array list and a hash map.
55. Static variable.
56. How do you implement thread.write the code for the two
ways.
57. What would happen when you write Thread.run();
58. Write down the JDBC code for any one of the statements.
59. In jdbc Class.forname() how many time this statement
excutes in a programme..They were trying to confuse me on this.
60. How does DriverManager.getConnection works.
61. Write exception hierarchy.
62. Joins.What is left outer join and left join.Is both same or
there is any difference.Write a query to join two table.
63. Select * from TableA,TableB .what will be the
output.Cartesian join.
64. About Project
65. Design pattern used in my project (Command Pattern)
66. Code snippet of Command pattern
67. Different ways of implementing thread. Why these different
ways in Java spec?
68. Directly calling run() method. What could be the
significance
69. How throws clause impacts in Function overriding?
70. What collection frameworks I used in project?
71. Why do we need to override hashcode & equals method?
72. Code snippet for above.
73. Exceptional handlings, why try-catch , why not throws? Why
throws?
74. How can a object be checked at Runtime?
75. Difference between instanceof keyword & isInstance? Why
both?
76. Code snippet for Singleton
77. Thread safe for singleton
78. Joins – Just a ques do u know that?
79. Tab1(EID,Ename,MgrId) with a record where mgr_id is null &
few records where mgr_id is not present in eid .
80. Ques is : Find the employees who have got managers
81. Write code to override equals(), hascode().
82. Write code to implement Comparable,Comparator for a given
class e.g. Person
83. Write code to create thread using Runnable.
84. What will happen if Thread.run() will be called
85. How does DriverManager works? He asked me after initially
telling me to write some JDBC code.
86. Write code to implement a HashSet.
87. Given a table with EmpId,EmpName and MgrId.Write a SQL
query to give emp name and corresponding manager name.
88. James Bond puzzle.
89. Write code to implement Singleton pattern
90. Write some code using Generics.
91. Given a table with columns Number, SquareRoot. Write a
query to return number, square root and square without using any
mathematical operator and functions.
92. Give a Datamodel to implement a DentalNursingHome.
93. Explain Serialization. Suppose i have a Connection object.
I want to close this connection before serializing and then
reopen it while deserializing.How will i do it?

94. Consider following are two tables.


EMP Dept
Ecode ename mgrcode deptid deptnm mgrcode

The mgrcode from dept table is the dept manager(not emp


manager as in emp table)

Now if we want to know dept details for an employe what


changes it require to the table definitions.
One option is to add deptid in emp table. Another is add
ecode to dept table. Which is better and why.
95. Suppose following are two hash tables or whatever data
structure.

Hashtable1 Hashtable1

1 A 1 A

2 B 3 E

3 C 4 F

Write the logic to select the unmatched records as follows.

2 B _

3 C E

4 _ F

96. How to implement Generics in Java 1.4


97. Singleton class implementation without creating the
instance at class load time and without using the synchronized
method. So if synchronized block is used then will it be a full
proof singleton? If not what is the reason.
98. If an abstract class doesn’t have any abstract method and
only have implemented methods will it throw any error.
99. How to implement a cache of Objects?
100. Suppose we want write a cache class which will cache
Employee objects. So we want that employee objects to be such
that only the cache class can instantiate it and other classes
can not. Though other classes should be able to use the Person
class.
101. How to implement distributed transaction.
102. How to implement transaction using JDBC.
103. What are the isolation levels in for database locking.
104. What are the types of database locking
105. Concept of index
106. How many types of index(clustered , non clustered)
107. What is ORM tool.
108. Implicit objects in JSP
109. Difference between jsp and servlet
110. Implicit modifiers for member variables of Interface and
abstract class
111. What to use abstract class or interface.
112. Design a class model for an Ineventory management system of
vehicles like car,bike,scooter,truck etc.
113. Which return will get invoked when exception occurs in try
block and when exception does not occur.
try{
return 1;
}catch(Exception e){
Return 2;
}finally{
Return 3;
}

114. How to implement immutable objects and why ?


115. What is finalize method and when invoked?
116. Can finalize method be overloaded? If so will it get
invoked by JVM?
117. Can final methods be overloaded?
118. Thread synchronization concept details.
119. What is thread group?

120. About the project previously worked upon.


121. Design pattern used in the project. Explanation of the
same.
122. Difference between XSD & DTD
123. Scenario:
Class A{ | classB{
M1(); | M3();
M2(); | M4();
} | }

Now Design a new class C which has got behavior of both A &
B without changing the classes A & B. Write code for ClassC

124. Scenario:
Given some elements, need to have all elements present
uniquely in some data structure. As well, need to have a
method exposed which returns data structure in sorted
format based on the input string parameter value sent to
the method.
Code snippet for the same.

125. Scenario:
There is some XML which external system sends to our
system. It has got a tag whose values can vary between any
of 50 different values we know. Out of these 50 values, if
we get first 10 values then we need to send the XML to
Formatter A, for next 20 , we need to send XML to Formatter
B, & the remaining 20 values to Formatter C. This can be
achieved by reading value from the tag & having an If
condition which checks the value present in the tag with 50
String constants we have, however having an if condition
this way is a crude approach. What is the better approach
to suffice this?

126. Many Questions related to utility class “Collections”


127. Scenario:
There is some similar functionality which is provided by
some classes, however they differ with the approach, based
on few conditions, I knew which class to invoke, how do I
suffice this need.
Ans: This can be sufficed by either interface pattern or
thru Reflection API.
Code snippet for above.

128. There are two tables T1(Eid,Ename,………),


T2(Eid,university……). Both these tables have only Eid in common.
There are no referential integrity constraints available. I need
all columns to be viewed in T1 table whose Eid has studied in
university (IIIT Allahabad & JNTU)? What are different ways to
write the query & which query gives better in performance?
129. How does a hashmap work?
130. How do u override equals and hashcode methods?
131. What is the difference between overload and override?
132. What is string and stringbuffer?difference between them?
133. How do u implement threads?
134. What is singleton pattern?how do u implement it?
135. What is factory pattern?
136. Difference between PATH and CLASSPATH. How do u set them?
137. Unix commands. What is ls command? What is “ls –la”?
138. Employee table
Name deptid salary deptid name
------------------------------ ----------------
-------------------
Xxx tech 100 tech technology
Xxx tech 200 hr human resource
Xxx hr 300
Xxx 400
139. Write a query to get unique rows. Display the name of the
employee and the sum of the salay department wise
140. Write a query to get employee name and department name
141. Same as question 1 , but also get the row with deptid as
null
142. What are threads?how do u implement them?explain with
example
143. What are the advantages and disadvantages of the two ways
of creating threads?
144. Where are wait(),notify() and yield() present?
145. Explain wait() and notify() with example
146. Explain synchronized keyword with example
147. Explain inheritance with example
148. Can u modify the access modifiers while overriding a method
in a subclass?
149. What are the rules for handling exceptions while overriding
a method in a subclass?
150. Explain static keyword
151. Explain all joins with example
152. Unix commands(ps,cat,grep,crontab)
153. How do u make a deamon process in linux?
154. How do u create singleton class?example
155. Explain ACID
156. Significance of foreign key
157. How do u achieve performance tuning on database?
158. What are indexes?its advantages and disadvantages?types?
159. What is hibernate?how does it work?advantages?
160. How do u create joins on tables in hibernate?
161. What are checked and unchecked exceptions?
162. JMS
163. Scheduling Tools
164. Concurrency package in Java
165. Shell Scripting
166. EJB
167. XML and XSD

Hydra

168. Discussion about the previous project and my role in that.


169. What all data structures you know? Given a Linked List
write an algorithm to reverse the list.
170. There is one thread which prints even numbers other prints
odd. Synchronize both to print numbers in sequence.
171. What are Equals () and hashcode () methods.
172. Given a string by the user, tell which character occurs max
no of times and how many times.
173. What are Class loaders, what is there hierarchy and why
would someone write his own class loader.
174. Singleton pattern
175. What are Indexes? How they help in improving the
performance.
176. Types of indexes?
177. Difference between Equals method and ==.
178. Can we find out how may tables and there columns type in
the database using JDBC.
179. Types of drivers.
180. Write a page about the “What you have been doing since the
last one year and how it helped you in growing technically”.
181. Write an E-mail to the head (in New York) about the status
of the project.
182. There is an array of length 1000 which has 1000 integers.
All integers are in the sequence like 1,2,3, … about 999 integers
and one more which is duplicate of any one existing. Write the
algorithm to find that duplicate entry. The array is not in the
sorted order.
183. There is a table which has employee name and department
name. Find the department which has employees more than 20

March 6, 2009

184. Explain about your previous project


185. What is application server
186. How do you manage sessions
187. How does application server manage session time out
188. Father

Son1 Son2

Son3 Son4

DB Design for data like above

Class design for data like above

189. Date class  Pass a string as 01-01-2009 IST & 0ther as 01-
01-2009 EST. how do u compare these two dates. Many questions on
Date API.
190. I have a string “abbbscaaas”, Need to find out the first
non repeating character.
191. About previous projects
192. Design a class to retrieve employees starting with Manager
followed ny his subordinates
193. What is ORM
194. Design a mechanism to cache the Employee objects. However
the cached employee objects should’nt have any mechnism to change
the state. However the state of the employee objects can be
changed only by the mechanism which is caching the objects. As
well I should prevent client classes which is using my cached
employee objects from doing new employee()
195. I have two lists, I need to merge them. However I want to
ensure that there are no duplicates in that post merging.
196. What are Db indexes?
197. Different types of indexes.
198. I have a table containg data of employee assignments like
EMPID Department Date
1 D1 01/01/2008
1 D2 01/02/2008
1 D2 01/05/2008
1 D2 01/09/2008
1 D3 01/01/2009
1 D4 01/07/2009
1 D1 01/09/2009
1 D2 01/11/2009

Need to find out only those records where in employee had


changed his department from his previous department. Write an sql
query for this.

March -16th

199. About previous project.


200. Define B-Tree Data Structure in Java
201. Algorithm to traverse through B-Tree & Java code for the
same.
202. == & .equals difference. Why?
203. Producer – Consumer Problem in Java
March 19

Round1:

204. Asked about previous project. Lot of questions based on


previous project.
205. What are various implicit objects in jsp.
206. Include one jsp in another jsp. Will the page attributes be
available in included jsp?
207. What is the difference between page and request scope?
208. How will you maintain session with the user?
209. Can you change the request object when u are forwarding the
request?
210. There is a table with CategoryID, Category_details. There
is another table with ProductID, CategoryID, Product_details.
Display the number of products category wise. Also show the
categories which do not have any products in them. Sort according
to Category_ID.
211. Program: There are numbers in a list 1-500. In this list,
one number is occurring twice. Find that number.
212. Simple questions on synchronization, synchronized
collections.
213. Can there be a try block without catch block?
214. Question on order of catch block based on wider/narrower
exception.

Round2: Written Round:

There was a written test consisting of following sections:

Section1: Java Basic concepts: 20 True/False type questions

Section2:Java Code snippets, about finding output: 15 multiple choice


questions

Section3:Design Related questions based on uml, use cases etc: 15


multiple choice questions

Section4: SQL concepts and queries: 20 questions

Round3:

215. We have a library having a collection of books. The


requirement is that the user can ask for a book based on its id.
How will you maintain the record?(Maintain the table details in
DB and keep it loaded in hashmap)
216. Suppose you are using servlets, how will you load the
hashmap for book details at startup?
217. Now the case is that the number of books is very large and
there are 3 categories of books. How will you maintain the books?
(Keep a cache for each category)
218. If you want to load the cache of all 3 categories of books
at startup, how will you do that in fastest manner?(use 3
threads)
219. If there are 20-25 categories, how will you do that? Will
you create 20-25 threads?

Round4:

220. Write a query to display the number of employees


departmentwise. Show those departments only which have more than
15 employees.
221. Long a = new Long(10);
Long b = new Long(10);
long c = 10;
Find out the result of below comparisons:

a==b

c==a

a.equals(b)

222. Asked indirectly some questions about wrapper classes. He


wanted to hear about overriding equals and hashcode.
223. What is the advantage of overriding equals and hashcode?
224. What are the new features in java 1.5?
225. What is the use of generics? What happens to the type
safety at runtime? (he wanted to hear about “type erasure")
226. Design a database for library(u have books, borrower and
lender). How can u find out in the fastest possible way that a
book is available or not?

Round5:

227. What are the technologies you know and level of expertise?
228. If two MDB-A and MDB-B are listening on the same queue, and
we want that a certain kind of messages are sent to MDB-A and
certain kind of messages are sent to MDB-B, how can that be
achieved?(I told that about selectors)
229. If there are no selectors, then which MDB will get the
messages?
230. Where do the messages get stored?
231. Can we go and add our own messages to the JMS filestore?
232. How does Stateful session bean manage the state?
233. How do you manage transactions with EJB?
234. Design a database for the below hierarchy:

Father

Son1 Son2

Son3 Son4

What will be the primary key in the table designed?


235. Have you worked with date API? Given a date in string
format as “22 May 1983 15:00 IST”. Convert this string into date
object. Display the above date in different time zone say EST.
236. Program: Given a list of numbers. Some numbers are
occurring in that list several times. Find out the number that
occurs most frequently.
237. Program: Given a string say “aabcbbdf”, find out the first
non repeating character (the answer should be ‘c’ in this case)

Вам также может понравиться