本文发表在 rolia.net 枫下论坛Since this year, I have been working for a Healthcare company as a Principal Software Engineer. My next task is architect an Enterprise Master Person Index project. Interviewing job candidates is one of my routine works. For the visa reason, we cannot hire people from outside the USA, so please do not ask me to help get a job if you cannot work legally in the USA. We don't even do T1 visa.
I would like to share a list of questions I used in the interview. Most questions do not have standard answers. My expectation is that a job candidate can discuss these questions with me and give me a positive impression. So far, only two job candidates make me happy. (They made other people happy, too.)
----------------------------------------------------------------------------------
Java Interview Questions for Software Engineer positions
1) If we need to sort a list of Objects of type com.quadramed.xxx.UsefulEntry, how would you like to implement this requirement in Java?
2) If one programmer is asked to implement a JDBC connection pool, he extends java.util.Vector class to hold
all the DB connections.
public class ConnectionPool extends Vector{
//details
}
A Java architect is unhappy with this approach.
If you were this programmer, how would you like to defend this implementation? If you don't like this either and do not want to defend it,
can you suggest some alternative implementations?
3) A programmer writes a String template, which contains a lot of instances of a very special symbol:XX2000$$. Then, we need to
replace this symbol by more meaningful word such as "Java", "index", and "there". How would you like to use Java API to do such
substitutions?
4) What kind of the problems do you expect from the following three lines of Java Servlet code?
String str = request.getParameter("age");
System.out.println(str.toUpperCase());
int age = Integer.parseInt(str);
5) What kind of problems do you expect from the following code widget?
Map map = getSomeResults();
Set keys = map.keySet();
Iterator it = keys.iterator();
while(it.hasNext()) {
Object key = it.next();
map.remove(key);
}
6) You are asked to review and re-factor a junior programmer's code. How would you like to
handle the following code?
Properties result = new Properties();
if(person != null) {
if(person.getLastName().equals("") {
result.put("Last_Name", person.getLastName());
}
}
16) One of my friends said Java is only useful in server programming. He said AWT package is useless.
How do you think?
17) Writing Javascript function to handle events such as click, mouseDown. When we you have to return
a Boolean? In the Javascript, how do you check if an var is defined or not? What's a ModalDialog?
After a web is downloaded into the server, can I change the contents of page by clicking a button?
18) If you are asked to public API, how would you like to change the following code?
public ArrayList getPatientsByFacility(String facilityName){
//
}
public HashTable getAllDocuments( ) {
//
}
19) What will the effects of executing the following code?
Button b = new Button();
Patient p = new Patient();
System.out.println(b.equals(p)? "Yes": "No")?
Can you explain why?
20) Often, programmers let their business object class such as person implement Serializable interface.
Can you comment on this approach?
21) What is Unit test? Who did you do it?
7) If you are asked to choose softwares for a project and you have chosen an Application server such as WebLogic
insted of Tomcat, what kind of considerations have led you to your decision?
8) To creat a Web application, we can use either Servlet, or JSP, or both. One junior programmer said he would
like to build a whole application using pure JSP stuff, how would you like to advise him that we had better use both
Servlet and JSP?
9) To describe a person using XML, I offer you the following two approaches
a) <person>
<first_name> John </first_name>
<last_name> Hacker </last_name>
<gendar> M </gender>
<age> 34 </age>
</person>
b) <person first_name="John" last_name="Hacker" gender='M" age="34"/>
which kind of XML authoring would you like to take?
10) The following question is related to DB schema. If we are asked to save a person's bio data into the DB,
there might be two ways to do it
a)
sid first_name last_name gender age smoke_yes_no
123 John Smith M 23
234 Mary Hill F 45 Y
222 Boy Silly M 98
b)
sid person_id attribute value
1 123 first_name John
2 123 last_name Smith
3 123 gendre M
4 123 age 23
5 234 first_name Mary
6 234 last_name Hill
7 234 gendre F
8 234 age 45
9 234 smoke_yes_no Y
What's the advantage and disadvantage in two different scenarios? For a programmer's expereices and \
perspective, which apprach do you prefer?
11) If you are initiating the architecture for a project and one of your team members suggest using ORACLE
database with some Stored Procedure, do you have any hesitation in taking in this suggestion?
12) Can you talk about the life cycle of a Servlet? Or Can you talk about the life cycle of stateless session bean?
13) If you are hired as a Principal Software Engineer and assigned the task to write some core libraries
and frameworks for the company. which one do you think more challenging?
14) Can you give us some example implementations of
a) Template Method pattern;
b) Singleton pattern;
c) Adaptor pattern;
d) Immutable pattern?
15) If you are asked to load the contents of a table and cache it in the Servlet container for all the user to share,
how would you like to implement this?
6) Consider the following case. Mary Smith is a family member of the Smith family by birth. After she grew up,
she married to Mark Wiener and became a family member of the Wiener family. Their marriage lasted for 3 years.
After that, Mary was married to James Clark and becomes a family member of the Clark family. We don't count Mary as
a family member of the Wiener family as she devorced her first husband. But, Mary is a family member of the
Smith family for-ever, because she is by birth. Now if you are asked to write a Java progarmm
to implement this family member scenario, how would you like to do it? If you are asked to get some hints from the
Gang of Four book, which pattern would you like to consider first?更多精彩文章及讨论,请光临枫下论坛 rolia.net
I would like to share a list of questions I used in the interview. Most questions do not have standard answers. My expectation is that a job candidate can discuss these questions with me and give me a positive impression. So far, only two job candidates make me happy. (They made other people happy, too.)
----------------------------------------------------------------------------------
Java Interview Questions for Software Engineer positions
1) If we need to sort a list of Objects of type com.quadramed.xxx.UsefulEntry, how would you like to implement this requirement in Java?
2) If one programmer is asked to implement a JDBC connection pool, he extends java.util.Vector class to hold
all the DB connections.
public class ConnectionPool extends Vector{
//details
}
A Java architect is unhappy with this approach.
If you were this programmer, how would you like to defend this implementation? If you don't like this either and do not want to defend it,
can you suggest some alternative implementations?
3) A programmer writes a String template, which contains a lot of instances of a very special symbol:XX2000$$. Then, we need to
replace this symbol by more meaningful word such as "Java", "index", and "there". How would you like to use Java API to do such
substitutions?
4) What kind of the problems do you expect from the following three lines of Java Servlet code?
String str = request.getParameter("age");
System.out.println(str.toUpperCase());
int age = Integer.parseInt(str);
5) What kind of problems do you expect from the following code widget?
Map map = getSomeResults();
Set keys = map.keySet();
Iterator it = keys.iterator();
while(it.hasNext()) {
Object key = it.next();
map.remove(key);
}
6) You are asked to review and re-factor a junior programmer's code. How would you like to
handle the following code?
Properties result = new Properties();
if(person != null) {
if(person.getLastName().equals("") {
result.put("Last_Name", person.getLastName());
}
}
16) One of my friends said Java is only useful in server programming. He said AWT package is useless.
How do you think?
17) Writing Javascript function to handle events such as click, mouseDown. When we you have to return
a Boolean? In the Javascript, how do you check if an var is defined or not? What's a ModalDialog?
After a web is downloaded into the server, can I change the contents of page by clicking a button?
18) If you are asked to public API, how would you like to change the following code?
public ArrayList getPatientsByFacility(String facilityName){
//
}
public HashTable getAllDocuments( ) {
//
}
19) What will the effects of executing the following code?
Button b = new Button();
Patient p = new Patient();
System.out.println(b.equals(p)? "Yes": "No")?
Can you explain why?
20) Often, programmers let their business object class such as person implement Serializable interface.
Can you comment on this approach?
21) What is Unit test? Who did you do it?
7) If you are asked to choose softwares for a project and you have chosen an Application server such as WebLogic
insted of Tomcat, what kind of considerations have led you to your decision?
8) To creat a Web application, we can use either Servlet, or JSP, or both. One junior programmer said he would
like to build a whole application using pure JSP stuff, how would you like to advise him that we had better use both
Servlet and JSP?
9) To describe a person using XML, I offer you the following two approaches
a) <person>
<first_name> John </first_name>
<last_name> Hacker </last_name>
<gendar> M </gender>
<age> 34 </age>
</person>
b) <person first_name="John" last_name="Hacker" gender='M" age="34"/>
which kind of XML authoring would you like to take?
10) The following question is related to DB schema. If we are asked to save a person's bio data into the DB,
there might be two ways to do it
a)
sid first_name last_name gender age smoke_yes_no
123 John Smith M 23
234 Mary Hill F 45 Y
222 Boy Silly M 98
b)
sid person_id attribute value
1 123 first_name John
2 123 last_name Smith
3 123 gendre M
4 123 age 23
5 234 first_name Mary
6 234 last_name Hill
7 234 gendre F
8 234 age 45
9 234 smoke_yes_no Y
What's the advantage and disadvantage in two different scenarios? For a programmer's expereices and \
perspective, which apprach do you prefer?
11) If you are initiating the architecture for a project and one of your team members suggest using ORACLE
database with some Stored Procedure, do you have any hesitation in taking in this suggestion?
12) Can you talk about the life cycle of a Servlet? Or Can you talk about the life cycle of stateless session bean?
13) If you are hired as a Principal Software Engineer and assigned the task to write some core libraries
and frameworks for the company. which one do you think more challenging?
14) Can you give us some example implementations of
a) Template Method pattern;
b) Singleton pattern;
c) Adaptor pattern;
d) Immutable pattern?
15) If you are asked to load the contents of a table and cache it in the Servlet container for all the user to share,
how would you like to implement this?
6) Consider the following case. Mary Smith is a family member of the Smith family by birth. After she grew up,
she married to Mark Wiener and became a family member of the Wiener family. Their marriage lasted for 3 years.
After that, Mary was married to James Clark and becomes a family member of the Clark family. We don't count Mary as
a family member of the Wiener family as she devorced her first husband. But, Mary is a family member of the
Smith family for-ever, because she is by birth. Now if you are asked to write a Java progarmm
to implement this family member scenario, how would you like to do it? If you are asked to get some hints from the
Gang of Four book, which pattern would you like to consider first?更多精彩文章及讨论,请光临枫下论坛 rolia.net