Monday, March 11, 2013

Hibernate questions

  • Can I pass Hibernate entities across the wire via web services?
  • What are hibernate proxies? How are they created?
  • What is lazy loading? Why do so many folks struggle with the LazyInitializationException error during lazy loading?
  • Do I need to learn Hyper SQL to use Hibernate? Can I use plain SQL?
  • What is the best approach - Data Model first and then Hibernate entities or vice versa. What are the pros and cons of each?
  • Are Hibernate annotations compile-time or run-time scope?
  • When we save/persist an object using Hibernate, how does Hibernate understand what fields/properties to save? Does it save all columns even if only one has changed? Hint: the _dirty flag :)
  • Should the Hibernate 'increment' id generator be used in production? What are the pitfalls?
  • How does Hibernate ENVERS work?
  • In Envers, the audit 'insert' is part of the same transaction, or async?
  • Can Hibernate supports Global Transactions ...i.e. two phase commit?
  • Can Hibernate be used in EJB 3.0 as JPA provider? What are the pros/cons? What would you recommend?
  • Can Hibernate prevent SQL Injection Attacks? How?
 

Monday, November 05, 2012

Security concepts

  • What is the difference between pseudo-random numbers and real random numbers? PRNG and TRNG...
  • Is it even possible to create a true random number?
  • Why are random numbers important in cryptography?
  • What is the difference between hashing and encryption?
  • When would you use symmetric vs asymmetric encryption?
  • Does SSL / HTTPS use symmetric key or asymmetric key? What is session key?
  • What do you mean by 128-bit encryption? Is it the size of the symmetric key or asymmetric key?
  • What is the difference between digital signature and digital certificate?
  • What does a digital certificate contain? Also please explain how this all relates to the "Chain of Responsibility" design pattern?
  • What's the difference between a GUID generator and a random number generator?
  • When you install a digital certificate on the server, where is the private key stored?
  • What digital certs are installed on your brower? Who installs them and why are they required?
 Sample scenarios: What to do? Whose public / private key to use?
  • You want to send a encrypted message to a person
  • You want to digitally sign a document/message

i18N concepts

  • What is the difference between Unicode and UTF-16?
  • What is the significance of UTF-8? When to use it?
  • If Chinese characters are represented as 2 or 3 bytes, how will you find out the length of a string in Chinese? For e.g. for validating the length of a field on a form.
  • When do we need to use Base64 encoding?
  • If I need to make an application i18n enabled, besides label/message strings, what are the other areas (data-points) I need to take care of?
  • Can you open an unicode file (containing CJK chars) in notepad? If not, then why? What editors support unicode on your desktop?

Monday, October 15, 2012

BPMN questions

  • What is the difference between a pool and a lane in a business process flow diagram?
  • What is the difference between a sequence flow and a message flow?
  • Can a sequence flow cross pools?
  • What are the different standards (diagrams) available for modelling business processes?
  • Why do we need BPEL? Is there a one-to-one mapping between BPMN and BPEL elements?

Thursday, January 18, 2007

GC questions

What is the default heap size allocated?

What should all threads stop when the GC runs ?

How does the low pause concurrent GC run?

What are the different generations/spaces in the heap? Diff between permanent generation, tenured generation and survivors?

What is the max heap size U can set on a 32-bit system?

Sunday, June 18, 2006

JDBC questions

-How would U insert a binary file contents into the database?
- What are batch statements in JDBC? Can U add a select sql in batch processing?
- How will U check that the JDBC driver supports batch processing/scrollable resultset etc?
- What are the different types of Rowsets? What is the advantage of a rowset?

Wednesday, May 03, 2006

On Logging

What is the difference btw Log4J and java.util.logging?
Explain the concept of receivers and appenders in Log4J.
What is NDC, MDC in Log4J terminology?
I have 2 components - one written in C# and one in Java. How can I store the log of both of them in a single database table?
Can I make changes to the Log4J config file at runtime? (not requiring a server restart)

Thursday, January 26, 2006

Messaging Questions

How do I gaurantee once and only once delivery of a message in JMS ?
Can a message producer and message consumer be part of the same transaction?
How are message acknowledgements handled in JMS?

Scenario:
An application makes a remoting call and then puts a message on a queue and then makes one more database call. I want all of these 3 operations to be executed in a single transaction. How can U accomplish this ?

Tuesday, January 03, 2006

How would U debug a multi-threaded application?. Say U have a Swing Application that creates 3 threads. Have U tried multi-threading debugging in Eclipse, Sun Studio ?

In a Swing Application, if the main thread dies, then what happens?

Wednesday, November 23, 2005

  • When would U use thread pooling ?
  • How would U implement a thread pool ?
  • What are worker queues and worker threads ?
  • Have U explored the java.util.concurrent package in Java 5.0 ?
  • What is a deadlock and a race condition ?

Thursday, October 13, 2005

What's the advantage of adding a "serialVersionUID" to a Java source file?

Tuesday, October 11, 2005

