Custom Search
Wednesday, April 30, 2008
38. What is multithreading and what are the methods for inter-thread communication and what is the class in which these methods are defined?
Multithreading is the mechanism in which more than one thread run independent of each other within the process. wait (), notify () and notifyAll() methods can be used for inter-thread communication and these methods are in Object class. wait() : When a thread executes a call to wait() method, it surrenders the object lock and enters into a waiting state. notify() or notifyAll() : To remove a thread from the waiting state, some other thread must make a call to notify() or notifyAll() method on the same object.
JSF Interview Questions
Does JSF require JSP?

No, it does not. As a matter of fact, JSF was written to be render-technology neutral. This means you can use it with all sorts of non-JSP technology, including XML-based languages like XUL and templating systems like Velocity. The reference implementation includes an XUL-based example that has nothing to do with JSP. That being said, you'll definitely find more industry support behind use of JSP with JSF.



Can we use JSF with JSTL or other custom tags?

When used with JSP, JSF is implemented with JSP custom tags (also called custom actions). The JSF tags will generally work with other custom tags that you or third-parties have developed. Faces tags can be nested within other tags, and vice-versa. In addition, there has been a lot of specific work done to make sure that JSF tags work well with JSTL custom tags.

Labels: , ,

Tuesday, April 22, 2008
What are ORMs supported by Spring and how it integrates with Hibernate?
Spring framework supports the following ORMs:
-Hibernate
-TopLink
-JDO
-iBatis
-JPA
and more..
With Hibernate,Spring can be integrated in following steps:
-Wire with datasource
-Declaring Hibernate properties
-Tell Spring about the Hibernate Mapping files.

Labels:

