Question d’entretien chez PayPal

1. Verbal test: a) What's the difference between StringBuffer and StringBuilder b) What's the diff between a linkedList and arrayList? When would you use each? 2. Language Quiz -Strings a="hello"; b="hello"; c=new String("hello"); d=c; e=new String("hello"); Tell me the result a) a==b b)a.equals(b) c)a==c d)c==d e)c.equals d f) c==e g)c.equals e 3. Code time!!! program a method that returns an inOrder Arraylist of the nodes in a tree public ArrayList<Integer> inOrder(Node root);

Réponse à la question d'entretien

Utilisateur anonyme

30 août 2014

1a) One is synchronized and the other one is not. Hence one is quicker than the other due to this fact. 1b) You should know this one. 2. a-true, string literals always equal, try it. b-true c-false d-true e-true f-false g-true 3. public ArrayList InOrder(Node root){ ArrayListresult=new ArrayList(); if(root=!=null){ result.addAll(InOrder(root.left())); result.add(root.value()); result.addAll(InOrder(root.right())); } return result; }

3