44
Marks: --/1 Given char c = 'A'; What is the simplest way to convert the character value in c into an int? Select the one correct answer. Choose one answer. A. int i = Character.getNumericValue(c); B. int i = c; C. int i = (int) c; Marks: --/1 Given: 1. public class TestException extends Exception { 2. } 1. public class A { 2. 3. public String sayHello(String name) throws TestException { 4. 5. if(name == null) { 6. throw new TestException(); 7. } 8. 9. return “Hello “+ name;

Core Java Ques

Embed Size (px)

Citation preview

Page 1: Core Java Ques

Marks: --/1

Given char c = 'A';What is the simplest way to convert the character value in c into an int?Select the one correct answer.

Choose one answer. A. int i = Character.getNumericValue(c);

B. int i = c;

C. int i = (int) c; Marks: --/1

Given:

1. public class TestException extends Exception {

2. }

1. public class A {

2.

3. public String sayHello(String name) throws TestException {

4.

5. if(name == null) {

6. throw new TestException();

7. }

8.

9. return “Hello “+ name;

10. }

11.

12. }

Page 2: Core Java Ques

A programmer wants to use this code in an application:

45. A a=new A();

46. System.out.println(a.sayHello(”John”));

Which two are true? (Choose one.)Choose at least one answer.

A. Line 45 can throw the unchecked exception TestException.

B. Line 46 can throw the unchecked exception TestException.

C. Line 46 will compile if enclosed in a try block, where TestException is caught.

D. Class A will not compile.

Given:

10. public class Foo {

11. static int[] a;

12. static { a[0]=2; }

13. public static void main( String[] args) {}

14. }

Which exception or error will be thrown when a programmer attempts

to run this code?Choose one answer.

A. java.lang. StackOverflowError

B. java.lang.NullPointerException

C. java.lang.ArraylndexOutOfBoundsException

D. java.lang.ExceptionlnlnitializerError 1. Marks: --/1

Given:

11. public static void main(String[] args) {

Page 3: Core Java Ques

12. try {

13. args=null;

14. args[0] = “test”;

15. System.out.println(args[0]);

16. } catch (Exception ex) {

17. System.out.println(”Exception”);

18. } catch (NullPointerException npe) {

19. System.out.println(”NullPointerException”);

20. }

21. }

What is the result? Choose one answer.

A. Exception

B. NullPointerException

C. test

D. Compilation fails. Marks: --/1

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);

Page 4: Core Java Ques

18. }

19. }

20. public static void main(String[] args) {

21. parse(”invalid”);

22. }

What is the result?Choose one answer.

A. Compilation fails at line 15.

B. Compliation fails at line 13

C. A NumberFormatException is thrown by the parse method at runtime.

D. 0.0

Given:

11. static void test() {

12. try {

13. String x=null;

14. System.out.print(x.toString() +“ “);

15. }

16. finally { System.out.print(“finally “); }

17. }

18. public static void main(String[] args) {

19. try { test(); }

20. catch (Exception ex) { System.out.print(”exception “); }

21. }

What is the result?

Page 5: Core Java Ques

Choose one answer. A. null finally

B. finally

C. finally exception

D. null

Given:

11. static void test() {

12. try {

13. String x=null;

14. System.out.print(x.toString() +“ “);

15. }

16. finally { System.out.print(“finally “); }

17. }

18. public static void main(String[] args) {

19. try { test(); }

20. catch (Exception ex) { System.out.print(”exception “); }

21. }

What is the result? Choose one answer.

A. null finally

B. finally

C. finally exception

D. null --/1

public class TestEx {

Page 6: Core Java Ques

static class Ex1 extends Exception {

}

static class Ex2 extends Ex1 {

}

static class Ex3 extends Exception {

}

static void method1() throws Ex1, Ex2, Ex3 {

throw new Ex2();

}

public static void main(String[] args) {

try {

method1();

} catch (Ex3 ae) {

System.out.println("C");

} catch (Ex2 ne) {

System.out.println("B");

} catch (Ex1 ne) {

Page 7: Core Java Ques

System.out.println("A");

}

catch (Exception ne) {

System.out.println("D");

}

finally{

System.out.println("F");

}

}

}Choose one answer.

