Java Programming and BI Technologies Quiz

Covers Java programming fundamentals including threads, collections, exceptions, and object-oriented programming, plus business intelligence tools like Informatica ETL and SAP BusinessObjects.

19 Questions Published

Questions

Question 1 Multiple Choice (Multiple Answers)

How the Web Intelligence reports can be created ?

  1. Stored Procedure
  2. Business View
  3. Universe
  4. XML
Question 2 Multiple Choice (Single Answer)

What is the application that is used to export Crystal reports to the Business Objects server ?

  1. Import Wizard
  2. Report Conversion Tool
  3. Publish Wizard
  4. Designer
Question 3 True/False

We can connect 2 Active Transformations to one Passive Transformation

  1. True
  2. False
Question 4 Multiple Choice (Single Answer)

What is the standard for ethernet ?

  1. 802.5
  2. 802.3
  3. 802.11
  4. 802.16
Question 5 Multiple Choice (Single Answer)

Given: 11. public class Person { 12. private String name, comment; 13. private int age; 14. public Person(String n, int a, String c) { 15. name = n; age = a; comment = c; 16. } 17. public boolean equals(Object o) { 18. if (! (o instanceof Person)) return false; 19, Person p = (Person)o; 20. return age == p.age && name.equals(p.name); 21. } 22. } What is the appropriate definition of the hashCode method in class Person?

  1. return super.hashCode();
  2. return name.hashCode() + age * 7;
  3. return name.hashCode() + comment.hashCode() / 2;
  4. return name.hashCode() + comment.hashCode() / 2 - age * 3;
Question 6 Multiple Choice (Single Answer)

Given: 34. HashMap props = new HashMap(); 35. props.put("key45", "some value"); 36. props.put("key12", "some other value"); 37. props.put("key39", "yet another value"); 38. Set s = props.keySet(); 39. // insert code here What, inserted at line 39, will sort the keys in the props HashMap?

  1. Arrays.sort(s);
  2. s = new TreeSet(s);
  3. Collections.sort(s);
  4. s = new SortedSet(s);
Question 7 Multiple Choice (Single Answer)

Given: 23. Object [] myObjects = { 24. new Integer(12), 25. new String("foo"), 26. new Integer(5), 27. new Boolean(true) 28. }; 29. Arrays.sort(myObjects); 30. for(int i=0; i<myObjects.length; i++) { 31. System.out.print(myObjects[i].toString()); 32. System.out.print(" "); 33. } What is the result?

  1. Compilation fails due to an error in line 23.
  2. Compilation fails due to an error in line 29.
  3. A ClassCastException occurs in line 29.
  4. A ClassCastException occurs in line 31.
  5. The value of all four objects prints in natural order.
Question 8 Multiple Choice (Single Answer)

Given: 1. public class Person { 2. private String name; 3. public Person(String name) { this.name = name; } 4. public boolean equals(Person p) { 5. return p.name.equals(this.name); 6. } 7. } Which statement is true?

  1. The equals method does NOT properly override the Object.equals method.
  2. Compilation fails because the private attribute p.name cannot be accessed in line 5.
  3. To work correctly with hash-based data structures, this class must also implement the hashCode method.
  4. When adding Person objects to a java.util.Set collection, the equals method in line 4 will prevent duplicates.
Question 9 Multiple Choice (Multiple Answers)

Given: 1. import java.util.*; 2. public class Old { 3. public static Object get0(List list) { 4. return list.get(0); 5. } 6. } Which three will compile successfully? (Choose three.)

  1. Object o = Old.get0(new LinkedList());
  2. Object o = Old.get0(new LinkedList<?>());
  3. String s = Old.get0(new LinkedList<String>());
  4. Object o = Old.get0(new LinkedList<Object>());
  5. String s = (String)Old.get0(new LinkedList<String>());
Question 10 Multiple Choice (Single Answer)

