×

Loading...

it is really a long list

本文发表在 rolia.net 枫下论坛1. Either have the usefulentry implement comparable interface or generate a independent comparator class and use arrays.sort to sort the list of object.
2.It is not a good idea to extend vector here. Naturally, the connection pool should hide the truth that you are using vector or hashtable or any other array-alike method to hold the connection. However, if you extend the vector, anybody would be tempted to use the vector.add method to add a connection, which is probably the intension of the creator of connection pool.
3.java.lang.string.replaceAll. However, this method is only available on jdk1.4 or later. Not in jdk1.2
4.It doesn't check the null value so the second statment is probably going to throw nullpointerexception. The third statement should check the unparsable integeter exception.
5.it.remove should be called instead the map.remove
6.private static string LAST_NAME="last_name"
if (person !=null) && ("".compareTo(person.getLastName)==0)
new properties().put(LAST_NAME, person.getLastName();
16. AWT can be used to achieve complex GUI. But not many people use it though
17.End of function after the mousedown event is triggered.
if (window.variable) should be doing the check.
A modaldialog is actually a popup dialog when user can't go to other windows or control before finishing the function in dialog box. The alert, prompt and confirm are 3 examples.
Don't understand the last question
18. The two methods need a header tells the parameter, return value and any possible exception.
19. It doesn't make sense. The test only return true when b and p refer to same object, which wouldn't never happen in this case.
20. Perhaps they want the business object be transfer between different tiers, which resides on different machine.
21. unit test is normally used to test each class's public method and see if the class can turn out the expected returns. use junit package. Create a testcase, call assert something methods. Optionally, create testsute, add all testcase into it. Use junit built in statndalone application to run through all test cases.
7.The tomcat doesn't have datasource(?) Tomcat is not scalable. Tomcat doesn't have ejb container unless combound with jboss. Tomcat performance is bad.
8.To have better maintainability. Because GUI people wouldn't understand java code that messup with html tags.
9. In this case, b is enough. Because those elements actually won't be extended.
10.a is much better. The column is meaningful. It can save storage space. Possible index can be created while the solution b has different variable type. If there is a relatively predefined reference data and you are really in flavour of highly normalization. Choose b. But not in this case, since the table is frequently updated.
11. The business logic is built in database side if using sp. That makes maintainence difficult. The logic is bound into one plateform. The sp should only be used in some special case, such as for better performance.
12. that's too much.
13.framework. Just imaging...
14.that really takes time
15.use singleton. Have it initialized when servlet startup
6.state更多精彩文章及讨论,请光临枫下论坛 rolia.net
Sign in and Reply Report

Replies, comments and Discussions:

  • 工作学习 / IT杂谈 / A few Software Engineer interview questions
    本文发表在 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
    • programer 就是 programmer, not to say 软件工程师, 前几天那些搞强电的DX都认为 IT 和"工程"不搭边.
      • A title is just a title. Different companies have different titles. Some of my consultant firends have no titles but they make a big money.
    • People can answer these questions may not necessary a good developer, I don't see how these question would refelct somebody's hands on experience.
      • A few year's experiences are necessary. After that, we pay special attention to candidate's knowledge and communication skills.
        We do team work. If a programmer have 10 years experiences but cannot expalin why and how, we cannot take him. Some of my colleagues ask the candidate very basic questions like: What is outer join in Oracle? what does the key word "protected" mean in Java? If the candidate cannot staight these kind of questions, the interviewer immediately rushes to a negative conclusion.

        There are a lot of experienced programmer on the market. We really do not worry about their experiences. For me, I even have no interets to listen to the job candidate boast how they led a project, how they designed an application, how they helped junior programmers. All of those experience things are just good to fool non-techincal guys.
        • I think most questions are excellent. You can add some questions on java IDE for candidate to demostrate their hands on skill.
      • If all these questions can be answered properly by an individual during an interview, it's reasonable to believe he/she is a good developer with at least some working experiences.
        • The right answer is not very important. The point is to see if and how the candidate these questions.
          本文发表在 rolia.net 枫下论坛One candidate asked me several times to explain some questions more clearly. I found he was very confident as he asked me to do so. In other words, it seems he is not doing an interview and he is just discussing some questions with me.

          Another candidate asked me to allow him to do some quess work on that question about interator and map. Of course, I was happy to allow him to do so. In the real project, we often do some wild quess work when we get into trouble.

          One Chinese guy did not know (or forgot ) how to say regular expression in English. I told him it is "regular expression".

          The terrible thing is some candidates tried to cook up some answer to respond me. That's not good. The positive approach is to ask the interviewer to explain more and give some hints and eventually find a way out. If a candidate does not know something such as EJB, it is not a shame.

          One job candidate repeatedly told me she is a Ph. D in physics. It seems to me that a Ph. D in physics is a good programmer by birth.更多精彩文章及讨论,请光临枫下论坛 rolia.net
    • it is really a long list
      本文发表在 rolia.net 枫下论坛1. Either have the usefulentry implement comparable interface or generate a independent comparator class and use arrays.sort to sort the list of object.
      2.It is not a good idea to extend vector here. Naturally, the connection pool should hide the truth that you are using vector or hashtable or any other array-alike method to hold the connection. However, if you extend the vector, anybody would be tempted to use the vector.add method to add a connection, which is probably the intension of the creator of connection pool.
      3.java.lang.string.replaceAll. However, this method is only available on jdk1.4 or later. Not in jdk1.2
      4.It doesn't check the null value so the second statment is probably going to throw nullpointerexception. The third statement should check the unparsable integeter exception.
      5.it.remove should be called instead the map.remove
      6.private static string LAST_NAME="last_name"
      if (person !=null) && ("".compareTo(person.getLastName)==0)
      new properties().put(LAST_NAME, person.getLastName();
      16. AWT can be used to achieve complex GUI. But not many people use it though
      17.End of function after the mousedown event is triggered.
      if (window.variable) should be doing the check.
      A modaldialog is actually a popup dialog when user can't go to other windows or control before finishing the function in dialog box. The alert, prompt and confirm are 3 examples.
      Don't understand the last question
      18. The two methods need a header tells the parameter, return value and any possible exception.
      19. It doesn't make sense. The test only return true when b and p refer to same object, which wouldn't never happen in this case.
      20. Perhaps they want the business object be transfer between different tiers, which resides on different machine.
      21. unit test is normally used to test each class's public method and see if the class can turn out the expected returns. use junit package. Create a testcase, call assert something methods. Optionally, create testsute, add all testcase into it. Use junit built in statndalone application to run through all test cases.
      7.The tomcat doesn't have datasource(?) Tomcat is not scalable. Tomcat doesn't have ejb container unless combound with jboss. Tomcat performance is bad.
      8.To have better maintainability. Because GUI people wouldn't understand java code that messup with html tags.
      9. In this case, b is enough. Because those elements actually won't be extended.
      10.a is much better. The column is meaningful. It can save storage space. Possible index can be created while the solution b has different variable type. If there is a relatively predefined reference data and you are really in flavour of highly normalization. Choose b. But not in this case, since the table is frequently updated.
      11. The business logic is built in database side if using sp. That makes maintainence difficult. The logic is bound into one plateform. The sp should only be used in some special case, such as for better performance.
      12. that's too much.
      13.framework. Just imaging...
      14.that really takes time
      15.use singleton. Have it initialized when servlet startup
      6.state更多精彩文章及讨论,请光临枫下论坛 rolia.net
      • If you come to seek a senior position in our company, it is very hopeful provided you don't stare at the interviewer. :-):-). You are a knowledgeable programmer and do not completely live on your experiences.
        Usually, job candidates may have difficulties in understanding the questions. In face-to-face interviews, we need give them some hints. For instance, if a candidate does not know Regular expression package in Java, I would like to ask him about how to do String replacements in Javacript. Or if he/she has Perl experiences, I would be happy to listen (I do not know Perl).

        For that API publish question, your answer is diffrent from what I expected. It does not mean you are wrong. I may think your answers are some good points I have not thought of. I would like to encourage the candidate to think if we use more general return type, ask what kind of supr interface Hashtabe and ArrayList extend. If he/she can get to Map and List after several round of questions and answers, I still think he is fine because we just co-workers who are good at communications.
        • Thank you. Your post is always informative and those are some really good questions. I was taking them as challenges. :-) I didn't think about the API publish question the way you are thinking. But now I think you got
          a very good reason to ask that question. Yes, I agree that should return a List or Map instead of concrete Hashmap and hashtable. I learned. BTW, I like the way you tell your experience.
        • I can answer and explain most of the questions, but I have no chance to do that. Who would like to give me a interview?
          • If you are a US citizen or US permanent resident, please send me your resume. After I look at your resume, I may contact you and recommend to our hiring manager.
            However, our company do not pay the relocation expenses. Sorry, this is the market.
            • I am Canada permanent resident only. :( anyway, thank you for your message.
    • Your question are excellent. Though I consider myself a very good developer, I can only provide reasonable answers to half of the questions. But I'm sure give me several hours to do research I will find all the answers.
      • I did not expect the candidate knows all the answers. They are used to 1) test how much the candidate knows and 2) how the candidate respond when he/she has no ideas.
        Take that XML question as an example. 50% of candidates say the first scenario is better. I asked them why. Most of them say that XML books use nested elements instead of attritutes. Some say the first one is more readable. At this stage, I would ask the candidate how the DOM and SAX work. I drag the candidate to the direction of event listener and performance consideration. Smart guys would reach to the conclusion that using attributes will get faster pasrsing if using SAX parser. Well, where is the stupid guy? There are stupid guys. One stupid guy tried to convince me that there is no big deal in choosing SAX parser against DOM parser. His behavior failed himself. In a job interview, one should try to influence the interviewer positively. Even you don't know something, you still need try to impress the interviewer so that he/she thinks you are smart, not stubborn.
    • It's a good list, but a bit over-emphsis on experience in my opinion. I would like to add-on more OO instead of language, and ... shorten it.
      本文发表在 rolia.net 枫下论坛A lot questions need real experience(hands-on) in those specific area in order to provide a in-deepth answer, although not too difficult. I just feel the questions are too much tie to java language instead of basic OO concepts. I would like to add some OO questions prepared for senior programmers. Does not matter if they even don't give them an answer.
      e.g. Explain the difference between Abstract Class and Interface, when and why you choose one instead of another.
      e.g. A saw many programmers like to use Class.forName(). What do you think about it?
      e.g Can you draw a UML digram for the Role-base access control system. (access control is used in very project so to be a good sample. I want to see how complicated can he imagine. Maybe too specific?)
      ... and a bit of production experience?
      e.g. Can you explain how to do a proper performance/load/stress testing?

      I am also very concern about her/his experience in process and methodologies. The cadidate's fit into your current org's methodology is much more important than a bit trade-off in skills. XPers are very different animals from normal RUP persons. So I would like to ask them:
      e.g. What do you think about XP?
      e.g. What do you think about re-fectoring?
      Those questions are easy to figure out whether the person has some real experience in e.g. refectoring or just read them from a book.

      Finally, I would like to shorten the list to less than 10 questions. To me, most of questions are better being discussed in conversation instead of written in paper. You know, we programmers, hardly write code in paper. It's very un-comfortable to answer programming questions in paper. e.g. for the life cycle question, most probably I will just write a few states.
      I would like to put only those need a bit time to think or better to use a paper to explain,e.g. drawing.

      As you guys mentioned, usually it's not difficult to find a person matches your skill level. 10 questions are more than enough to see that. So the more importand is the person's personality. By exercise those questions within a conversation, you can know a lot more. The way he approaches a problem, his manners, honest or whatever. That's why most of successful interview in based on the feeling you give to the interviewer rather than your static skill set.

      Just a bit thought. I remember there is a good article in theserverside on "how to interview a programmer"更多精彩文章及讨论,请光临枫下论坛 rolia.net
      • Thank you for your comments. We do ask questions about re-factoring, XP and open sources, but few guys can handle them elegantly.
        In particular, about 50% of programmers do not really know what re-factoring is.
        • I would say most developers do not like XP either!It is only good in theory, but hard to practice.
          • by hard to practise, I guess you meant the management team is not up for it. It has many good practice. Like refactoring, unit-testing, domain expert involove, frequent release, requirement change process and so on
            • Good comment, but many of those ideas are not new.