Sudharani - Core Java - SR Associate Assessment - 1520497729331

Download as pdf or txt
Download as pdf or txt
You are on page 1of 63

Core

Java- Sr Associate Assessment

Sudharani Test Taken on: March 7, 2018 11:53:09 PM IST


[email protected] Finish State: Normal

Registration Details

Email Address: [email protected] First Name: Sudharani

Last Name: pujari Date of birth: Jun 8, 1983

Contact No: 9916137319 Gender: female

Country: india Previous Employer: cts

Graduation Marks: 70.5

Performance Category

ve ra g e You have been rated as Below Average by the assessor for this test.
Be l o w A

Overall Summary

MARKS SCORED


Score Percentile Percentage

Java 58 / 98 95 59.18

Total 58 / 98 95 59.18

Percentile is among 7533 candidate(s) who've taken this test.

1 / 63
SUMMARY OF ATTEMPTS TIME TAKEN

1 29
hr min

45 Correct Available time: 1 hr 30 min


(Scored 58/58)
29 Incorrect
(Scored 0/40)

2 / 63
Section-wise Details

Java

MARKS SCORED


Score Percentage

Manual Testing - SDLC 0 / 8 0


Types

Manual Testing - SDLC 3 / 3 100


Types

XML 6 / 6 100

Java - 2 / 2 100
Generics_Sapient
Selected

Java - Web Services - 2 / 2 100


General_Sapient
Selected

Java - Web Services - 3 / 4 75


General_Sapient
Selected

Java - Exception 3 / 4 75
Handling_Sapient
Selected

Java - Design 3 / 4 75
Patterns_Sapient
Selected

SOA - 1 / 2 50
Concepts_Sapient
Selected

Core Java_Sapient 3 / 5 60
Selected

Core Java_Sapient 4 / 10 40
Selected

Java - 3 / 4 75
Collections_Sapient
Selected

3 / 63
Hibernate - 1 / 3 33.33
Environment_Sapient
Selected

Java - JDBC_Sapient 2 / 3 66.67


Selected

Java - JSP_Sapient 2 / 3 66.67


Selected

Java - JSP_Sapient 1 / 1 100


Selected

Java - 2 / 4 50
Threads_Sapient
Selected

JavaScript - 2 / 5 40
Arrays_Sapient
Selected

Java - Spring_Sapient 5 / 8 62.5


Selected

UML Diagrams 6 / 6 100

Java - Junit 4 / 8 50

Java - Junit 0 / 3 0

Total 58 / 98 59.18

SUMMARY OF ATTEMPTS TIME TAKEN

29 Incorrect
1 29
(Scored 0/40) hr min

45 Correct This was untimed section.


(Scored 58/58)

4 / 63
Difficulty Level Analysis

ASSESSMENT LEVEL ANALYSIS

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Medium (M) 24 24 / 24 26 / 36

Difficult (D) 50 50 / 50 32 / 62

Total 74 74 / 74 58 / 98

SKILL LEVEL ANALYSIS

Core Java_Sapient Selected

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Medium (M) 5 5 / 5 3 / 5

Difficult (D) 10 10 / 10 4 / 10

Total 15 15 / 15 7 / 15

Hibernate - Environment_Sapient Selected

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Difficult (D) 3 3 / 3 1 / 3

Total 3 3 / 3 1 / 3

Java - Collections_Sapient Selected

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Difficult (D) 4 4 / 4 3 / 4

Total 4 4 / 4 3 / 4

Java - Design Patterns_Sapient Selected

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Difficult (D) 4 4 / 4 3 / 4

Total 4 4 / 4 3 / 4

5 / 63
Java - Exception Handling_Sapient Selected

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Difficult (D) 4 4 / 4 3 / 4

Total 4 4 / 4 3 / 4

Java - Generics_Sapient Selected

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Difficult (D) 2 2 / 2 2 / 2

Total 2 2 / 2 2 / 2

Java - JDBC_Sapient Selected

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Medium (M) 3 3 / 3 2 / 3

Total 3 3 / 3 2 / 3

Java - JSP_Sapient Selected

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Medium (M) 1 1 / 1 1 / 1

Difficult (D) 3 3 / 3 2 / 3

Total 4 4 / 4 3 / 4

Java - Junit

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Medium (M) 1 1 / 1 0 / 3

Difficult (D) 2 2 / 2 4 / 8

Total 3 3 / 3 4 / 11

Java - Spring_Sapient Selected

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Difficult (D) 8 8 / 8 5 / 8

6 / 63
Total 8 8 / 8 5 / 8

Java - Threads_Sapient Selected

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Difficult (D) 4 4 / 4 2 / 4

Total 4 4 / 4 2 / 4

Java - Web Services - General_Sapient Selected

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Medium (M) 2 2 / 2 2 / 2

Difficult (D) 4 4 / 4 3 / 4

Total 6 6 / 6 5 / 6

JavaScript - Arrays_Sapient Selected

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Medium (M) 5 5 / 5 2 / 5

Total 5 5 / 5 2 / 5

Manual Testing - SDLC Types

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Medium (M) 1 1 / 1 3 / 3

Difficult (D) 2 2 / 2 0 / 8

Total 3 3 / 3 3 / 11

SOA - Concepts_Sapient Selected

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Medium (M) 2 2 / 2 1 / 2

Total 2 2 / 2 1 / 2

UML Diagrams

7 / 63
Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Medium (M) 2 2 / 2 6 / 6

Total 2 2 / 2 6 / 6

XML

Difficulty Levels Total no. of questions No. of Attempted questions Marks Scored

Medium (M) 2 2 / 2 6 / 6

Total 2 2 / 2 6 / 6

8 / 63
Question-wise Details

Java

Question 1: Time: 2 Min 28 Sec Marks: 1/ 1

What would be the output of the following program?