Monday, April 21, 2008
Some More JDBC Interview Questions
1)How do we get a JBDC connection?
2) What are prepared statements?
3) What are callable statements?
4) What is the BCNF?
5)What is partial dependency?
6)What is transitive dependency?
7) What is lossless decomposition?
8) Is there something called `lossy' decomposition ?

Labels:

Java Threading/ Multithreading Interview Questions with Answers
Describe synchronization in respect to multithreading.

Ans: With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchonization, it is possible for one thread to modify a shared variable while another thread is in the process of using or updating same shared variable. This usually leads to significant errors.


Explain different way of using thread?

Ans: The thread could be implemented by using runnable interface or by inheriting from the Thread class. The former is more advantageous, 'cause when you are going for multiple inheritance..the only interface can help.


What are the two types of multitasking?

Ans :

1.process-based

2.Thread-based

What are the two ways to create the thread?

Ans :

1.by implementing Runnable

2.by extending Thread

What is the signature of the constructor of a thread class?

Ans : Thread(Runnable threadob,String threadName)

What are all the methods available in the Runnable Interface?

Ans : run()

What is the data type for the method isAlive() and this method is available in which class?

Ans : boolean, Thread

What are all the methods available in the Thread class?

Ans :

1.isAlive()

2.join()

3.resume()

4.suspend()

5.stop()

6.start()

7.sleep()

8.destroy()

What are all the methods used for Inter Thread communication and what is the class in which these methods are defined?

Ans :

1. wait(),notify() & notifyall()

2. Object class

What is the mechanisam defind by java for the Resources to be used by only one Thread at a time?

Ans : Synchronisation

What is the procedure to own the moniter by many threads?

Ans : not possible

What is the unit for 1000 in the below statement?

ob.sleep(1000)

Ans : long milliseconds

What is the data type for the parameter of the sleep() method?

Ans : long

What are all the values for the following level?

max-priority

min-priority

normal-priority

Ans : 10,1,5

What is the method available for setting the priority?

Ans : setPriority()

What is the default thread at the time of starting the program?

Ans : main thread

The word synchronized can be used with only a method.

True/ False

Ans : False

Which priority Thread can prompt the lower primary Thread?

Ans : Higher Priority

How many threads at a time can access a monitor?

Ans : one

What are all the four states associated in the thread?

Ans : 1. new 2. runnable 3. blocked 4. dead

The suspend()method is used to teriminate a thread?

True /False

Ans : False

The run() method should necessary exists in clases created as subclass of thread?

True /False

Ans : True

When two threads are waiting on each other and can't proceed the programe is said to be in a deadlock?

True/False

Ans : True

Which method waits for the thread to die ?

Ans : join() method

Which of the following is true?

1) wait(),notify(),notifyall() are defined as final & can be called only from with in a synchronized method

2) Among wait(),notify(),notifyall() the wait() method only throws IOException

3) wait(),notify(),notifyall() & sleep() are methods of object class

1
2
3
1 & 2
1,2 & 3
Ans : D

Garbage collector thread belongs to which priority?

Ans : low-priority

What is meant by timeslicing or time sharing?

Ans : Timeslicing is the method of allocating CPU time to individual threads in a priority schedule.

What is meant by daemon thread? In java runtime, what is it's role?

Ans : Daemon thread is a low priority thread which runs intermittently in the background doing the garbage collection operation for the java runtime system.

Labels: , , , ,

Friday, April 18, 2008
How to handle duplicate submits in Struts?
The duplicate form submission occurs-When a user clicks the Submit button more than once before the response is sent back or- When a client accesses a view by returning to a previously bookmarked page.It may result in inconsistent transactions and must be avoided.In Struts this problem can be handled by using the saveToken() and isTokenValid() methods of Action class. saveToken() method creates a token (a unique string) and saves that in the user's current session, while isTokenValid() checks if the token stored in the user's current session is the same as that was passed as the request parameter.It can be done by loading JSP through an Action and before loading the JSP call saveToken() to save the token in the user session. When the form is submitted, check the token against that in the session by calling isTokenValid

Labels:

Thursday, April 17, 2008
Explain different inheritance mapping models in Hibernate?
There can be three kinds of inheritance mapping in hibernate

1. Table per concrete class with unions

2. Table per class hierarchy

3. Table per subclassExample:

We can take an example of three Java classes like Vehicle, which is an abstract class and two subclasses of Vehicle as Car and UtilityVan.1. Table per concrete class with unionsIn this scenario there will be 2 tablesTables: Car, UtilityVan, here in this case all common attributes will be duplicated.2. Table per class hierarchySingle Table can be mapped to a class hierarchyThere will be only one table in database named 'Vehicle' which will represent all attributes required for all three classes.Here it is be taken care of that discriminating columns to differentiate between Car and UtilityVan3. Table per subclassSimply there will be three tables representing Vehicle, Car and UtilityVan
What are the problems you have with JDBC and how does Spring framework help to resolve them?
JDBC helps in accessing underlying RDBMS but it sometimes be quite cumbersome to use them and in following situations it become problematic:
-You have to ensure that ResultSets, Statements and (most importantly) Connections are closed after use. Hence correct use of JDBC results in a lot of code which is a common source of errors. Connection leaks can quickly bring applications down under load.
-The SQLException does not provide much information about what actually the probelm is as JDBC does not offer an exception hierarchy, but throws SQLException in response to all errors.The meaning of these values varies among databases.
Spring addresses these problems in two ways:
-By providing APIs that move tedious and error-prone exception handling out of application code into the framework. The framework takes care of all exception handling; application code can concentrate on issuing the appropriate SQL and extracting results. -By providing a meaningful exception hierarchy for your application code to work with in place of SQLException. When Spring first obtains a connection from a DataSource it examines the metadata to determine the database product. It uses this knowledge to map SQLExceptions to the correct exception in its own hierarchy descended from org.springframework.dao.DataAccessException. Thus your code can work with meaningful exceptions, and need not worry about proprietary SQLState or error codes. Spring's data access exceptions are not JDBC-specific, so your DAOs are not necessarily tied to JDBC because of the exceptions they may throw

Labels: ,

How you will handle errors and exceptions in Struts?

An efficient error and exception handling makes an application behave gracefully under abnormal conditions.Struts has errors and exception handling done in different ways.The form validations using Struts require a proper mechanism.For handling errors in Struts,it has two objects ActionError and ActionErrors.Whenever a form is submitted then cotroller receives request and then create ActionForm object which calls reset() method and stores ActionForm object to required scope and then it loads ActionForm object from request and calls validate() method.If validate method fails then errors are displayed on the form itself through html:errors tags.
Exception Handling can be done in following ways:

-try-catch block within -Using declarative exception handling.In struts-config.xml we can declare on which type of exception, a request should be redirected to.Use Global Exceptions tag in struts-config.xml

global-exceptions

"<"exception key="errors.MyException" type="java.lang.MyException" path="/myExcption.jsp"/ ">"

So whenever MyException occurs then Struts framework will display 'myException.jsp' page.The interpretation of this is that if MyException is caught by Struts' ActionServlet then it should redirect to myExcption.jsp. The key is as usual a pointer to the message resource file.


Labels: , ,

Wednesday, April 16, 2008
What causes memory leaks in Java?
We know that a memory leak can occur in Java applications when object references are unintentionally held onto after the references are no longer needed. Typical examples of these are large collection objects, a unbounded cache, large number of session objects, infinite loops etc. A memory leak results in a OutOfMemoryError.Besides this core reason, there are other factors that may also result in a OutOfMemoryError exception

1. Java heap fragmentation: Heap fragmentation occurs when no contiguous chunk of free Java heap space is available from which to allocate Java objects. Various causes for this problem exist, including the repeated allocation of large objects (no single large fragment in first generation). In this case, even if we see good amount of free heap, memory allocation fails.

2. Memory leaks in native heap. This problem occurs when a native component, like database connections, is leaking.

3. Perm size has exhausted. The permanent generation of the heap contains class objects. If your code is using a lot of reflection/introspection, then a number of temporary class objects are created that would exhaust the perm space. More info can be found here.

Labels: , ,

Friday, April 11, 2008
Collection Of good Technical Websites For Tutorials And Books
Tuesday, April 08, 2008
Developer and Testing/Tester
Development and testing are two sides of coin, without development testing can’t be possible and without testing development can’t be complete. As a developer what I feel is a developer should be good tester to deliver quality of product

Following list of Questions are helpful for tester as well as developer so that developer can become good tester and tester can become very very good in testing to deliver quality of product.


1. What is Software Testing?
2. What is the Purpose of Testing?
3. What types of testing do testers perform?
4. What is the Outcome of Testing?
5. What kind of testing have you done?
6. What is the need for testing?
7. What are the entry criteria for Functionality and Performance testing?
8. What is test metrics?
9. Why do you go for White box testing, when Black box testing is available?
10. What are the entry criteria for Automation testing?
11. When to start and Stop Testing?
12. What is Quality?
13. What is Baseline document, Can you say any two?
14. What is verification?
15. What is validation?
16. What is quality assurance?
17. What is quality control?
18. What is SDLC and TDLC?
19. What are the Qualities of a Tester?
20. When to start and Stop Testing?
21. What are the various levels of testing?
22. What are the types of testing you know and you experienced?
23. What exactly is Heuristic checklist approach for unit testing?
24. After completing testing, what would you deliver to the client?
25. What is a Test Bed?26. What is a Data Guidelines?
27. Why do you go for Test Bed?
28. What is Severity and Priority and who will decide what?
29. Can Automation testing replace manual testing? If it so, how?
30. What is a test case?
31. What is a test condition?
32. What is the test script?
33. What is the test data?
34. What is an Inconsistent bug?
35. What is the difference between Re-testing and Regression testing?
36. What are the different types of testing techniques?
37. What are the different types of test case techniques?
38. What are the risks involved in testing?
39. Differentiate Test bed and Test Environment?
40. What ifs the difference between defect, error, bug, failure, fault?
41. What is the difference between quality and testing?
42. What is the difference between White & Black Box Testing?
43. What is the difference between Quality Assurance and Quality Control?
44. What is the difference between Testing and debugging?
45. What is the difference between bug and defect?
46. What is the difference between verification and validation?
47. What is the difference between functional spec. and Business requirement specification?
48. What is the difference between unit testing and integration testing?
49. What is the diff between Volume & Load?
50. What is diff between Volume & Stress?
51. What is the diff between Stress & Load Testing?
52. What is the Diff between Two Tier & Three tier Architecture?
53. What is the diff between Client Server & Web Based Testing?
54. What is the diff between Integration & System Testing?
55. What is the Diff between Code Walkthrough & Code Review?
56. What is the diff between walkthrough and inspection?
57. What is the Diff between SIT & IST?
58. What is the Diff between static and dynamic?
59. What is the diff between alpha testing and beta testing?
60. What are the Minimum requirements to start testing?
61. What is Smoke Testing & when it will be done?
62. What is Adhoc Testing? When it can be done?
63. What is cookie testing?
64. What is security testing?
65. What is database testing?
66. What is the relation ship between Quality & Testing?
67. How do you determine, what to be tested?
68. How do you go about testing a project?
69. What is the Initial Stage of testing?
70. What is Web Based Application Testing?
71. What is Client Server Application Testing?
72. What is Two Tier & Three tier Architecture?
73. What is the use of Functional Specification?
74. Why do we prepare test condition, test cases, test script (Before Starting Testing)?
75. Is it not waste of time in preparing the test condition, test case & Test Script?
76. How do you go about testing of Web Application?
77. How do you go about testing of Client Server Application?
78. What is meant by Static Testing?
79. Can the static testing be done for both Web & Client Server Application?
80. In the Static Testing, what all can be tested?
81. Can test condition, test case & test script help you in performing the static testing?
82. What is meant by dynamic testing?
83. Is the dynamic testing a functional testing?
84. Is the Static testing a functional testing?
85. What are the functional testing you perform?
86. What is meant by Alpha Testing?
87. What kind of Document you need for going for an Functional testing?
88. What is meant by Beta Testing?
89. At what stage the unit testing has to be done?
90 Who can perform the Unit Testing?
91. When will the Verification & Validation be done?
92. What is meant by Code Walkthrough?
93. What is meant Code Review?
94. What is the testing that a tester performs at the end of Unit Testing?
95. What are the things, you prefer & Prepare before starting Testing?
96. What is Integration Testing?
97. What is Incremental Integration Testing?
98. What is meant by System Testing?
99. What is meant by SIT?
100 .When do you go for Integration Testing?
101 Can the System testing be done at any stage?
102. What are stubs & drivers?
103. What is the Concept of Up-Down & Down-Up in Testing in integration testing?
104. What is the final Stage of Integration Testing?
105. Where in the SDLC, the Testing Starts?
106. What is the Outcome of Integration Testing?
107. What is meant by GUI Testing?
108. What is meant by Back-End Testing?
109. What are the features, you take care in Prototype testing?
110. What is Mutation testing & when can it be done?
111. What is Compatibility Testing?
112. What is Usability Testing?
113 What is the Importance of testing?
114. What is meant by regression Testing?
115. When we prefer Regression & what are the stages where we go for Regression Testing?
116. What is performance testing?
117. What is the Performance testing; those can be done Manually & Automatically?
118 What is Volume, Stress & Load Testing?
119. What is a Bug?120. What is a Defect?
121. What is the defect Life Cycle?
122. What is the Priority in fixing the Bugs?
123. Explain the Severity you rate for the bugs found?
124. Diff between UAT & IST?125. What is meant by UAT?
126. What all are the requirements needed for UAT?
127. What are the docs required for Performance Testing?
128. What is risk analysis?129. How to do risk management?
130. What are test closure documents?
131. What is traceability matrix?
132. What ways you followed for defect management?