×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

some java interview questions, any ideas ?

1. Example how will you implement an effecient stack using a linked list?
Talk about memory management in java.

2.Example to compare an array versus a binary tree.

3.You have an application with 2 web servers and 1 database server. A client notices a degraded response time on your website. What could be the possible things that may be wrong?

4.Why did you use the specific application server for your current project? What does the application server provide? (For instance, I ever used Tomcat, websphere,iPlanet App server, but what is the keypoint of this question ?? )

Thanks in advance for any ideas !
Report

Replies, comments and Discussions:

  • 工作学习 / 专业技术讨论 / some java interview questions, any ideas ?
    1. Example how will you implement an effecient stack using a linked list?
    Talk about memory management in java.

    2.Example to compare an array versus a binary tree.

    3.You have an application with 2 web servers and 1 database server. A client notices a degraded response time on your website. What could be the possible things that may be wrong?

    4.Why did you use the specific application server for your current project? What does the application server provide? (For instance, I ever used Tomcat, websphere,iPlanet App server, but what is the keypoint of this question ?? )

    Thanks in advance for any ideas !
    • 顶一下,请教java guys, thx !
      • 照理做java的应该很多,怎么没人理呢?
    • 这是面试哪种职位的题目?初级还是中级?
      1。查一下API和众多的例子吧。
      2。同1。也是API的问题。
      3。天啊,这个问题太无耻了,你就画个图,把每个可能的情况都说说吧。
      4。第一问和第二问实际就是要你吹吹Application Server的好处嘛,就那几个要点嘛,应该本本EJB的书都有,
      还有,你说Tomcat是Application Server,千万不要给面试你的人听到,他会马上拿来候选名单,然后在你的名字上划个大红叉叉滴,:)
      • 面试时你不会就这么跟人家说"翻一API,里面都有"吧?Tomcat嘛,手懒,少写了几个,还应有jboss+eclipse.不过多谢你的答复
      • 至于这类职位是初级还是什么小儿科,看这里
        • 呵呵,这不过是一个中级职位,不过很奇怪,
          呵呵,这不过是一个中级职位,不过很奇怪,说明里没注明需要有EJB的经验,却特地注明要有不用EJB的5年经验。而问题里却要人去拍拍Application Server的好处,据然不要求EJB经验,那根本就没必要花钱买Application Server嘛?AMAZON招人的要求真是好奇怪。:)
      • Tomcat确实是ApplicationServer,但它只实现了web container,没有实现EJB Container。
        • come on, Tomcat is just a web server, nothing more, it is not a App Server at all, but JBOSS is a App Server using Tomcat to act as a its web server.
          • Apache HTTP Server is a web server which is supporting html, probably not JSP, Servlet and EJB or more;
            Apache Tomcat is supporting JSP, Servlet but not EJB; JBoss is supporting EJB, including all of the above. If they have to be classified, the first one is Web server, the other two belongs to App Server
    • Example how will you implement an effecient stack using a linked list?
      Trying the question, the algorithm to build a stack using linked list is at the end. hope it could help

      a linked list has:

      1. properties:
      a. Node start
      b. Node prev
      c. Node current
      2. methods:
      a. add_before_current(object x)
      b. current()
      c. remove()
      .....
      for example
      1. building the linked list
      add_before_current("1")
      add_before_current("2")
      add_before_current("3")
      //the linked list should be 3->2->1
      //the current is pointing to "3"
      2. obtaining the current node
      current()
      3. removing the current node
      remove() //obtain "3"
      remove() //obtain "2"
      remove() //obtain "1"
      //end

      remark: a stack is a data structure which is "First In Last Out"

      implementing the stack:
      1. properties:
      a. Node topofStack
      .....
      2. methods:
      a. push(object x){
      add_before_current(x);
      }
      b. pop(
      current();
      topofStack=remove();
      )
    • Example to compare an array versus a binary tree.
      In general: both are data structures

      a few differences are:
      1. array has to be fix size, however, binary tree can grow as many as possible
      2. array is easy to implement, but complex in binary tree
      3. regarding operations (insert, remove, findMin, findMax, search....) in an array and binary tree, usually, the worst-case complexity of the first one is n, but could be log(n) in a binary tree, unless a binary tree is a linked list

      third point is the key between the comparision

      hope it helps
    • You have an application with 2 web servers and 1 database server. A client notices a degraded response time on your website. What could be the possible things that may be wrong?
      one of problems may be: the client machine is abnormal caused by OS exception, viruses, low-speed internet connection and so on.

      I won't say it is servers' problem because only one client has a degraded reponse time. as a developer or administrator who will believe servers have a problem only if more evidences in a problem are collected.
    • 我靠。这样的问题要在面试中问道,我看大部分人都会栽。没有几个人在用Linked List and Binary Tree。第3和第4还可以凑合一下。看来要找工作,还得回家翻翻几乎要扔掉的基本教材。
    • blah, blah, blah...
      本文发表在 rolia.net 枫下论坛1)stack extend linkedlist {
      private list = new LinkedList();
      public void push(object o) {
      list.add(o);
      }

      public object pop() {
      return list.removeLast();
      }
      }
      If that was to ask memory management concept in general, that would be too many topic to cover.
      Such as the difference between implementing stack in linkedlist and array in terms of memory management. Seting heap size by
      xms/xmx/perm/maxperm, different type of jvm (classic/server/hotspot), use profiling tools to diagnose memory leak and/or inefficient memory usage,
      memory usage tricks, garbage collection timing, use of finalize method etc. That's too huge topic.

      2)not exactly sure what do you mean by compare a array, what about b-tree? compare what to what?
      3)cluster and load balancing http://e-docs.bea.com/wls/docs70/cluster/overview.html#1003768
      4)this is not a yes-no questions. I think they are just trying to see how much you know about all sorts of servers. Some popular
      ones are oc4j, websphere, weblogic. For exmaple, websphere is powerful to handle different version of classes use its confusing
      and powerful classloader and it has its own jvm. WEblogic use sun's jvm and doesn't have much choices for class loader. OC4j
      has some different settings for SOAP descriptor comparing with other servers. WEblogic is buggy in older version, it doesn't even
      fully support J2EE spec. Size of jsp page matters in some server. WEblogic use thread pooling which might be an issue for some apps in terms of memory management blah,
      blah, blah... It's all about how much practical experience you have. I am assuming you are looking for a development role.更多精彩文章及讨论,请光临枫下论坛 rolia.net