1
2 class Test{
3 public static void main(String[] args) {
4 Test t = new Test();
5 int i = t.check();
6 System.out.println(i);
7 }
8 int check(){
9 try{
10 System.out.println("try block");
11 return 1;
12 }catch(Exception e){
13
14 System.out.println("catch block");
15 return 2;
16 }finally{
17 System.out.println("finally returning");
18 return 3;
19 }
20 }
21 }
22

9 / 63
Options Response Answer

Try block
1

Try block
1
Finally returning
3

Try block
Finally returning
3

Try block
Finally returning
1

Try block
Finally returning
1
3

Question 2: Time: 45 Sec Marks: 1/ 1

What would be the output of the following program?


1 import java.io.IOException;
2
3 class Test{
4
5 public static void main(String[] args) {
6 Test t = new Test();
7 int i = t.check();
8 System.out.println(i);
9 }
10 int check(){
11 try{
12 throw new IOException();
13 }catch(Exception e){
14
15 System.out.println("catch block");
16 return 1;//line 16
17 }finally{
18 System.out.println("finally returning");
19 return 2;
20 }
21 }
22 }
23

10 / 63
Options Response Answer

Compile-time exception, as a function


cannot return two values

Catch block
1

Catch block
Finally returning
1

Catch block
Finally returning
2

Question 3: Time: 26 Sec Marks: 0/ 1

What would be the output of the following program?


1
2 class Test{
3 public static void main(String[] args) {
4 Test t = new Test();
5 int i = t.check();
6 System.out.println(i);
7 }
8 int check(){
9 try{
10 System.out.println("try block");
11 return 1;
12 }catch(Exception e){
13
14 System.out.println("catch block");
15 return 2;
16 }finally{
17 System.exit(0);
18 System.out.println("finally returning");
19 return 3;
20 }
21 }
22 }
23

11 / 63
Options Response Answer

Try block
1

Try block
1
Finally returning
3

Try block
Finally returning
3

Try block

Try block
Finally returning
1
3

Question 4: Time: 16 Sec Marks: 1/ 1

What would be the output of the following program?


1
2 class Test{
3 public static void main(String[] args) {
4 Test t = new Test();
5 int i = t.check();
6 System.out.println(i);
7 }
8 int check(){
9 try{
10 System.out.println("try block");
11 System.exit(0);
12 return 1;
13 }catch(Exception e){
14
15 System.out.println("catch block");
16 return 2;
17 }finally{
18 System.out.println("finally returning");
19 return 3;
20 }
21 }
22 }
23

12 / 63
Options Response Answer

Try block

Try block
1
Finally returning
3

Try block
Finally returning
3

Try block
Finally returning
1

Try block
Finally returning
1
3

Question 5: Time: 47 Sec Marks: 1/ 1

Which of the following methods can be used for removing focus from the current window?

Options Response Answer

window.blur()

document.blur()

window.focus()

document.focus()

Question 6: Time: 32 Sec Marks: 0/ 1

Which of the following methods will return the day of the month of the date object, according to universal time?

13 / 63
Options Response Answer

getUTCDate()

getUTCDay()

getDay()

none of these

Question 7: Time: 18 Sec Marks: 0/ 1

What is the largest value that can be stored by a Javascript integer?

Options Response Answer

2^31-1

2^63-1

2^53

Depends on operating system

None of these

Question 8: Time: 20 Sec Marks: 0/ 1

The event onbeforeunload() is triggered in which of the following scenarios?

Options Response Answer

When the page is closed

When the page is refreshed

Both of the above

none of the above

Question 9: Time: 1 Min 0 Sec Marks: 1/ 1

14 / 63
Array(16).join("js" - 1) gives -

Options Response Answer

NanNaNNan… upto 15 times

js1js1… upto 15 times

undefined

Type error

Question 10: Time: 31 Sec Marks: 1/ 1

Which of the following rules are applied to define generic methods?


a. All method declarations have a type parameter section delimited by angle brackets
b. Each type parameter contains one or more type parameters separated by a semicolon
c. Type parameter act as placeholders for the types of the arguments passed to the generic method

Options Response Answer

a, b

b, c

a, c

a, b, c

Question 11: Time: 37 Sec Marks: 1/ 1

15 / 63
When creating a generic class following syntax is used:

public class test <T>

while for a non generic class syntax used is:

public class test. Which of the following is a reaon for adding <T> to represent generic class?

a. <T> refers to a generic type

b. It is used to provide compile time security

c. It does not ensure type erasure and type safety

Options Response Answer

a only

a, b

a, c

b, c

Question 12: Time: 3 Min 4 Sec Marks: 0/ 1

You have defined a utility method called factorial in the class 'utilities.Math' that accepts an integer as a parameter & returns a
long value. Which of the following rightly defines the EL function in its deployment descriptor?

16 / 63
Options Response Answer

1
2 <function>
3 <name>factorial</name>
4 <function-class>utilities.Math</function-class>
5 <function-signature>java.lang.long factorial(java.lang.integer)</function-signature>
6 </function>
7

1 <method>
2 <name>factorial</name>
3 <method-class>utilities.Math</method-class>
4 <method-signature>java.lang.long factorial(java.lang.integer)</ method-signature>
5 </method>
6

1 <function>
2 <name>factorial</name>
3 <function-class>utilities.Math</function-class>
4 <function-signature>
5 <arguments>integer</arguments>
6 <return-type>long</return-type>
7 </function-signature>
8 </function>
9

None of these

Question 13: Time: 7 Sec Marks: 1/ 1

JSP specification includes:

Options Response Answer

JSP standard directives

Script language declarations, scriptlets


& expressions

standard actions

All of the above

Answer Explanation

17 / 63
NULL

Question 14: Time: 16 Sec Marks: 1/ 1

Answer the following questions based on your knowledge of JSP


A scriptlet is enclosed between the tags:

Options Response Answer

