Java and ABAP Programming Fundamentals

Covers core Java programming concepts, Java EE technologies (EJB, JMS), and ABAP/SAP data dictionary features

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Given: class Alien { String invade(short ships) { return "a few"; } String invade(short... ships) { return "many"; } } class Defender { public static void main(String [] args) { System.out.println(new Alien().invade(7)); } } What is the result?

  1. many
  2. a few
  3. Compilation fails.
  4. An exception is thrown at runtim
Question 2 Multiple Choice (Single Answer)

Given: class Eggs { int doX(Long x, Long y) { return 1; } int doX(long... x) { return 2; } int doX(Integer x, Integer y) { return 3; } int doX(Number n, Number m) { return 4; } public static void main(String[] args) { new Eggs().go(); } void go () { short s = 7; System.out.print(doX(s,s) + " "); System.out.println(doX(7,7)); } } What is the result?

  1. 1 1
  2. 2 1
  3. 3 1
  4. 4 1
  5. 2 3
  6. 4 3
Question 3 Multiple Choice (Single Answer)

Given: class Mixer { Mixer() { } Mixer(Mixer m) { ml = m;} Mixer m1; public static void main(String[] args) { Mixer m2 = new Mixer(); Mixer m3 = new Mixer(m2); m3.go(); Mixer m4 = m3.m1; m4.go(); Mixer m5 = m2.m1; m5.go(); } void go() { System.out.print("hi "); } } What is the result?

  1. hi
  2. hi hi
  3. hi hi hi
  4. Compilation fails
  5. hi, followed by an exception
  6. hi hi, followed by an exception
Question 4 Multiple Choice (Single Answer)

Given: 1. class Zippy { 2. String[] x; 3. int[] a [] = {{1,2}, {l}}; 4. Object c = new long [4] ; 5. Object[] d = x; 6. } What is the result?

  1. Compilation succeeds.
  2. Compilation fails due only to an error on line 3.
  3. Compilation fails due only to an error on line 4.
  4. Compilation fails due only to an error on line 5.
  5. Compilation fails due only to an error on line 3 and 5.
  6. Compilation fails due only to an error on line 3,4 and 5.
Question 5 Multiple Choice (Single Answer)

Given: class Fizz { int x = 5; public static void main(String[] args) { final Fizz f1 = new Fizz(); Fizz f2 = new Fizz(); Fizz f3 = FizzSwitch(f1,f2); System.out.println((f1 == f3) + " " + (f1.x == f3.x)); } static Fizz FizzSwitch(Fizz x, Fizz y) { final Fizz z = x; z.x = 6; return z; } } What is the result?

  1. true true
  2. true false
  3. false true
  4. false false
  5. Compilation fails.
  6. An exception is thrown at runtime.
Question 6 Multiple Choice (Single Answer)

Given: class Knowing { static final long tooth = 343L; static long doIt(long tooth) { System.out.print(++tooth + " "); return ++tooth; } public static void main(String[] args) { System.out.print(tooth + " "); final long tooth = 340L; new Knowing().doIt(tooth); System.out.println(tooth); } } What is the result?

  1. 343 340 340
  2. 343 340 342
  3. 343 341 342
  4. 343 341 340
  5. 343 341 343
  6. Compilation fails.
Question 7 Multiple Choice (Multiple Answers)

Given: 1. class Convert { 2. public static void main(String[] args) { 3. Long xL = new Long(456L); 4. long x1 = Long.valueOf("123"); 5. Long x2 = Long.valueOf("123"); 6. long x3 = xL.longValue(); 7. Long x4 = xL.longValue(); 8. Long x5 = Long.parseLong("456"); 9. long x6 = Long.parseLong("123"); 10. } 11. } Which will compile using Java 5, but will NOT compile using Java 1.4? (Choose all that apply.)

  1. Line 4
  2. Line 5
  3. Line 6
  4. Line 7
  5. Line 8
  6. Line 9
Question 8 Multiple Choice (Single Answer)