Given: 1. import java.util.*; 2. public class Example { 3. public static void main(String[] args) { 4. // insert code here 5. set.add(new Integer(2)); 6. set.add(new Integer(1)); 7. System.out.println(set); 8. } 9. } Which code, inserted at line 4, guarantees that this program will output [1, 2]?

  1. Set set = new TreeSet();
  2. Set set = new HashSet();
  3. Set set = new SortedSet();
  4. List set = new SortedList();
  5. Set set = new LinkedHashSet();
Question 11 Multiple Choice (Multiple Answers)

Given 10. class Foo { 11. static void alpha() { /* more code here / } 12. void beta() { / more code here */ } 13. } Which two statements are true? (Choose two.)

  1. Foo.beta() is a valid invocation of beta().
  2. Foo.alpha() is a valid invocation of alpha().
  3. Method beta() can directly call method alpha().
  4. Method alpha() can directly call method beta().
Question 12 Multiple Choice (Single Answer)

Given: 11. public static void parse(String str) { 12. try { 13. float f = Float.parseFloat(str); 14. } catch (NumberFormatException nfe) { 15. f = 0; 16. } finally { 17. System.out.println(f); 18. } 19. } 20. public static void main(String[] args) { 21. parse("invalid"); 22. } What is the result?

  1. 0.0
  2. Compilation fails.
  3. A ParseException is thrown by the parse method at runtime.
  4. A NumberFormatException is thrown by the parse method at runtime.
Question 13 Multiple Choice (Single Answer)

Given: 10. class Line { 11. public static class Point {} 12. } 13. 14. class Triangle { 15. // insert code here 16. } Which code, inserted at line 15, creates an instance of the Point class defined in Line?

  1. Point p = new Point();
  2. Line.Point p = new Line.Point();
  3. The Point class cannot be instatiated at line 15.
  4. Line l = new Line() ; l.Point p = new l.Point();
Question 14 Multiple Choice (Multiple Answers)

Given: 10. package com.sun.scjp; 11. public class Geodetics { 12. public static final double DIAMETER = 12756.32; // kilometers 13. } Which two correctly access the DIAMETER member of the Geodetics class? (Choose two.)

  1. import com.sun.scjp.Geodetics;
  2. import static com.sun.scjp.Geodetics;
  3. import static com.sun.scjp.Geodetics.*;
  4. package com.sun.scjp;
Question 15 Multiple Choice (Multiple Answers)

Given: 10. public class Bar { 11. static void foo( int... x ) { 12. // insert code here 13. } 14. } Which two code fragments, inserted independently at line 12, will allow the class to compile? (Choose two.)

  1. foreach( x ) System.out.println(z);
  2. for( int z : x ) System.out.println(z);
  3. while( x.hasNext() ) System.out.println( x.next() );
  4. for( int i=0; i< x.length; i++ ) System.out.println(x[i]);
Question 16 Multiple Choice (Single Answer)

Given: 1. public class Plant { 2. private String name; 3. public Plant(String name) { this.name = name; } 4. public String getName() { return name; } 5. } 1. public class Tree extends Plant { 2. public void growFruit() { } 3. public void dropLeaves() { } 4. } Which statement is true?

  1. The code will compile without changes.
  2. The code will compile if public Tree() { Plant(); } is added to the Tree class.
  3. The code will compile if public Plant() { Tree(); } is added to the Plant class.
  4. The code will compile if public Plant() { this("fern"); } is added to the Plant class
  5. The code will compile if public Plant() { Plant("fern"); } is added to the Plant class.
Question 17 Multiple Choice (Multiple Answers)

Given: 1. public class Threads2 implements Runnable { 2. 3. public void run() { 4. System.out.println("run."); 5. throw new RuntimeException("Problem"); 6. } 7. public static void main(String[] args) { 8. Thread t = new Thread(new Threads2()); 9. t.start(); 10. System.out.println("End of method."); 11. } 12. } Which two can be results? (Choose two.)

  1. java.lang.RuntimeException: Problem
  2. run.java.lang.RuntimeException: Problem
  3. End of method.java.lang.RuntimeException: Problem
  4. End of method.run.java.lang.RuntimeException: Problem
  5. run.java.lang.RuntimeException: ProblemEnd of method.
Question 18 Multiple Choice (Single Answer)

Given: 1. public class TestSeven extends Thread { 2. private static int x; 3. public synchronized void doThings() { 4. int current = x; 5. current++; 6. x = current; 7. } 8. public void run() { 9. doThings(); 10. } 11.} Which statement is true?

  1. Compilation fails.
  2. An exception is thrown at runtime
  3. Synchronizing the run() method would make the class thread-safe.
  4. The data in variable "x" are protected from concurrent access problems.
  5. Declaring the doThings() method as static would make the class thread-safe.
  6. Wrapping the statements within doThings() in a synchronized(new Object()) { } block would make the classthread-safe.
Question 19 Multiple Choice (Single Answer)

Given: 1. public class Threads3 implements Runnable { 2. public void run() { 3. System.out.print("running"); 4. } 5. public static void main(String[] args) { 6. Thread t = new Thread(new Threads3()); 7. t.run(); 8. t.run(); 9. t.start(); 10. } 11. } What is the result?

  1. Compilation fails.
  2. An exception is thrown at runtime.
  3. The code executes and prints "running".
  4. The code executes and prints "runningrunning".
  5. The code executes and prints "runningrunningrunning".