1 <%--------%>
2

1 <!-------------/>
2

1 <?--------------?>Â
2

1 <%----------->
2

Question 15: Time: 1 Min 45 Sec Marks: 1/ 1

Which of the following allows non-repeatable read in JDBC Connection?

18 / 63
Options Response Answer

TRANSACTION_READ_UNCOMMITT
ED

TRANSACTION_READ_COMMITTED

TRANSACTION_SERIALIZABLE

TRANSACTION_REPEATABLE_REA
D

Candidate responses were captured before updation of the question with restrictions on maximum responses.

Question 16: Time: 8 Sec Marks: 0/ 1

How many transaction isolation levels are defined in java.sql.Connection interface?

Options Response Answer

4.0

3.0

5.0

2.0

Question 17: Time: 1 Min 31 Sec Marks: 1/ 1

All raw data types (including binary documents or images) should be read and uploaded to the database as an array of:

19 / 63
Options Response Answer

byte

int

boolean

char

Question 18: Time: 1 Min 2 Sec Marks: 0/ 1

Choose the correct option.


Identify the true statement.

Options Response Answer

Service activities represent runtime


activity that occurs within the
underlying service logic.

Service activities represent design-time


message exchanges that are
established between SOAP-based Web
services and defined as part of the
operation definition within the WSDL
definition.

Service activities represent runtime


activity that occurs between services.

Service activities represent runtime


activity that occurs between complex
and simple XML Schema types.

Question 19: Time: 1 Min 11 Sec Marks: 1/ 1

There can be more than one correct answer.

From the following identify the industry standard technologies related to the processing of XML-based data .

20 / 63
Options Response Answer

XData

XQuery

XSLT

XWeb

Candidate responses were captured before updation of the question with restrictions on maximum responses.

Question 20: Time: 1 Min 59 Sec Marks: 1/ 1

Choose the correct option & complete the following code:

1
2 public class CD implements Serializable {
3 String title;
4 String artist;
5 ArrayList tracks;
6 }
7 public void addTrack(Track track) {
8 tracks.add(track);
9 }
10 private class Track {
11 String name;
12 int length;
13 public track(String name, int length) {
14 this.name = name;
15 this.length = length;
16 }
17 }
18 }
19

21 / 63
Options Response Answer