A. CF

B. BF

C. ABCDF

D. AF

E. DF Marks: --/1

What is the result of compiling and running the following program? 01.public class Tester {02.

Page 8: Core Java Ques

03. public static void main(String[] args) { 04.05. try {06. throw new RuntimeException();07.08. } catch (RuntimeException e) { 09. System.out.println("RuntimeException"); 10. } catch (ArithmeticException e) { 11. System.out.println("ArithmeticException"); 12. } catch (Exception e) { 13. System.out.println("Exception");14. }15. }16.}

Choose one answer. A. "Exception" is printed

B. "RuntimeException" is printed

C. Compilation error

D. "ArithmeticException" is printed

Marks: --/1

What is the result of compiling and running the following program?

public class Salmon {static void swim() {

try {

throw new Exception();} catch (Exception e) {

System.out.println("Salmon cant Swim");

}

}

public static void main(String args[]) {try {

swim();

} catch (Exception e) {

Page 9: Core Java Ques

System.out.println("Hello Main");

}

System.out.println("End Main");

}

}

Choose one answer. A. "Salmon cant Swim" is printed

B. "Salmon cant Swim" is printed

C. "Salmon cant Swim" and “End Main” is Printed

D. "Hello Main" is printed

What is the result of compiling and running the following program?

public class Salmon {static void swim() {

try {

throw new Exception();} catch (Exception e) {

System.out.println("Salmon cant Swim");

}

}

public static void main(String args[]) {try {

swim();

} catch (Exception e) {

System.out.println("Hello Main");

}

Page 10: Core Java Ques

System.out.println("End Main");

}

}

Choose one answer. A. "Salmon cant Swim" is printed

B. "Hello Main" is printed

C. "Salmon cant Swim" and “End Main” is Printed

D. "Salmon cant Swim" is printed Marks: --/1

What is the result of compiling and running the following program?

public class Salmon {static void swim() {

try {

throw new Exception();} catch (Exception e) {

System.out.println("Salmon cant Swim");

}

}

public static void main(String args[]) {try {

swim();

} catch (Exception e) {

System.out.println("Hello Main");

}

System.out.println("End Main");

}

Page 11: Core Java Ques

}

Choose one answer. A. "Salmon cant Swim" is printed

B. "Salmon cant Swim" is printed

C. "Salmon cant Swim" and “End Main” is Printed

D. "Hello Main" is printed Marks: --/1

What is the result of compiling and running the following program?

public class Salmon {static void swim() {

try {

throw new Exception();} catch (Exception e) {

System.out.println("Salmon cant Swim");

}

}

public static void main(String args[]) {try {

swim();

} catch (Exception e) {

System.out.println("Hello Main");

}

System.out.println("End Main");

}

}

Page 12: Core Java Ques

Choose one answer. A. "Salmon cant Swim" is printed

B. "Hello Main" is printed

C. "Salmon cant Swim" is printed

D. "Salmon cant Swim" and “End Main” is Printed Marks: --/1

What is the result of compiling and running the following program?

public class Salmon {static void swim() {

try {

throw new Exception();} catch (Exception e) {

System.out.println("Salmon cant Swim");

}

}

public static void main(String args[]) {try {

swim();

} catch (Exception e) {

System.out.println("Hello Main");

}

System.out.println("End Main");

}

}

Choose one answer. A. "Salmon cant Swim" is printed

Page 13: Core Java Ques

B. "Salmon cant Swim" and “End Main” is Printed

C. "Hello Main" is printed

D. "Salmon cant Swim" is printed

Which statement is true?

Choose one answer. A. The finalize() method can be declared with any accessibility

B. Objects can be destroyed by explicitly calling the finalize() method

C. All objects have a finalize() method

D. If an exception is thrown during the execution of the finalize() method of an eligible object, then the exception is ignored and the object is destroyed

Collections

11. public class Key {

12. private long id1;

13. private long 1d2;

14.

15. // class Key methods

16. }

