Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Geek Time Janvier 2017 : Quiz Java

253 views

Published on

Quiz Java
Par Khaled HALLEB, Consultant OLBATI
Au Geek Time de Janvier 2017

Published in: Software
  • Be the first to comment

Geek Time Janvier 2017 : Quiz Java

  1. 1. Quiz Java Geek Time - Janvier 2017 Khaled HALLEB Consultant - OLBATI
  2. 2. OLBATI © 2016 - Geek Time November 2016 2 Question 1 TreeMap class is used to implement which collection interface. Select the one correct answer A. Set B. SortedSet C. List D. Tree E. SortedMap
  3. 3. OLBATI © 2016 - Geek Time November 2016 3 Question 2 Q2. How can you force garbage collection of an object? A. Garbage collection cannot be forced. B. Call System.gc(). C. Call System.gc() passing in a reference to the object to be garbage collected. D. Call Runtime.gc(). E. Set all references to the object to new values(null, for example).
  4. 4. OLBATI © 2016 - Geek Time November 2016 4 Question 3 3. Given the following code: public class Example { public static void main(String args[]) { Date d1 = new Date (99, 11, 31); Date d2 = new Date (99, 11, 31); method(d1, d2); System.out.println("d1 is " + d1 + "nd2 is " + d2); } public static void method(Date d1, Date d2) { d2.setYear (100); d1 = d2; }} Which one or more of the following correctly describe the behavior when this program is compiled and run? a) compilation is successful and the output is: d1 is Fri December 31 00:00:00 GMT 1999 d2 is Fri December 31 00:00:00 GMT 1999 b) compilation is successful and the output is: d1 is Fri December 31 00:00:00 GMT 1999 d2 is Sun December 31 00:00:00 GMT 2000 c) compilation is successful and the output is: d1 is Sun December 31 00:00:00 GMT 2000 d2 is Sun December 31 00:00:00 GMT 2000 d) the assignment 'd1 = d2' is rejected by the compiler because the Date class cannot overload the operator '='. e) the expression (d1 is " + d1 + "nd2 is " + d2) is rejected by the compiler because the Date class cannot overload the operator '+'.
  5. 5. OLBATI © 2016 - Geek Time November 2016 5 Réponse 1 TreeMap class is used to implement which collection interface. Select the one correct answer Correct Answer: E
  6. 6. OLBATI © 2016 - Geek Time November 2016 6 Réponse 2 Q2. How can you force garbage collection of an object? Correct Answer: A
  7. 7. OLBATI © 2016 - Geek Time November 2016 7 Réponse 3 3. Given the following code: public class Example { public static void main(String args[]) { Date d1 = new Date (99, 11, 31); Date d2 = new Date (99, 11, 31); method(d1, d2); System.out.println("d1 is " + d1 + "nd2 is " + d2); } public static void method(Date d1, Date d2) { d2.setYear (100); d1 = d2; }} Correct Answer: B
  8. 8. OLBATI © 2016 - Geek Time November 2016 8 Thanks ! Any questions ? khaled.halleb@olbati.com

×