1 public CD(String title, String artist) {


2 thistitle = title;
3 thisartist = artist;
4 tracks = ArrayList();
5

1 public CD(String title, String artist) {


2 this.title = title;
3 this.artist = artist;
4 tracks = new ArrayList();
5

1 private CD(String title, String artist) {


2 this.title = title;
3 this.artist = artist;
4 tracks = new ArrayList();
5

None of these

Question 21: Time: 11 Sec Marks: 0/ 1

Consider the following CD class example and state if it is valid or not?

1
2 public class CD implements Serializable {
3 String title;
4 String artist;
5 ArrayList tracks;
6 public CD(String title, String artist) {
7 this.title = title;
8 this.artist = artist;
9 tracks = new ArrayListO;
10 }
11 public void addTrack(String track) {
12 tracks. add(track);
13 }
14 }
15

Options Response Answer

Valid

Invalid

22 / 63
Question 22: Time: 2 Min 35 Sec Marks: 0/ 1

Consider the following affirmations:


A1- When the object is pulled from the database, it has an associated version number.
A2- If the application changes the object in any way, the persistence layer updates the version number by a single digit.
A3- The layer can then delete the version number to determine whether the object needs to be persisted.
Which of the above affirmations are correct?

Options Response Answer

A1

A2

A1 & A2

All of the above

Question 23: Time: 57 Sec Marks: 1/ 1

A JSP action tag:

Options Response Answer

enables the use of server side


Javabeans.

transfers control between pages.

supports applets.

All of the above

Question 24: Time: 1 Min 12 Sec Marks: 1/ 1

When would one get ExceptionInInitializerError ?

23 / 63
Options Response Answer

When there is a constructor execution


problem

When there is a problem in the


execution of a method in a class

When there is some problem in the


execution of static blocks in a class

When a class is not found by the JVM


at runtime

Question 25: Time: 16 Sec Marks: 0/ 1

What is the output of the following Java code?


1 public class q2{


2 public static void main(String as[]){
3 float f=\u0038;
4 System.out.println(f);
5 }
6 }
7

Options Response Answer

38

Compilation Error

Runtime Exception

Nothing will display

None of these

Question 26: Time: 16 Sec Marks: 1/ 1

24 / 63
What is the output of the following Java code?

1 class q28{
2 public static void main(String as[]){
3 int x=10;
4 int y=20;
5 (x>y)? System.out.println(x) : System.out.println(y);
6
7 }
8 }
9

Options Response Answer

Compilation Error

Runtime Exception

10

20

None of these

Question 27: Time: 1 Min 27 Sec Marks: 1/ 1

What will be the outcome when the given code is compiled and run?

1 public class qq4{


2 final int x;
3 {
4 x =10;
5 }
6
7 public static void main(String as[]){
8 System.out.println(new qq4().x);
9 }
10 }
11

25 / 63
Options Response Answer

10

Garbage Value

Compilation fails

Runtime Exception

Question 28: Time: 34 Sec Marks: 0/ 1

Answer the below question based on Core Java concepts.


Which of the following methods gives up the resources when called on a thread?

Options Response Answer

join

sleep

wait

yield

Question 29: Time: 46 Sec Marks: 0/ 1

26 / 63
What will be the outcome when the given code is compiled and run?

1 class Test18{
2 public static void main(String as[]){
3 int x=2;
4 final long j=2;
5 switch(x){
6 case 1:
7 System.out.println("1");
8 break;
9
10 case 10:
11 System.out.println("10");
12 break;
13
14 case j:
15 System.out.println("2");
16 break;
17
18 case 5:
19 System.out.println("5");
20 break;
21
22 default:
23 System.out.println("Default");
24 break;
25 }
26 }
27 }
28

Options Response Answer

compilation error

Runtime Exception

It will output: 2

It will output: Default

None of these

Question 30: Time: 9 Sec Marks: 1/ 1

27 / 63
What will be the outcome when the given code is compiled and run?

1 public class qq32{


2 public static void main(String as[]){
3 Boolean b1 =new Boolean("TruE");
4 Boolean b2 =new Boolean("true");
5 System.out.println(b1.equals(b2));
6
7 }
8 }
9

Options Response Answer

true

false

-1

-32

Question 31: Time: 2 Min 52 Sec Marks: 0/ 1

What will be the outcome when the given code is compiled and run?

1 public class qq21{


2 public static void main(String as[]){
3 System.out.println(method());
4 }
5 public static int method(){
6 try{
7 throw new ClassNotFoundException();
8 }catch(Exception e){
9 throw new NullPointerException();
10 }
11 }
12 }
13

28 / 63
Options Response Answer

At run time ClassNotFoundException

At run time NullPointerException

At compile time
classNotFoundException

At compile time NullPointerException

Run successfully and nothing will


display

Question 32: Time: 49 Sec Marks: 0/ 1

What will be the outcome when the given code is compiled and run?

1 public class qq42{


2 public static void main(String as[]){
3 Hello h = new Hello();
4 h.show(null);
5 }
6 }
7 class Hello{
8
9 public void show(int x[]){
10 System.out.println("int x[]");
11 }
12 public void show(String str){
13 System.out.println("string");
14 }
15 }
16

Options Response Answer

int x[]

string

null

ambiguity error

Runtime Exception

29 / 63
Question 33: Time: 1 Min 38 Sec Marks: 1/ 1

What will be the output of the following program ?


1 public class qq16{


2 public static void main(String as[]){
3 StringBuffer sb =new StringBuffer("a");
4 sb.append("12345678912345678");
5 System.out.println(sb.length());
6 System.out.println(sb.capacity());
7 }
8 }
9

Options Response Answer

17 17

18 18

18 16

17 36

18 36

Question 34: Time: 40 Sec Marks: 0/ 1

What will be the outcome when the given code is compiled and run?

1 class Hello{
2 public static void m1(){
3 System.out.println("M1 in Hello");
4 }
5 }
6 class hai extends Hello{
7 public void m1() throws ClassCastException{
8 System.out.println("M1 in hi");
9 }
10 }
11 public class qq31{
12 public static void main(String as[]){
13 Hello h = new hai();
14 h.m1();
15 }
16 }
17

30 / 63
Options Response Answer

M1 in Hello

M1 in hi

M1 in Hello M1 in hi

Compilation fails

Unreported
Exception

Question 35: Time: 55 Sec Marks: 1/ 1

What will be the outcome when the given code is compiled and run?

1 public class qq38{


2 int x =12;
3 public void method(int x){
4 x+=x;
5 System.out.println(x);
6 }
7 public static void main(String as[]){
8 qq38 t =new qq38();
9 t.method(5);
10 System.out.println(t.x);
11 }
12 }
13

Options Response Answer

17 17

17 12

10 12

24 17

24 10

Question 36: Time: 29 Sec Marks: 1/ 1

31 / 63
What would be the output of the following code?

1 public class Test implements Runnable


2 {
3 private int x;
4 private int y;
5
6 public static void main(String [] args)
7 {
8 Test test = new Test();
9 (new Thread(test)).start( ); /* Line 9 */
10 (new Thread(test)).start( ); /* Line 10 */
11 }
12 public synchronized void run( ) /* Line 12 */
13 {
14 for (;;) /* Line 14 */
15 {
16 x++;
17 y++;
18 System.out.println("x = " + x + "y = " + y);
19 }
20 }
21 }
22

Options Response Answer

An error at line 12 causes compilation


to fail

Errors at lines 9 and 10 cause


compilation to fail

The program prints pairs of values for x


and y that might not always be the
same on the same line (for example,
"x=2, y=1")

The program prints pairs of values for x


and y that are always the same on the
same line (for example, "x=1, y=1"). In
addition, each value appears once (for
example, "x=1, y=1" followed by "x=2,
y=2")

Question 37: Time: 1 Min 0 Sec Marks: 0/ 1

32 / 63
What would be the output of the following code?

1 class Example extends Thread


2 {
3 Example()
4 {
5 System.out.println("Example");
6 }
7 public void run(String s)
8 {
9 System.out.println("baz");
10 }
11 public void run()
12 {
13 System.out.println("bar");
14 }
15 }
16 public class Test
17 {
18 public static void main(String[] args)
19 {
20 Example t = new Example()
21 {
22 public void run()
23 {
24 System.out.println("foo");
25 }
26 };
27


t.start();
}
}

Options Response Answer

foo

Example
foo

Example
baz

Example
bar

Question 38: Time: 1 Min 21 Sec Marks: 0/ 1

33 / 63
What would be the output on running the following code?

1
2 class Parent {
3 Child display(int i) {//line 2
4 System.out.println("Parent");
5 return null;
6 }
7 }
8
9 class Child extends Parent {
10 Parent display(int i){//line 9
11 System.out.println("Child");
12 return null;
13 }
14 public static void main(String[] args) {
15 Parent p = new Child();
16 p.display(5);
17 }
18 }
19

Options Response Answer

Parent

Child

Compile-time exception, as the return


type in lines 2 and 9 are incompatible

NullPointer exception

Question 39: Time: 2 Min 39 Sec Marks: 0/ 1

Given that name of the PlatformTransactionManager bean is "transactionManager" which annotations are required to switch on
transactions support in following test?

1
2 @RunWith(SpringJUnit4ClassRunner.class)
3 @ContextConfiguration
4 public class DaoTest {
5 //test methods
6 }
7

34 / 63
Options Response Answer

@Transactional

@TransactionConfiguration(transaction
Manager = "transactionManager")

@TestExecutionListeners({Transaction
alTestExecutionListener.class})

None of the above

Answer Explanation

null

Question 40: Time: 39 Sec Marks: 0/ 1

Suppose we have an aspect:


1
2 @Before("execution(* method*()")
3
4
5 and the following class:
6
7 public class MyClass() {
8 public void method1() {
9 method2();
10 }
11 public void method2() {
12 }
13 }
14
15
16


If we call, myClass.method1(), from another class, which methods does the advice run against?

Options Response Answer

method1

method2

both

neither

35 / 63
Answer Explanation

null

Question 41: Time: 32 Sec Marks: 1/ 1

Given two transactions:

T1
1. SELECT * FROM EVENTS
4. SELECT * FROM EVENTS

and T2
2. INSERT INTO EVENTS VALUES (...)
3. COMMIT

SQL queries are performed in order 1, 2, 3, 4


Which isolation level is needed to prevent Phantom reads ?

Options Response Answer

READ_UNCOMMITTED

READ_COMMITTED

REPEATABLE_READ

SERIALIZABLE

Answer Explanation

null

Question 42: Time: 50 Sec Marks: 1/ 1

What are the ways offered by spring to construct the following interdependent objects?

1
2 class ObjectOne {
3 ObjectTwo ref;
4 public ObjectOne(ObjectTwo two) { } }
5 class ObjectTwo {
6 ObjectOne ref;
7 public ObjectTwo(ObjectOne two) { } }
8

36 / 63
Options Response Answer

Use the constructor Injection

Define a no-args constructor and the


use a constructor injection

Re-factor and use setter injection

Re-factor and use method injection

Re-factor and use field injection

Answer Explanation

NULL

Question 43: Time: 1 Min 57 Sec Marks: 1/ 1

In your web.xml, what is the required name of the security filter?


1
2 <filter>
3 <filter-name>_______________</filter-name>
4 <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
5 </filter>
6
7

Options Response Answer

securityFilterChain

securitySpringFilterChain

springSecurityFilter

springSecurityFilterChain

none of the above

Answer Explanation

null

Question 44: Time: 1 Min 0 Sec Marks: 1/ 1

37 / 63
Using Spring how can we achieve Java serialization via HTTP?

Options Response Answer

Using HTTPRequest / HTTPResponse

Remote Method Invocation (RMI)

HttpInvokerProxyFactoryBean/HttpInvo
kerServiceExporter

HTTPSession

None of these

Answer Explanation

null

Question 45: Time: 1 Min 30 Sec Marks: 0/ 1

Which of the following are valid ways to run the following query in Spring?

String sql = select max(myVarCharColumn) from table

Options Response Answer

String result =
jdbcTemplate.queryForInt(sql);

String result =
jdbcTemplate.queryForString(sql);

String result =
jdbcTemplate.queryForObject(sql);

String result = (String)


jdbcTemplate.queryForObject(sql);

Answer Explanation

null

38 / 63
Question 46: Time: 1 Min 29 Sec Marks: 1/ 1

Which of the following is a method of class jmsTemplate

Options Response Answer

void convertAndSend(Destination
destination,Object message)

String
buildExceptionMessage(JMSException
e)

void commitIfNecessary(Session
session)

All of the above

Answer Explanation

null

Question 47: Time: 28 Sec Marks: 0/ 1

39 / 63
What is the output of the following program?

1 class ThreadDemo implements Runnable


2 { static Boolean A1=true;
3 static Boolean A2=true;
4
5 public static void main(String[] args) {
6 try{
7 Thread tobj1 = new Thread(new ThreadDemo());
8 tobj1.start();
9 Thread tobj2 = new Thread(new ThreadDemo());
10 tobj2.start();
11 }catch(Exception e)
12 {
13 System.out.println(e);
14 }
15 }
16
17 public synchronized void run() {
18 for (int i = 0; i < 1; i++) {
19 if (A1)
20 {System.out.println(Thread.currentThread().getName() + "\t is active");
21 A1= false;
22 A2= true;
23 }
24 if (A2)
25 { System.out.println(Thread.currentThread().getName() +" \t is active");
26 A2= false;
27 A1= true;
28 }
29 try {
30 Thread.sleep(100);
31 } catch (Exception e) {
32 System.out.println(e);
33 }
34 }
35 }
36 }
37

Options Response Answer

output is
Thread-0 is active
Thread-0 is active
Thread-1 is active
Thread-1 is active

output is
Thread-0 is active
Thread-1 is active
Thread-1 is active
Thread-0 is active

either choice 1 or choice 2

can not be determined

40 / 63
Question 48: Time: 33 Sec Marks: 1/ 1

What is the output of the following program?


1 class ThreadDemo extends Thread implements Runnable


2 { public static void main(String[] args) {
3 try{
4 Thread tj = new Thread(new ThreadDemo());
5
6 tj.start();
7 }catch(Exception e)
8 {
9 System.out.println(e);
10 }
11 }
12 }
13

Options Response Answer

code does not compile

compiles with warnings

compiles without any warning

none of the above

Question 49: Time: 20 Sec Marks: 0/ 1

41 / 63
What is the output of the following program?

1 class big extends Thread


2 {
3 public big(Runnable ren)
4 {
5 super(ren);
6 }
7 public void run()
8 {
9 System.out.print("big");
10 }
11 }
12 class small extends Thread
13 {
14 public void run()
15 {
16 System.out.print("small");
17 }
18 }
19 class ThreadDemo {
20 public static void main(String[] args) {
21 Thread t1= new big(new small());
22 t1.start();
23 }
24 }
25

Options Response Answer

output is small

output is big

output is big small

output is small big

compilation error

Question 50: Time: 52 Sec Marks: 1/ 1

42 / 63
What is the output of the following program?

1
2 public class ThreadDemo implements Runnable {
3 public static void main(String[] args) {
4
5 Thread tobj1 = new Thread(new ThreadDemo());
6 tobj1.setName("POLO-1");
7 tobj1.setPriority(10);
8 tobj1.start();
9
10 Thread tobj2 = new Thread(new ThreadDemo());
11 tobj2.setName("POLO-2");
12 tobj2.setPriority(1);
13 tobj2.start();
14 }
15
16 public void run() {
17 for (int i = 0; i < 5; i++) {
18
19 System.out.println(Thread.currentThread().getName() + " " + i);
20 try {
21 Thread.sleep(100);
22 } catch (Exception e) {
23 System.out.println(e);
24 }
25 }
26 }
27 }
28
29
30

Options Response Answer

43 / 63
output will be

POLO-1 0

POLO-2 0

POLO-1 1

POLO-2 1

POLO-1 2

POLO-2 2

POLO-2 3

POLO-1 3

POLO-1 4

POLO-2 4

output will be

POLO-1 0

POLO-2 0

POLO-1 1

POLO-2 1

POLO-1 2

POLO-2 2

POLO-1 3

POLO-2 3

POLO-1 4

POLO-2 4

44 / 63
output will be

POLO-2 0

POLO-1 0

POLO-2 1

POLO-1 1

POLO-2 2

POLO-1 2

POLO-2 3

POLO-1 3

POLO-2 4

POLO-1 4

Can not be determined

None of the above

Question 51: Time: 56 Sec Marks: 1/ 1

45 / 63
What would be the output of the following code?

1 import java.util.HashSet;
2 import java.util.Iterator;
3 import java.util.Set;
4
5 class Test{
6 Integer id;
7 Test(int id){
8 this.id = id;
9 }
10 public String toString() {
11 return this.id.toString();
12 }
13 public int hashCode() {
14 int result = 1;
15 result = 31 + ((id == null) ? 0 : id.hashCode());
16 return result;
17 }
18 public static void main(String[] args) {
19 Set s = new HashSet();
20 Test t1 = new Test(1);
21 Test t2 = new Test(1);
22 Test t3 = new Test(2);
23 s.add(t1);
24 s.add(t2);
25 s.add(t3);
26 System.out.println(s.size());
27 Iterator iter = s.iterator();
28 while(iter.hasNext())
29 System.out.println(iter.next());
30 }
31 }
32

Options Response Answer

2
1
2

2
1
1
2

3
1
2

3
1
1
2

46 / 63
Question 52: Time: 1 Min 9 Sec Marks: 1/ 1

What would be the output of the following program?


1
2 import java.util.TreeMap;
3 import java.util.Iterator;
4 import java.util.Map;
5 import java.util.Set;
6
7 class Test implements Comparable{
8 public int hashCode() {
9 int result = 1;
10 result = 31 + ((id == null) ? 0 : id.hashCode());
11 return result;
12 }
13 public Boolean equals(Object obj) {
14 Test other = (Test) obj;
15 Boolean ret = false;
16 if(other.id.equals(this.id))
17 ret = true;
18 return ret;
19 }
20 Integer id;
21 Test(int id){
22 this.id= id;
23 }
24 public String toString() {
25 return this.id.toString();
26 }
27 public static void main(String[] args) {
28 Test t1 = new Test(1);
29 Test t2 = new Test(1);
30 Map m = new TreeMap();
31 m.put(t1, 1);
32 m.put(t2, 1);
33 System.out.println(m.size());
34 Set s = m.keySet();
35 Iterator iter = s.iterator();
36 while(iter.hasNext())
37 System.out.println(iter.next());
38 }
39 public int compareTo(Object o) {
40 return this.id.compareTo(((Test)o).id);
41 }
42 }
43

47 / 63
Options Response Answer

2
1
1

2
1

1
1

Runtime exception

Question 53: Time: 1 Min 25 Sec Marks: 1/ 1

48 / 63
What would be the output of the following program?

1 import java.util.Iterator;
2 import java.util.Set;
3 import java.util.TreeSet;
4
5 class Test implements Comparable{
6 Integer id;
7 Test(int id){
8 this.id = id;
9 }
10 public String toString() {
11 return this.id.toString();
12 }
13 public int hashCode() {
14 int result = 1;
15 result = 31 + ((id == null) ? 0 : id.hashCode());
16 return result;
17 }
18 @Override
19 public Boolean equals(Object obj) {
20 return this.id.equals(((Test)obj).id);
21 }
22 public static void main(String[] args) {
23 Set s = new TreeSet();
24 Test t1 = new Test(1);
25 Test t3 = new Test(2);
26 s.add(t1);
27 s.add(t3);
28 System.out.println(s.size());
29 Iterator iter = s.iterator();
30 while(iter.hasNext())
31 System.out.println(iter.next());
32 }
33 @Override
34 public int compareTo(Object o) {
35 return 0;
36 }
37 }
38

Options Response Answer

2
1
2

2
2
1

1
1

1
2

49 / 63
Question 54: Time: 39 Sec Marks: 0/ 1

What would be the output of the following program?


1 import java.util.Iterator;
2 import java.util.Set;
3 import java.util.TreeSet;
4
5 class Test{
6 Integer id;
7 Test(int id){
8 this.id = id;
9 }
10 public String toString() {
11 return this.id.toString();
12 }
13 public int hashCode() {
14 int result = 1;
15 result = 31 + ((id == null) ? 0 : id.hashCode());
16 return result;
17 }
18 @Override
19 public Boolean equals(Object obj) {
20 return this.id.equals(((Test)obj).id);
21 }
22 public static void main(String[] args) {
23 Set s = new TreeSet();
24 Test t1 = new Test(1);
25 Test t3 = new Test(2);
26 s.add(t1);
27 s.add(t3);
28 System.out.println(s.size());
29 Iterator iter = s.iterator();
30 while(iter.hasNext())
31 System.out.println(iter.next());
32 }
33 }
34
35

Options Response Answer

2
1
2

2
2
1

The output cannot be predicted

java.lang.ClassCastException will
come at runtime

50 / 63
Question 55: Time: 24 Sec Marks: 1/ 1

Choose the correct option


The MIME types that REST supports are:

Options Response Answer

(XML, Text, JSON, user-defined

(XML, JSP, JSON, user-defined

(XSLT, Text, JSP, user-defined

(XSLT, JSP, JSON, XML

Answer Explanation

null

Question 56: Time: 1 Min 20 Sec Marks: 1/ 1

Choose the correct option


Which of the following provides stronger typing with data types?

Options Response Answer

REST

SOAP

HTTP

All of the above

Answer Explanation

null

Question 57: Time: 55 Sec Marks: 0/ 1

Choose the correct option


Which of the following is the correct implementation of a DELETE method?

51 / 63
Options Response Answer

1 @DELETE
2 @class("{empId}")
3 public void deleteEmployee(@PathParam("empId") int empId)
4 {
5
6
7 }
8

1 @DELETE
2 @Path("{empId}")
3 public void deleteEmployee(@PathParam("empId") int empId)
4 {
5
6
7 }
8

1 @DELETE
2 @Class("{empId}")
3 public void deleteEmployee(@classParam("empId") int empId)
4 {
5
6
7 }
8

None of the above

Question 58: Time: 8 Min 39 Sec Marks: 1/ 1

Which of the following companies already have a set of public REST Web services available?

1. Amazon
2. Google
3. O'Reillys Meerkat
4. Flickr
5. Yahoo

52 / 63
Options Response Answer

Option 1, 2, 4, 5 are correct and Option


3 is incorrect

Option 1, 2 are correct and Option 3, 4,


5 are incorrect

Option 2, 4, 5 are correct and Option 1,


3 are incorrect

All the options are correct

Question 59: Time: 30 Sec Marks: 1/ 1

While creating a JAX-RS (RESTful) Web Service, which of the following statements describes the role of using JAXB?

1. JAXB is used to marshal and unmarshal your XML documents


2. JAXB is used to generate the XML schema definition
3. JAXB can be used to generate Java source files
4. JAXB annotations can be used

Options Response Answer

Statements 1, 2 are correct and


Statements 3, 4 are incorrect

Statements 3, 4 are correct and


Statements 1, 2 are incorrect

Staements 1, 2, 3 are correct and


statement 4 is incorrect

All the statements are correct

Question 60: Time: 1 Min 34 Sec Marks: 1/ 1

Choose the correct option


Which of the following codes is a sample structure of a SOAP message?

53 / 63
Options Response Answer

1 <?xml version="1.0"?>
2 <soap:Envelope>
3 xmnls :soap = "http://www.w3.org/2001/12/soap-envelope"
4 soap:encodingStyle=" http://www.w3.org/2001/12/soap-encoding"
5 < soap:Header>
6 â​ ¦â​ ¦â​ ¦
7 < /soap: Header >
8 <soap : Fault >
9 â​ ¦â​ ¦..
10 <soap: Body >
11 â​ ¦â​ ¦â​ ¦â​ ¦
12 < /soap: Body >
13 < /soap:Fault >
14 </soap:Envelope>
15

1 <?xml version="1.0"?>
2 <soap:Envelope>
3 xmnls :soap = "http://www.w3.org/2001/12/soap-envelope"
4 soap:encodingStyle=" http://www.w3.org/2001/12/soap-encoding"
5 < soap:Header>
6 â​ ¦â​ ¦â​ ¦
7 < /soap: Header >
8 <soap : Body >
9 â​ ¦â​ ¦..
10 <soap: Fault >
11 â​ ¦â​ ¦â​ ¦â​ ¦
12 < /soap: Fault >
13 < /soap: Body >
14 </soap:Envelope>
15

1 <?xml version="1.0"?>
2 <soap:Envelope>
3 xmnls :soap = "http://www.w3.org/2001/12/soap-envelope"
4 soap:encodingStyle=" http://www.w3.org/2001/12/soap-encoding"
5 < soap:Envelope>
6 â​ ¦â​ ¦â​ ¦
7 < /soap: Envelope>
8 <soap : Body >
9 â​ ¦â​ ¦..
10 <soap: Fault >
11 â​ ¦â​ ¦â​ ¦â​ ¦
12 < /soap: Fault >
13 < /soap: Body >
14 </soap:Header>
15

None of the above

Answer Explanation

null

54 / 63
Question 61: Time: 2 Min 29 Sec Marks: 1/ 1

In Decorator Pattern as we use inheritance to achieve type matching of decorator classes with ConcreteComponent class,
what do we use to get the behavior of decorator classes.

Options Response Answer

Inheritance

Aggregation

Composition

Generalization

Question 62: Time: 1 Min 57 Sec Marks: 1/ 1

Let there be an application showing a JFrame(like a pop up window) instance (J1) with a button, clicking on which creates
another JFrame instance (J2) with some text. Every time the button is clicked a new JFrame instance (similar to J2) appears
with the text. Which design pattern among the following can be used in order to ensure that same JFrame instance (J2) is
shown every time the button on JFrame (J1) is clicked?

Options Response Answer

Adapter

Template

Singleton

Observer

Question 63: Time: 2 Min 33 Sec Marks: 1/ 1

Factory design pattern depends upon __________ and do not depends upon _________

55 / 63
Options Response Answer

Abstraction, Concrete classes

Abstraction, Interface

Interface, Object Creation

Object Creation, Abstraction

Answer Explanation

Question 64: Time: 31 Sec Marks: 0/ 1

Which of the following statements is true?

Options Response Answer

MVC decouples Views and models


using a subscriber/notify protocol i.e.
the Observer pattern.

Views are generally nested using a


factory design pattern.

The controller in MVC are generally


heavy since they are responsible for
controlling the operations of the Views
and models.

MVC was a framework invented in


1980s and was used in legacy systems
and is no longer relevant for mobile and
web applications.

Answer Explanation

Question 65: Time: 40 Sec Marks: 0/ 4

56 / 63
Which of the following is not a major design consideration for the system?

Options Response Answer

Response time required

Frequency of record updates

Availability of technically qualified


personnel to carry out design and
development

Data integrity constant

All of the given options

Question 66: Time: 48 Sec Marks: 0/ 4

Mr X wants to find out if his program will execute forever if it runs. Which of the following statements is correct if he wants to test
his program to find out whether his program will execute forever or not?

Options Response Answer

He may never be able to decide in finite


amount of time if the program will
execute forever

He can find out the answer if he runs


enough test cases

He has to be clever in the design of test


cases

He can easily decide in finite amount of


time if the program will execute forever

All of the given options

Question 67: Time: 31 Sec Marks: 3/ 3

Which of the following is the most important feature of spiral model?

57 / 63
Options Response Answer

Quality management

Risk management

Performance management

Efficiency management

All of the given options

Question 68: Time: 1 Min 7 Sec Marks: 4/ 4

Where will @Ignore annotation be applied so that the code compiles?

58 / 63
Options Response Answer

1 import org.junit.Test;
2 import org.junit.Ignore;
3 import static org.junit.Assert.assertEquals;
4 public class TestJunit {
5 String message = "Metl";
6 MessageUtil messageUtil = new MessageUtil(message);
7 @Ignore
8 @Test
9 public void testPrintMessage() {
10 System.out.println("Inside testPrintMessage()");
11 message = "Metl";
12 assertEquals(message,messageUtil.printMessage());
13 }
14

1 import org.junit.Test;
2 import org.junit.Ignore;
3 import static org.junit.Assert.assertEquals;
4 public class TestJunit {
5 String message = "Metl";
6 MessageUtil messageUtil = new MessageUtil(message);
7
8 public void @Ignore.testPrintMessage() {
9 System.out.println("Inside testPrintMessage()");
10 message = "Metl";
11 assertEquals(message,messageUtil.printMessage());
12 }
13

1 import org.junit.Test;
2 import org.junit.Ignore;
3 import static org.junit.Assert.assertEquals;
4 public class TestJunit {
5 String message = "Metl";
6 MessageUtil messageUtil = new MessageUtil(message);
7
8 public void testPrintMessage() {
9 System.out.println("Inside testPrintMessage(@ignore)");
10 message = "Metl";
11 assertEquals(message,messageUtil.printMessage());
12 }
13

None of the given options

Answer Explanation

null

Question 69: Time: 1 Min 4 Sec Marks: 0/ 4

59 / 63
Which of the following codes will be written to define the two test classes that are executed?

Options Response Answer

1 package com.xyz.junit.first;
2
3 import org.junit.runner.RunWith;
4 import org.junit.runners.Suite;
5 import org.junit.runners.Suite.SuiteClasses;
6
7 @RunWith(Suite.class)
8 @SuiteClasses({ My1ClassTest.class, My2ClassTest.class })
9

1 package com.xyz.junit.first;
2
3 import org.junit.runner.RunWith;
4 import org.junit.runners.Suite;
5
6 @RunWith(Suite.class)
7 @SuiteClasses({ My1ClassTest.class, My2ClassTest.class })
8 public class AllTests {
9
10 }
11

1 package com.xyz.junit.first;
2
3 import org.junit.runner.RunWith;
4 import org.junit.runners.Suite;
5 import org.junit.runners.Suite.SuiteClasses;
6
7 ({ My1ClassTest.class, My2ClassTest.class })
8 public class AllTests;
9

1 package com.xyz.junit.first;
2
3 import org.junit.runner.RunWith;
4 import org.junit.runners.Suite;
5 import org.junit.runners.Suite.SuiteClasses;
6
7 @RunWith(Suite.class)
8 @SuiteClasses({
9 My1ClassTest.class, My2ClassTest.class })
10 public class AllTests {}
11

Answer Explanation

null

60 / 63
Question 70: Time: 21 Sec Marks: 3/ 3

What are the different views being considered while creating Object oriented software system?

Options Response Answer

use case view

design view

process view

implementation and deployment view

all of these

Question 71: Time: 1 Min 24 Sec Marks: 3/ 3

______ are not only used for visualizing dynamic nature of a system but are also used to construct the executable system by
using forward and reverse engineering techniques?

Options Response Answer

use case diagrams

activity diagrams

state diagrams

none of these

Question 72: Time: 2 Min 6 Sec Marks: 3/ 3

61 / 63
What will the following command do?

node <- xmlNode("arg", xmlNode("name", "foo"), namespace="R")

Options Response Answer

Create an XML node

Define an XML node

Create an XML node for some


specified node

Define namespace for an XML node

Question 73: Time: 44 Sec Marks: 3/ 3

Which of the following statements is true for SMIL?

Options Response Answer

SMIL is used to describe available web


services.

SMIL is used as markup languages for


handheld devices.

SMIL is used to describe resources and


ontology.

SMIL is used to describe multimedia for


the web.

SMIL is used for news feeds.

Question 74: Time: 5 Min 18 Sec Marks: 0/ 3

62 / 63
The new assertEquals methods use Autoboxing, hence the assertEquals is tested as which of the following options?

Options Response Answer

assertEquals(primitive, primitive)

assertEquals(Object, Object)

assertEquals(primitive, Object)

assertEquals(Object, primitive)

Answer Explanation

null

Test Log

07 Mar,2018

10:15 pm Started the test with Java


11:53 pm Finished the test

63 / 63

You might also like