A programmer is developing a class Key, that will be used as a key in

a standard java.util.HashMap. Which two methods should be

overridden to assure that Key works correctly as a key? (Choose two.)

Choose at least one answer. A. public boolean compareTo(Key k)

B. public boolean equals(Object o)

C. public int compareTo(Object o)

Page 14: Core Java Ques

D. public boolean equals(Key k)

E. public int hashCode

11. public static Collection get() {

12. Collection sorted = new LinkedList();

13. sorted.add(’B”); sorted.add(”C”); sorted.add(”A”);

14. return sorted;

15. }

16. public static void main(String[] args) {

17. for (Object obj: get()) {

18. System.out.print(obj + “, “);

19. }

20. }

What is the result? Choose one answer.

A. An exception is thrown at runtime.

B. B, C, A,

C. A, B, C,

D. Compilation fails.

E. The code runs with no outputMarks: --/1 Given

10. class Nav{

11. public enum Direction { NORTH, SOUTH, EAST, WEST }

12. }

13. public class Sprite{

14. // insert code here

Page 15: Core Java Ques

15. }

Which code, inserted at line 14, allows the Sprite class to compile?

Choose one answer. A. Nav.Direction d = NORTH;

B. Direction d = NORTH;

C. Direction d = Direction.NORTH;

D. Nav.Direction d = Nav.Direction.NORTH; Marks: --/1

Given :

11. public enum Title {

12. MR(”Mr.”), MRS(”Mrs.”), MS(”Ms.”);

13. private final String title;

14. private Title(String t) { title = t; }

15. public String format(String last, String first) {

16. return title + “ “ + first + “ “ + last;

17. }

18. 19. public static void main(String[] args) {

19. System.out.println(Title.MR.format(”Doe”, “John”));

20. }21. }

What is the result?Choose one answer.

A. Compilation fails because of an error in line 12.

B. Mr. John Doe

C. An exception is thrown at runtime.

D. Compilation fails because of an error in line 20.

E. Compilation fails because of an error in line 15. Marks: --/1

Page 16: Core Java Ques

Given Example:

11. public class Person {

12. private name;

13. public Person(String name) {

14. this.name = name;

15. }

16. public int hashCode() {

17. return 420;

18. }

19. }

If the objects of Person are stored nt a TreeSet ,Which is true?

Choose one answer. A. Inserting a second Person object into a TreeSet will be possible only if Comparable Interace is implemented by Person B. Inserting a second Person object into a TreeSet will cause the first Person object to be removed as a duplicate.

C. All the Person Objects will be stored and wil be unique.

D. Deleting a Person from a TreeSet will delete all entries for type Person.

Given:

1. class Pizza {

2. java.util.ArrayList toppings;

3. public final void addTopping(String topping) {

4. toppings.add(topping);

Page 17: Core Java Ques

5. }

6. }

7. public class PepperoniPizza extends Pizza {

8. public void addTopping(String topping) {

9. System.out.println(”Cannot add Toppings”);

10. }

11. public static void main(String[] args) {

12. Pizza pizza = new PepperoniPizza();

13. pizza.addTopping(”Mushrooms”);

14. }

15. }

What is the result? Choose one answer.

A. Cannot add Toppings

B. Compilation fails.

C. The code runs with no output.

D. A NullPointerException is thrown in Line 4.

Given:

1. class Pizza {

2. java.util.ArrayList toppings;

3. public final void addTopping(String topping) {

Page 18: Core Java Ques

4. toppings.add(topping);

Page 19: Core Java Ques

5. }

6. }

7. public class PepperoniPizza extends Pizza {

8. public void addTopping(String topping) {

9. System.out.println(”Cannot add Toppings”);

10. }

11. public static void main(String[] args) {

12. Pizza pizza = new PepperoniPizza();

13. pizza.addTopping(”Mushrooms”);

14. }

15. }

What is the result? Choose one answer.

A. A NullPointerException is thrown in Line 4.

B. Cannot add Toppings

C. Compilation fails.

D. The code

