Panasonic Youth rob sanheim writes about software, business, ruby, music, stuff and things



Posted
22 July 2005 @ 5pm

Tagged
Agile, Java, Jobs, Patterns

Discuss

Java technical interview guide - part 1

update 8/31/05: I have written part two with some possible answers. Also, renamed the post.

I did a technical evaluation for a candidate my employer was looking at awhile ago, so I had an opportunity to try and figure out a good set of technical questions for a prospective intermediate level Java web developer. I’ll just present a whole bunch of questions I came up with - no answers though. I might start up an answers post at a later date, but I don’t want to make this too easy for those trying to fool interviewers. =) Obviously, if you ask every question I have listed here your interview could take hours, so pick and choose what you like. I’d be interested in feedback for ideas on important topics I’ve overlooked or questions that are unfair or unnecessary. I’ve tried to avoid things that can be easily answered with a quick google search, such as basic syntax and API method questions.

Anyways, on to the questions.

General Intro Questions

Just laying the ground work to help lead the way for areas to focus on…

  • Give me a high level description of your experience with the Java platform. What APIs do you have experience with? Servlets? J2EE? Swing?
  • What development methodologies have you used? Which one have you liked the most? The least?
  • What open source frameworks do you have experience with?
  • What other languages have you used?

Object Oriented Principles

  • Define object oriented programming (quite a loaded question…). What are the key OO principles?
  • Describe polymorphism.
  • Describe inheritance (”is-a”) and composition (”has-a”). Can you give an example of a use case for each?
  • What is coupling? Why do we want loose coupling in our systems?

Java Basics

Some very fundamental questions I think any “non-beginner” level dev should know. If there are a lot of problems with these it may not be worth continuing.

  • What is the difference between abstract classes and interfaces?
  • Explain the access modifiers in Java.
  • Talk about method overriding and method overloading and their differences.
  • Why does Java have exceptions? What is the difference between checked and unchecked exceptions?
  • What are constructors? Are they inherited?
  • What is the static modifier used for in regards to classes and methods?
  • What are the equals() and hashcode() ? Describe their contracts.
  • When do you use String and when do you use StringBuffer/StringBuilder

Java Intermediate/Advanced

  • Explain the following statement: Java is always pass-by-value.
  • How do you create an immutable type? What are the advantages of immutability?
  • What is a static inner class? Can you provide an example from the Java API?
  • What are the implications of implementing serializable in an object?
  • Why would you declare a private constructor?
  • When do you want to use unchecked exceptions and when do you want to use checked?
  • Can you explain how Strings are “interned” in Java?
  • What are enumerated types? Why would you use them?

Java Collections

  • What are the core interfaces of the Collection framework?
  • How do Vector and HashTable relate to Collections?
  • Desribe typical use cases or examples of common uses for Map, Set, and Lists.
  • What method(s) should override for objects you plan to add to sets or maps?
  • How do you get an immutable collection?

Threading

If a developer works only in the heavily abstracted world of Spring/Hibernate/whatever, they may not have had to touch an actual Runnable since college. Still, its good to know about threading at least on a basic level.

  • What does the synchronized key word do? Where is it valid to use it (ie inside a method call, static block, etc)?
  • Explain the two ways to instantiate threads in Java.
  • What is “double-checked locking“? What design pattern is it typically associated with? What is wrong with it?
  • What is a daemon thread? How do you create one?
  • What method do you use to start a thread?

Servlets and JSPs

  • What are the steps to create a basic servlet?
  • Describe the lifecycle of a basic servlet - for instance, when are they created? What method is called from a typical HTTP request? What about requests and threads?
  • What does it mean to say that HTTP is stateless? How do servlets provide a possible solution to maintain state for web applications?
  • Are JSP’s thread safe?
  • What are Listeners? What is a typical use for a StartupListener?
  • What are filters and why would you use them?
  • Describe the four different scopes available with servlets?

Design Patterns

  • What are the three types of design patterns?
  • Can you talk about the history of design patterns?
  • Why use design patterns?
  • What is the role of composition (aggregation) in design patterns?
  • What design patterns do you use often and have the most experience with? Can you talk about a typical use case?
  • Can you provide a description of any of the following patterns? Strategy, State, or Template method?
  • What is Model View Controller, and why would you want to use it? What are some of the disadvantages of it?
  • What is inversion of control, and what does it give you?