EJB Questions:
-----------------------
Give some examples of services offered by a EJB container?. What's the advantage of component model of software design?

How does the EJB container manage to intercept calls to a remote object and apply transactions, security?

Can an Entity EJB be dedicated to a single client?

What protocol is used when a EJB client communicates with a EJB server?

What's the difference btw EJB and CORBA models?

Wednesday, October 05, 2005

What's the difference between JSP include directive and include element?

Struts Questions

-- Explain the Struts architecture.
-- What are form-beans. Why are they required. Heard of DynaActionForm? Are form-beans required in Struts2?
-- How is form validation done in Struts?
-- Is validation done on server side of client side or both? Javascript vs Java?
-- Can there be more than one struts-config file?.
-- Can I change the name of the struts config file?
-- Can I use Tiles, Velocity template engine with struts?

-- What is the use of custom tags in JSP?
-- Would U use JSTL or Struts custom tags in Ur JSP pages?
-- What does the TLD file contain?
-- Difference between Struts 1.x and Struts 2.x?
-- How to use the MDC/NDC in Log4J with Struts? Where to put in the code? Which common place?
-- Can Struts2 be used with JSF?
-- How is AJAX handled in Struts 2?
-- Can we use JQuery instead of DWR?
-- Tiles vs IFrame? Pros and cons..
-- Can a single webapplication have some resources to be accessed thru HTTP and some by HTTPS?

Friday, September 23, 2005

If I declare a class as 'protected', can other classes in the same package access the class?

Monday, September 19, 2005

What is "inversion of control" design pattern? What is "dependency injection" ?

Thursday, September 08, 2005

Suppose U have a data collection (say a "arraylist"). U want to make sure that no one else can modify it. i.e. U want to make it immutable. How will U do it?
What would U do if U need a "Multi-Map" collection? i.e. U have a collection where one key may map to many values.
Can a Java class be private or protected?
What is the advantage of Inner classes over encapsulation?
I can make a class as "package" access. Will this not suffice ? Why do I need Inner classes?

Tuesday, September 06, 2005

How will U debug a Java program that has several threads running?
If U place a break-point somewhere, will all threads be suspended or only a single thread?

Tuesday, August 16, 2005

What's the difference between the 'java.exe' and 'javaw.exe' processes?
When to use what?

Monday, June 27, 2005

A circular project dependency occurs when two or more projects depend on each other. For example: FileOne in ProjectA depends on FileTwo in ProjectB, and FileThree in ProjectB depends on FileFour back in ProjectA.

How will U solve such dependencies in Java ?

Wednesday, June 22, 2005

Suppose U have a file that needs to be shared between a Java application and a non-Java application for writing/reading. How will U do it ?

Friday, June 17, 2005

Why does the Java language make it mandatory to have wait() and notify() inside a synchronized block?
What's the difference btw the notify() and notifyAll() method?
When should U use what?
Why should wait() and notify() methods be placed inside a synchronized block?

Monday, June 13, 2005

What is a race condition? How is it different from a dead-lock?

Thursday, June 09, 2005

What's the difference between a CORBA object and a servant?

Wednesday, June 08, 2005

  • What are boot-strap classes in Java?
  • What is a Class Loader? Can we write our own Class Loader?
  • What is class Class?

What is obfuscation and how does it work?
How to Decompilers work ?

Monday, June 06, 2005

U develop an application that supports various languages using globalization. How will U compare or sort strings?. Will the == or equals() method suffice?

Thursday, June 02, 2005

What is the double-buffering technique used in almost all GUIs? Do Java Swing components use double-buffering?
  • Can the return type of a overloaded method be different?
  • Can I override a private method of a class? (Remember that private methods are not accessible to subclasses)
  • How is synchronization done between threads?
  • What is a object lock or mutex?
  • What is a class lock? How can we obtain a class lock.
  • Can I use any arbitary object as a lock? (For e.g. Object myLock = new Object() )

  • What's the difference between an ArrayList and a Vector?
  • Can I make a ArrayList shynchronized?
  • What's the difference between a List and a Set?
  • What data-structures have U used in Ur project and what were Ur deciding factors on the choice of collection object?
  • Ever heard of a "Muti-Map" collection object?
  • Which collection object in Java is best if U want fast searching?
  • How will U do a binary search on a ArrayList?
What's the difference between AWT and SWING? Ever heard of SWT?
  • How does GC occur in Java?
  • Ever heard of soft references, weak references, phantom references? What is their use?
  • When do U get a "OutOfMemory" error?
  • What are root nodes?

Important Notice - to all wannabe geeks..

In this blog, I am going to post Java interview questions.

These questions will not have their answers. This is on purpose !!!!

I do not want someone to just read the answers and mug-up for an interview...
A true geek should take the pain to find out the answers and understand the underlying concepts.
It is possible that some of the answers may be found at my other blog:
http://NarenCoolGeek.blogspot.com/

Note: Some questions would be very simple, some complex and confusing...Enjoy !!!