Given:

11. public static Iterator reverse(List list) {

12. Collections.reverse(list);

13. return list.iterator();

Page 20: Core Java Ques

14. }

15. public static void main(String[] args) {

16. List list = new ArrayList();

17. list.add(” 1”); list.add(”2”); list.add(”3”);

18. for (Object obj: reverse(list))

19. System.out.print(obj + “,”);

20. }

‘What is the result?Choose one answer.

A. 3,2, 1,

B. The code runs with no output.

C. 1, 2, 3,

D. Compilation fails, Collections.reverse(List) is not applicable

E. An exception is thrown at runtime.

Given:

11. public static void main(String[] args) {

12. for (int i=0;i<= 10;i++){

13. if( i>6) break;

14. }

15. System.out.println(i);

16. }

What is the result? Choose one answer.

A. Compilation fails.

B. 6

C. 7

Page 21: Core Java Ques

D. 10 Marks: --/1

What is the result of compiling and running the following code?

import java.util.Scanner;public class Tester {public static void main(String[] args) {Scanner sc = new Scanner("corejava 2009, true 239");while (sc.hasNext()) {if (sc.hasNextBoolean())System.out.print("Boolean");if (sc.hasNextInt())System.out.print("Int");sc.next();}}}

Choose one answer. A. IntInt

B. Compilation error

C. BooleanInt Marks: --/1

What is the result of compiling and running the following code?

01.import java.util.HashSet; 02.import java.util.Set; 03.04.public class Test{ 05.06. public static void main(String[] args) {07.08. Set humans = new HashSet();09. humans.add(new Human(13)); 10. humans.add(new Human(33));11. humans.add(new Human(21));12. humans.add(new Human(21));13. System.out.print(humans.size()+" "); 14. System.out.print(humans);15.16. }17.

Page 22: Core Java Ques

18.}19.20.class Human implements Comparable { 21. Integer age; 22.23. public Human(int age) {24. this.age = age; 25. }26.27. public int compareTo(Human h) { 28. return h.age.compareTo(this.age);29. }30.31. public String toString() { 32. return ""+this.age; 33. }34.35.}

Choose one answer. A. exception is thrown at run time

B. 3 [21, 33, 13]

C. 4 [33, 21, 13, 21]

D. compilation error

What is the result of compiling and running the following code?

import java.util.Scanner;

public class Tester {

public static void main(String[] args) {

Scanner sc = new Scanner("true 239");

while (sc.hasNextBoolean()) {

System.out.println(sc.next());

 

}

Page 23: Core Java Ques

}

}Choose one answer.

A. RuntimeError

B. Compilation fails

C. true

D. Boolen

;//line 2 list2.a

Question 1. Marks: --/1

What is the result of compiling and running the following program?

import java.util.ArrayList;

import java.util.List;

public class Tester {

public static void main(String[] args) {

List<String> list1 = new ArrayList<String>();//line 1

List<Object> list2 = list1;//line 2

list2.add(new Integer(12));//line 3

System.out.println(list2.size());//line 4

}

}Choose one answer.

A. 1

B. Compilation error at line 3, can add objects of type String only

C. Compilation error at line 1, must initialize the size

D. Compilation error at line 2,Type mismatch, cannot convert from

Page 24: Core Java Ques

List toList

What is the result of compiling and running the following program?

import java.util.ArrayList;

import java.util.List;

public class Tester {

public static void main(String[] args) {

List<String> list1 = new ArrayList<String>();//line 1

List<Object> list2 = list1;//line 2

list2.add(new Integer(12));//line 3

System.out.println(list2.size());//line 4

}

}Choose one answer.

A. Compilation error at line 3, can add objects of type String only

B. Compilation error

What is the result of compiling and running the following program?

import java.util.ArrayList;

import java.util.List;

public class Tester {

public static void main(String[] args) {

List<String> list1 = new ArrayList<String>();//line 1

List<Object> list2 = list1;//line 2

Page 25: Core Java Ques

list2.add(new Integer(12));//line 3

System.out.println(list2.size());//line 4

}

}Choose one answer.

