Java Interview Questions for Java Programmers
Interview Questions
General (tell them you want 10 sec. answers) |
|
| Re-using the implementation of one class to make a new class. Also might mention subclassing, ‘is-a relationships’, parent/child relationships. |
| Allowing the same code to be used with different types, resulting in more general and abstract implementations. |
| Information hiding of design details. Protecting data and private methods, and only exposing the attributes or operations that are necessary. |
|
|
Java (tell them you want 10 sec. answers) |
|
| boolean, char, byte, short, int, long, float, double |
| Makes an attribute or method a ‘class’ attribute or method. There exists exactly one incarnation of the field, no matter how many instances (possibly zero) of the class may eventually be created |
| Private – The member is accessible only within the class that defines it. Default (aka package) – The member is accessible only within the package in which it is defined. Protected – The member is accessible only within the package in which it is defined and within subclasses. Public – The member is accessible anywhere its class is.
|
| Only checked exceptions need to be explicitly ‘caught’. Unchecked exceptions are subclasses of Error, while checked exceptions are subclasses of Exception. |
| Anything except visible forehead sweat. Single vs. Multiple inheritance; interfaces are entirely abstract; abstract classes provide partial implementation; etc. |
| Call the java.util.Collections.sort() method, passing in the collection you need sorted, and optionally, a comparator |
|
|
Database (tell them you want 30 sec. answers) |
|
| Database normalization is the process of removing redundant data to improve integrity, scalability, and storage efficiency. Normalization tends to trade off with performance, so it's a question of balancing data redundancy and integrity against performance. Normalize less if you want simple queries, archival quality records, online reporting, or good performance.
Bonus points for definitions of different normal forms: 1NF: tables have no internally redundant columns, and are rows are uniquely identifiable by a unique column or columns 2NF: every non-key column is dependent on the primary key 3NF/BCNF: every non-key column is only dependent on the primary key, and no other columns 4NF: No multi-value dependencies
|
| To speed up queries on a non-key column. If a table is large enough that a sequential scan takes too long to filter by some column(s), create an index.
|
| To simplify queries. Maybe also to present a part of a table with different names or permissions.
|
| An inner join returns only records which satisfy the join condition. An outer join returns all records from one table, and matching records from the other where the join condition is satisfied. A full outer join returns all records from both tables, matching where the join condition is satisfied. Bonus points for mentioning the difference between left/right, or cross joins/cartesian products.
|
|
|
Front End (tell them you want 30 sec. answers) |
|
| Use javascript or vbscript to modify the DOM directly. (Bonus for mentioning loading the data in a background iframe) |
| A JSP is translated into a servlet by a precompiler that converts non-java text into write or print statements. Other than that THEY ARE THE SAME THING. |
| A browser action (click or Enter) SUBMITs an html form. The servlet accesses the data by calling getParameter on the Request object. |
|
|
J2EE (tell them you want 30 sec. answers) |
|
| A stateless session bean does not maintain a conversational state with the client it is servicing. A stateful session bean is dedicated to the one client it is servicing for the life of the bean instance, so data about the client can be cached between method invocations.
|
| Container Managed Persistence means all persistence is handled by the EJB container. A developer doesn’t have to worry about writing persistence code that is specific to the database because it is automatically generated by the EJB container. In Bean Managed Persistence developers write all of the code to manage persistence.
|
| Home Interface –Home interfaces are used to create, locate, and remove objects from EJB containers (and sometimes databases). Local Interface – Used when calling the business methods by clients that reside in the same JVM. Parameters are passed by reference. Remote Interface – Used when calling the business methods by clients that reside in another JVM. Parameters are passed by value.
|
|
|
Subjective |
|
| Just looking for some answer that says they’ll get along here. Anything except “I won’t start coding until the BAs give me good UML diagrams” |
| The key is asking for more information. Anything except “just start coding”. |
| Looking for anything that sounds compatible with the status quo here. Nice to have, good tool for developers to use to communicate, etc. |
| Google. Books. Anything that demonstrates that they can learn new things. |
| Must like agile. |
| Must be ok with pairing and think it at least ‘has its place.’ |
|
|
Grand Total: |
|
And the scoresheet I use for each candidate:
Interview Questions
Name_________________________________
General (tell them you want 10 sec. answers) | bad great |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
total |
|
Java (tell them you want 10 sec. answers) | 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
total |
|
Database (tell them you want 30 sec. answers) |
|
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
total |
|
Front End (tell them you want 30 sec. answers) |
|
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
total |
|
J2EE (tell them you want 30 sec. answers) |
|
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
total |
|
Subjective |
|
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
| 0 1 2 3 4 5 |
total |
|
Grand Total: |
|
No comments:
Post a Comment