Open Ended Questions

These questions are more to just stir discussion and debate and to get a feel for the candidate, rather then to get the “right” answer.

  • How would you build a software version of Monopoly?
  • Can you compare (insert dynamic language of choice here - Ruby/Python/Lisp/etc) to Java? When would you prefer one over the other?
  • What do you think is the most common cause of project failure in the software development business?
  • What do you think of the rise of open source over the last ten years? Where do you see open source in the future?
  • What does agile development mean to you?
  • What is your ideal development environment like? Both in terms of hardware and software, and location and surroundings?
  • What was the last technical book you read? Give me the Cliff Notes version of it.
  • What are some of your favorite resources beyond Google? This could include websites, magazines, technical authors, experts, favorite blogs, etc.
  • Do you have experience with Test Driven Development? If so, what do you think of it?
  • What will be the next language or development topic you want to learn about?

18 Comments

Posted by
Anjan Bacchu
22 July 2005 @ 8pm

Hi There,

“How do you get an immutable collection?” — haven’t gone through your list completely — but this one stumped me for the moment.

How many can give a positive answer to this question right off ?

BR,
~A


Posted by
Damien
23 July 2005 @ 1am

Good list!

My favorite is, “If a class were to implement the Serializable interface, how many methods would it have to implement?” :)


Posted by
Jim Halberg
25 July 2005 @ 12pm

I might throw in a couple questions that are not strictly Java but are going to need to be known to get the job done. That could vary quite a bit by position by likely could include things like:

* General SQL questions. What are the basic join types? How are each used?

* UML questions. Harder in phone interviews, but face-to-face it’s quite simple to make sure that they can draw up a class diagram as you describe some relationships and maybe draw up a little sequence diagram. You may also want them to read a use case/activity diagram/whatever that you’ve done beforehand.


[…] Panasonic Youth � Blog Archive � Java technical interview questions […]


Posted by
Panasonic Youth
31 August 2005 @ 8am

Java technical interview questions: part two - some answers

In July I posted a set of questions for a Java technical evaluation based on an eval I did for my employer. This is part two where I add some answers to those questions.
Interviewers: many of these questions are very open ended and this post only …


[…] In July I posted a set of questions for a Java technical evaluation based on an eval I did for my employer. This is part two where I add some answers to those questions. […]


Posted by
Stephen
2 October 2005 @ 3pm

I really like your website and i will be grald to no much.


Posted by
mahita
20 October 2005 @ 3am

hi..
good questions
.. I am a beginner to java and sooner o later i may get to know these concepts.. but it did allow me to learn new concepts and terms…
thank u


Posted by
chode mcchoden
18 November 2005 @ 1pm

How do you spell Java?


Posted by
vijaya bachina
18 November 2005 @ 3pm

good questions.. really helpfull


Posted by
Albin
7 January 2006 @ 5am

http://www.javacertificate.net

Here you can find out a lot of interview questions.


Posted by
Rob
13 January 2006 @ 3am

Anjan: use Collections.unmodifiable… methods.


Posted by
jaipal
5 May 2006 @ 6am

hey…
it’s really great to know the framing of questions.
i m a new learner and soon will be gud but these questions make me aware for some topics like multithreadin,overriding and overloading.

nice colleciton…


Posted by
rajaguru
7 September 2006 @ 4am

not so bad but not so good because i want answers


Posted by
Jackie
25 January 2007 @ 11am

I was browsing the web for possible technical interview questions and came across this site. Great list although I’m not sure I can answer most of them. Hmmmm…..better get to work so when I graduate I can land the job I want.
Thanks for the ideas.


Posted by
MeYou
10 February 2007 @ 10pm

This is an interesting site. I came across http://www.technical-interview.com which provides tips and questions with answers.


Posted by
Joe
10 April 2007 @ 6am

You guys are the typical computer geek stereotype, how often when doing your job do you have to define java terms? Do you losers sleep with Java books under your pillows? Anyone can memorize a bunch of terminology and fake their way through an interview, that doesn’t mean they can program worth a damn. Why don’t you all put down the techy books, turn off the computer and go outside once in a while, maybe you’ll even meet a girl


[…] […]