A. 1

B. Compilation error at line 3, can add objects of type String only

C. Compilation error at line 1, must initialize the size

D. Compilation error at line 2,Type mismatch, cannot convert from List toList

What is the result of compiling and running the following program?

import java.util.ArrayList;

import java.util.List;

public class Tester {

public static void main(String[] args) {

List<String> list1 = new ArrayList<String>();//line 1

List<Object> list2 = list1;//line 2

list2.add(new Integer(12));//line 3

System.out.println(list2.size());//line 4

}

}Choose one answer.

A. Compilation error at line 2,Type mismatch, cannot convert

from List toList

B. 1

C. Compilation error at line 1, must initialize the size

D. Compilation error at line 3, can add objects of type String only

Page 26: Core Java Ques

Marks: --/1

What is the result of compiling and running the following program?

import java.util.ArrayList;

import java.util.List;

public class Tester {

public static void main(String[] args) {

List<String> list1 = new ArrayList<String>();//line 1

List<Object> list2 = list1;//line 2

list2.add(new Integer(12));//line 3

System.out.println(list2.size());//line 4

}

}Choose one answer.

A. Compilation error at line 1, must initialize the size

B. 1

C. Compilation error at line 2,Type mismatch, cannot convert from List

toList

D. Compilation error at line 3, can add objects of type String only

Marks: --/1

Which of these are core interfaces in the collections framework?

Choose at least one answer. A. Collection

B. Set

C. Bag

D. Map

Page 27: Core Java Ques

E. LinkedList

Marks: --/1