Given: 1. class Eco { 2. public static void main(String[] args) { 3. Eco e1 = new Eco(); 4. Eco e2 = new Eco(); 5. Eco e3 = new Eco(); 6. e3.e = e2; 7. e1.e = e3; 8. e2 = null; 9. e3 = null; 10. e2.e = el; 11. e1 = null; 12. } 13. Eco e; 14. } At what point is only a single object eligible for GC?

  1. After line 8 runs.
  2. After line 9 runs.
  3. After line 10 runs.
  4. After line 11 runs.
  5. Compilation fails.
  6. An exception is thrown at runtime.
Question 9 Multiple Choice (Multiple Answers)

Given: 1. class Bigger { 2. public static void main(String[] args) { 3. // insert code here 4. } 5. } 6. class Better { 7. enum Faster {Higher, Longer}; 8. } Which, inserted independently at line 3, will compile? (Choose all that apply.)

  1. Faster f = Faster.Higher;
  2. Faster f = Better.Faster.Higher;
  3. Better.Faster f = Better.Faster.Higher;
  4. Bigger.Faster f = Bigger.Faster.Higher;
  5. Better. Faster f2; f2 = Better.Faster.Longer;
  6. Better b; b.Faster = f3; f3 = Better.Faster.Longer;
Question 10 Multiple Choice (Single Answer)

Given: class Bird { { System.out.print("bl "); } public Bird() { System.out.print("b2 "); } } class Raptor extends Bird { static { System.out.print("r1 "); } public Raptor() { System.out.print("r2 "); } { System.out.print("r3 "); } static { System.out.print("r4 "); } } class Hawk extends Raptor { public static void main(String[] args) { System.out.print("pre "); new Hawk(); System.out.println("hawk "); } } What is the result?

  1. pre b1 b2 r3 r2 hawk
  2. pre b2 b1 r2 r3 hawk
  3. pre b2 b1 r2 r3 hawk r1 r4
  4. r1 r4 pre b1 b2 r3 r2 hawk
  5. r1 r4 pre b2 b1 r2 r3 hawk
  6. Compilation fails.
Question 11 Multiple Choice (Multiple Answers)

What are the check tables and value tables?

  1. Check table will be at field level checking.
  2. Value table will be at domain level checking
  3. Value table will be at field level checking
  4. Check table will be at domain level checking
Question 12 Multiple Choice (Multiple Answers)

How many types of tables exist in data dictionary?

  1. Transparent tables
  2. Internal Table
  3. Pool tables
  4. Cluster tables
Question 13 Multiple Choice (Single Answer)

Is Session Method, Asynchronous or Synchronous?

  1. Asynchronous
  2. Synchronous
  3. Synchronous and Asynchronous
  4. None of above
Question 14 Multiple Choice (Single Answer)

Which data type cannot be used to define parameters?

  1. Type N
  2. Type C
  3. Type F
  4. Type P
Question 15 Multiple Choice (Single Answer)

Which Command flushes the database buffers?

  1. $TAB
  2. $RESET
  3. $INIT
  4. $FREE
Question 16 Multiple Choice (Single Answer)

What is new in EJB 2.1 ?

  1. Message-driven beans (MDBs)
  2. EJB query language (EJB-QL)
  3. Support for Web services
  4. All of the Above
  5. Only 1 & 2
  6. Only 1 & 3
Question 17 Multiple Choice (Single Answer)

What is/are true for Entity Beans ?

  1. Entity beans are permanent business entities
  2. Entity Beans are persistence objects
  3. EntityBeans are permanent
  4. All of the Above
  5. Only 1 & 2
  6. Only 1 & 3
Question 18 Multiple Choice (Single Answer)

JMS stands for .....

  1. Java Messaging Service
  2. Java Message Service
  3. Java Messenger Service
  4. Java Model Security
Question 19 True/False

Stateful Session Beans can be Persistent ?

  1. True
  2. False
Question 20 True/False

It is possible to maintain persistence temporarily in stateful sessionbeans?

  1. True
  2. False