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.
Questions
How the Web Intelligence reports can be created ?
- Stored Procedure
- Business View
- Universe
- XML
What is the application that is used to export Crystal reports to the Business Objects server ?
- Import Wizard
- Report Conversion Tool
- Publish Wizard
- Designer
We can connect 2 Active Transformations to one Passive Transformation
- True
- False
What is the standard for ethernet ?
- 802.5
- 802.3
- 802.11
- 802.16
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?
- return super.hashCode();
- return name.hashCode() + age * 7;
- return name.hashCode() + comment.hashCode() / 2;
- return name.hashCode() + comment.hashCode() / 2 - age * 3;
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?
- Arrays.sort(s);
- s = new TreeSet(s);
- Collections.sort(s);
- s = new SortedSet(s);
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?
- Compilation fails due to an error in line 23.
- Compilation fails due to an error in line 29.
- A ClassCastException occurs in line 29.
- A ClassCastException occurs in line 31.
- The value of all four objects prints in natural order.
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?
- The equals method does NOT properly override the Object.equals method.
- Compilation fails because the private attribute p.name cannot be accessed in line 5.
- To work correctly with hash-based data structures, this class must also implement the hashCode method.
- When adding Person objects to a java.util.Set collection, the equals method in line 4 will prevent duplicates.
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.)
- Object o = Old.get0(new LinkedList());
- Object o = Old.get0(new LinkedList<?>());
- String s = Old.get0(new LinkedList<String>());
- Object o = Old.get0(new LinkedList<Object>());
- String s = (String)Old.get0(new LinkedList<String>());
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]?
- Set set = new TreeSet();
- Set set = new HashSet();
- Set set = new SortedSet();
- List set = new SortedList();
- Set set = new LinkedHashSet();
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.)
- Foo.beta() is a valid invocation of beta().
- Foo.alpha() is a valid invocation of alpha().
- Method beta() can directly call method alpha().
- Method alpha() can directly call method beta().
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?
- 0.0
- Compilation fails.
- A ParseException is thrown by the parse method at runtime.
- A NumberFormatException is thrown by the parse method at runtime.
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?
- Point p = new Point();
- Line.Point p = new Line.Point();
- The Point class cannot be instatiated at line 15.
- Line l = new Line() ; l.Point p = new l.Point();
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.)
- import com.sun.scjp.Geodetics;
- import static com.sun.scjp.Geodetics;
- import static com.sun.scjp.Geodetics.*;
- package com.sun.scjp;
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.)
- foreach( x ) System.out.println(z);
- for( int z : x ) System.out.println(z);
- while( x.hasNext() ) System.out.println( x.next() );
- for( int i=0; i< x.length; i++ ) System.out.println(x[i]);
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?
- The code will compile without changes.
- The code will compile if public Tree() { Plant(); } is added to the Tree class.
- The code will compile if public Plant() { Tree(); } is added to the Plant class.
- The code will compile if public Plant() { this("fern"); } is added to the Plant class
- The code will compile if public Plant() { Plant("fern"); } is added to the Plant class.
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.)
- java.lang.RuntimeException: Problem
- run.java.lang.RuntimeException: Problem
- End of method.java.lang.RuntimeException: Problem
- End of method.run.java.lang.RuntimeException: Problem
- run.java.lang.RuntimeException: ProblemEnd of method.
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?
- Compilation fails.
- An exception is thrown at runtime
- Synchronizing the run() method would make the class thread-safe.
- The data in variable "x" are protected from concurrent access problems.
- Declaring the doThings() method as static would make the class thread-safe.
- Wrapping the statements within doThings() in a synchronized(new Object()) { } block would make the classthread-safe.
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?
- Compilation fails.
- An exception is thrown at runtime.
- The code executes and prints "running".
- The code executes and prints "runningrunning".
- The code executes and prints "runningrunningrunning".