Will the following code compile? 01.import java.util.*; 02.03.class B { 04.} 05.06.class C extends B {07.} 08.09.public class Test { 10.11. public static Queue ring(List list) {12. return null; 13. } 14.15. public static void main(String[] args) { 16. List list1 = new ArrayList();17. ArrayList list2 = new ArrayList(); 18.19. Queue q1;20. PriorityQueue q2;21.22. q1 = ring(list1); // line123. q1 = ring(list2); // line2 24. q2 = ring(list1); // line325. q2 = ring(list2); // line4 26. }27.}

Choose at least one answer. A. No, there is a compilation error at // Line 3

B. Yes, the program is free of compilation errors

C. No, there is a compilation error at // Line 1

D. No, there is a compilation error at // Line 2

Threads

Marks: --/1

Page 28: Core Java Ques

Given: 1. public class TestOne implements Runnable { 2. public static void main (String[] args) throws Exception { 3. Thread t = new Thread(new TestOne());4. t.start();5. System.out.print(”Started”);6. t.join(); 7. System.out.print(”Complete”);8. } 9. public void run() {10. for (int i= 0; i< 4; i++) { 11. System.out.print(i);12. }13. } 14. }What can be a result?

Choose one answer. A. An exception is thrown at runtime.

B. The code executes and prints “StartedComplete”.

C. The code executes and prints “StartedComplete0123”.

D. Compilation fails.

E. The code executes and prints “Started0l23Complete”. Marks: --/1

Given: 1. public class Threads 1 { 2. intx=0;3. public class Runner implements Runnable {4. public void run() { 5. int current = 0;6. for(int=i=0;i<4;i++){7. current = x;8. System.out.print(current + “, “);9. x = current + 2;10. }11. }12. }13.14. public static void main(String[] args) { 15. new Threads1().go();16. } 17.

Page 29: Core Java Ques

18. public void go() { 19. Runnable r1 = new Runner(); 20. new Thread(r1).start();21. new Thread(r1 ).start();22. } 23. } Which two are possible results? (Choose two.)

Choose at least one answer. A. 0, 2, 4, 6, 8, 10, 12, 14,

B. 0, 2, 4, 6, 8, 10, 2, 4,

C. 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14,

D. 0, 2, 4, 4, 6, 8, 10, 6,

E. 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14 Marks: --/1

Given:10. public class Starter extends Thread { 11. private int x= 2;12. public static void main(String[] args) throws Exception {13. new Starter().makeItSo();14. }15. public Starter() { 16. x=5; 17. start();18. }19. public void makeItSo() throws Exception { 20. join();21. x=x- 1; 22. System.out.println(x);23. } 24. public void run() { x *= 2; } 25. }What is the output if the main() method is run?

Choose one answer. A. 8

B. 4

C. 5

D. 9

Given:

Page 30: Core Java Ques

1. public class TestOne implements Runnable {

2. public static void main (String[] args) throws Exception {

3. Thread t = new Thread(new TestOne());

4. t.start();

5. System.out.print(”Started”);

6. t.join();

7. System.out.print(”Complete”);

8. }

9. public void run() {

10. for (int i= 0; i< 4; i++) {

11. System.out.print(i);

12. }

13. }

14. }

What can be a result?Choose one answer.

A. The code executes and prints “Started0123Complete”.

B. Compilation fails.

C. The code executes and prints “StartedComplete”.

D. An exception is thrown at runtime.

E. The code executes and prints “StartedComplete0123

Given:

1. public class TestOne implements Runnable {

2. public static void main (String[] args) throws Exception {

Page 31: Core Java Ques

3. Thread t = new Thread(new TestOne());

4. t.start();

5. System.out.print(”Started”);

6. t.join();

7. System.out.print(”Complete”);

8. }

9. public void run() {

10. for (int i= 0; i< 4; i++) {

11. System.out.print(i);

12. }

13. }

14. }

What can be a result?Choose one answer.

A. The code executes and prints “Started0123Complete”.

B. Compilation fails.

C. The code executes and prints “StartedComplete”.

D. An exception is thrown at runtime.

E. The code executes and prints “StartedComplete0123

Given:

10. public class Starter extends Thread {

11. private int x= 2;

12. public static void main(String[] args) throws Exception {

13. new Starter().makeItSo();

14. }

Page 32: Core Java Ques

15. public Starter() {

16. x=5;

17. start();

18. }

19. public void makeItSo() throws Exception {

20. join();

21. x=x- 1;

22. System.out.println(x);

23. }

24. public void run() { x *= 2; }

25. }

What is the output if the main() method if the thread gets attention as soon as started in constructor?Choose one answer.

A. 9

B. Compilation fails

C. 5

D. 4

E. 8

public class Threads2 implements Runnable {

2.

3. public void run() {

4. System.out.println(”run.”);

5. throw new RuntimeException(”Problem”);

6. }

Page 33: Core Java Ques

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 one answer.

A. End of method. run. java.lang.RuntimeException: Problem

B. End of method. java.lang.RuntimeException: Problem

C. run. java.lang.RuntimeException: Problem

D. java.lang.RuntimeException: Problem

Which one of these events will cause a thread to die?

Choose one answer. A. The method wait() is called

B. Execution of the start() method ends

C. Execution of the run() method ends

D. The method sleep() is called

Which three will compile and run without exception? (Choose three.)

Choose at least one answer. A. void go() { synchronized() { /* code here */ } }

B. private synchronized(this) void go() { /* code here */ }

C. private synchronized Object o;

D. public synchronized void go() { /* code here */ }

E. void go() { Object o = new Object(); synchronized(o) { /* code here */ } }

F. void go() { synchronized(Object.class) { /* code here */ } }

JDBC

Page 34: Core Java Ques

The following class is an extension of Statement class and uses precompiled SQL with dynamically set input parameters

Choose one answer. A. Callable Statement

B. ParameterStatement

C. PreparedStatement

D. CompiledStatement

How can you execute a stored procedure in the database?Choose one answer.

A. Call method execute() on a CallableStatement object

B. Call method executeProcedure() on a Statement object

C. Call method execute() on a StoredProcedure object

D. Call method run() on a ProcedureCommand object Marks: --/1

The questions below run statements against the following table called books.

book_id(integer) name(varchar) author_name(varchar) price(real)

1 ‘scott’ ‘Herman Melville’ 10.95

2 ‘peter’ ‘Garrison Keillor’ 12.95

3 ‘James’ ‘Garrison Keillor’ 14.95

Assuming a valid connection called con, what is displayed by the following code?

PreparedStatement goFishing= con.prepareStatement("UPDATE books SET price = ?

WHERE author_name = ?");

Page 35: Core Java Ques

goFishing.setFloat(1, 19.95f);

goFishing.setString(2, "Thomas Melville");

System.out.println("Result: " + goFishing.executeUpdate());Choose one answer.

A. Result: 1

B. Result: 0

C. Thomas Melville19.95

D. Result: 19.95 Marks: --/1

To get the number of columns in the ResultSet use the following method

Choose one answer. A. getColumnCount() of the ResultSetMetaData

B. getColumnNumber()of the DatabaseMetaData

C. getColumnLabel() of the ResultSetMetaData

D. getColumnCount() of the DatabaseMetaData Marks: --/1

To register a database driver use the following

Choose one answer. A. Class.forName()

B. new DriverManager()

C. DriverManager.getConnection()

D. Class.registerDriver()

What of the following is the default Scroll type for a ResultSet object? Choose at least one answer.

A. ResultSet.TYPE_SCROLLABLE

B. ResultSet.TYPE_SCROLL_SENSITIVE

C. ResultSet.TYPE_SCROLL_UPDATABLE

D. ResultSet.TYPE_SCROLL_INSENSITIVE

E. ResultSet.TYPE_FORWARD_ONLY

Page 36: Core Java Ques

J2EE Architecture

Marks: --/1

Consider the following scenario and fill in the blanks with correct option given below: Developers can send and receive SOAP messages in the Java platform. The body of the SOAP message consists of data in XML-format. If Data that does not confirm to the XML-format has to be sent, then the API used to send the non xml-format data is___________.

Choose one answer. A. SAAP

B. JAX-JAS

C. SAAJ

D. JAX-RPC

Consider the following statement about SOAP message:An object of the SOAP Fault class is used to receive status and error information when the message does not reach its destination successfully.Which of the following attribute of the SOAP fault object is used to identify the source of the fault?

Choose one answer. A. a fault code

B. a fault string

C. a fault actor

D. a detail object

Marks: --/1

Consider the following statements:Statement A: The SAX and the DOM APIs process an XML document and XSLT API transforms an XML document into other format.Statement B: The SAX and the DOM APIs transforms an XML document into other format and XSLT API process an XML document.Which of the following is applicable for above?

Page 37: Core Java Ques

Choose one answer. A. Statement A is True and Statement B is False

B. Statement A is False and Statement B is True

C. Both, Statements, A and B, are True

D. Both, Statements, A and B, are False Marks: --/1

Identify, from the following, the correct option regarding the packaging of a Web service for deployment in the J2EE application server.

Choose one answer. A. Web service is packaged in a WAR file.

B. A Web service is packaged in a JAR file.

C. A Web service is packaged in an EAR file.

D. A Web service is directly deployed, therefore no packaging is required.

J2EE, the Java 2 Enterprise Edition, is __________________________________.

Choose one answer. A. an improved version of the Java 2 Standard Edition for business professionals. B. a development environment, designed for creating enterprise applications.

C. a platform for enterprise class level, distributed applications.

D. a replacement of the Java Virtual Machine for running internet applications.

Where does enterprise components run in J2EE multitiered Applications?(Choose 2)Client tier

Choose at least one answer. A. Client tier

B. J2EE server

C. EIS server

D. IIS

E. None of the listed options

Page 38: Core Java Ques

Where does web tier components run in J2EE multitiered Applications?

Choose one answer. A. Client tier

B. J2EE server

C. EIS server

D. IIS

E. None of the listed options

Marks: --/1

Which of the following can be considered as types of J2EE clients?

Choose one answer. A. Applets

B. Application clients

C. Java Web Start-enabled rich clients

D. All of the listed options

Which of the following does the J2EE platform consist of?

Choose one answer. A. Services

B. APIs

C. Protocols

D. All of the listed options

Which of the following gives the services provided by container?

Choose one answer. A. lifecycle management

B. deployment

C. security

D. threading

E. All of the listed options