Summer Special Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: buysanta

Exact2Pass Menu

Question # 4

Given:

And:

What is the result?

A.

ns = 100 s =125

ns = 0 s = 125

ns = 125 s = 125

B.

ns = 50 s = 50

ns = 125 s = 125

ns = 0 s = 125

C.

ns = 50 s = 125 ns = 125 s = 125

ns = 0 s = 125

D.

ns = 50 s = 50 ns = 125 s =125

ns = 100 s =100

Full Access
Question # 5

Given:

And given the commands:

What is the result?

A.

Java SE

B.

Java EE

C.

Compilation fails at line n1.

D.

A NullPointerException is thrown at runtime.

Full Access
Question # 6

Given the code fragment:

What is the result?

A.

1 2 3 0 01 2 3 0 0

B.

An Exception is thrown at run time.

C.

1 2 3 0 01 2 3

D.

1 2 31 2 3

Full Access
Question # 7

Which two array initialization statements are valid? (Choose two.)

A.

int array[] = new int[3] {1, 2, 3};

B.

int array[] = new int[3]; array[0] = 1;

array[1] = 2;

array[2] = 3;

C.

int array[3] = new int[] {1, 2, 3};

D.

int array[] = new int[3]; array = {1, 2, 3};

E.

int array[] = new int[] {1,2,3};

Full Access
Question # 8

Which two are benefits of polymorphism? (Choose two.)

A.

Faster code at runtime

B.

More efficient code at runtime

C.

More dynamic code at runtime

D.

More flexible and reusable code

E.

Code that is protected from extension by other classes

Full Access
Question # 9

Which statement is true about the switch statement?

A.

It must contain the default section.

B.

The break statement, at the end of each case block, is mandatory.

C.

Its case label literals can be changed at runtime.

D.

Its expression must evaluate to a single value.

Full Access
Question # 10

Given:

And given the commands:

What is the result?

A.

1 null

B.

true false

C.

false false

D.

true true

E.

A ClassCastException is thrown at runtime.

Full Access
Question # 11

Which statement is true about Java byte code?

A.

It can run on any platform.

B.

It can run on any platform only if it was compiled for that platform.

C.

It can run on any platform that has the Java Runtime Environment.

D.

It can run on any platform that has a Java compiler.

E.

It can run on any platform only if that platform has both the Java Runtime Environment and a Java compiler.

Full Access
Question # 12

Given the code fragment:

Test.java:

Which is the result?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Full Access
Question # 13

Given the code fragment:

What is the result?

A.

1 2 3 0 01 2 3 0 0

B.

An Exception is thrown at run time.

C.

1 2 3 0 01 2 3

D.

1 2 31 2 3

Full Access
Question # 14

Which two initialization statements are valid? (Choose two.)

A.

Boolean available = “TRUE”:

B.

String tmpAuthor = author, author =”Mc Donald”;

C.

Double price = 200D;

D.

Integer pages = 20;

Full Access
Question # 15

Given the code fragment:

What is the result?

A.

3142

B.

2413

C.

1324

D.

4231

Full Access
Question # 16

Which statement is true about the main() method?

A.

It is invoked by JRE

B.

It is a final method

C.

It returns true if it is executed successfully at run time

D.

It must be defined within a public class

Full Access
Question # 17

Given:

What is the result?

A.

9 5

B.

81 25

C.

Compilation fails.

D.

0 0

Full Access
Question # 18

Given the code fragment:

What is the result?

A.

An exception is thrown at runtime.

B.

2014-07-31T01:01:00

C.

2014-07-31

D.

2014-09-30T00:00:00

Full Access
Question # 19

Given the definitions of the Bird class and the Peacock class:

and the code fragment:

Which code snippet can be inserted to print Fly.Dance. ?

A.

Bird p = new Peacock();

B.

Bird b = new Bird();Peacock p = (Peacock) b;

C.

Peacock b = new Peacock ();Bird p = (Bird) b;

D.

Bird b = new Peacock ();Peacock p = (Peacock) b;

Full Access
Question # 20

Given:

What is the result?

A.

AB

B.

AC

C.

CC

D.

A ClassCastException is thrown only at line n1.

E.

A ClassCastException is thrown only at line n2.

Full Access
Question # 21

Given:

What is the result?

A.

3 4 5 6

B.

3 4 3 6

C.

5 4 5 6

D.

3 6 4 6

Full Access
Question # 22

Given this array:

Which two code fragments, independently, print each element in this array? (Choose two.)

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

F.

Option F

Full Access
Question # 23

Given the code fragment:

What is the result?

A.

A B C

B.

A B C D E

C.

A B D E

D.

Compilation fails.

Full Access
Question # 24

Given:

And given the code fragment:

What is the result?

A.

300:300200:300

B.

300:100200:300

C.

300:00:300

D.

100:300300:200

Full Access
Question # 25

Given the code fragment:

What is the result?

A.

It results in a compile time error at line 18.

B.

It results in a compile time error at line 9.

C.

It prints : 1

D.

It results in a compile time error at lines at lines 12 and 15.

Full Access
Question # 26

Given:

What is the result?

A.

10:20

B.

0:20

C.

Compilation fails at line n1

D.

Compilation fails at line n2

Full Access
Question # 27

Given the code from the Greeting.Java file:

Which set of commands prints Hello Duke in the console?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 28

Given:

What is the result?

A.

null:null:0.0

B.

null:null

C.

<>:0.0

D.

null:0.0

Full Access
Question # 29

Given the code fragment:

Which code fragment, when inserted at line n1, enables the App class to print Equal?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 30

Given the following main method:

What is the result?

A.

5 4 3 2 1 0

B.

5 4 3 2 1

C.

4 2 1

D.

5

E.

Nothing is printed

Full Access
Question # 31

Given the code fragment:

What is the result?

A.

1324

B.

2313

C.

3142

D.

4231

Full Access
Question # 32

Given the code fragment:

What is the result?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 33

Given:

What is the result?

A.

Good Luck!

B.

Good Day!

C.

Welcome!

D.

Hello!

Full Access
Question # 34

Which three are advantages of the Java exception mechanism? (Choose three.)

A.

Improves the program structure because the error handling code is separated from the normal program function

B.

Provides a set of standard exceptions that covers all possible errors

C.

Improves the program structure because the programmer can choose where to handle exceptions

D.

Improves the program structure because exceptions must be handled in the method in which they occurred

E.

Allows the creation of new exceptions that are customized to the particular program being created

Full Access
Question # 35

Given the code fragment:

What is the result?

A.

A NullPointerException is thrown at runtime.

B.

[1, 2, 4]

C.

[1, 2, 4, null]

D.

[1, 3, 4, null]

E.

[1, 3, 4]

F.

Compilation fails.

Full Access
Question # 36

Given:

What is the result?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 37

Given:

What is the result?

A.

BaseDerivedA

B.

BaseDerivedB

C.

DerivedBDerivedB

D.

DerivedBDerivedA

E.

A ClassCastException is thrown at runtime.

Full Access
Question # 38

Given:

What is the result? A. 0:0

100:0

B.null:0

100:0

C.0:0

100:200

D.null:null 100:null

Full Access
Question # 39

Which two code fragments cause a compilation error? (Choose two.)

A.

float flt = 100.00F;

B.

float flt = (float) 1_11.00;

C.

Float flt = 100.00;

D.

double y1 = 203.22;float flt = y1;

E.

int y2 = 100;float flt = (float) y2 ;

Full Access
Question # 40

Given the code fragment:

What is the result?

A.

[Robb, Rick, Bran]

B.

[Robb, Rick]

C.

[Robb, Bran, Rick, Bran]

D.

An exception is thrown at runtime.

Full Access
Question # 41

Given:

and the code fragment:

What is the result?

A.

true:false:true

B.

false:true:true

C.

false:true:false

D.

true:true:false

Full Access
Question # 42

Given:

What is the result?

A.

97 9899 100 null null null

B.

97 9899 100 101 102 103

C.

Compilation fails.

D.

A NullPointerException is thrown at runtime.

E.

An ArraylndexOutOfBoundsException is thrown at runtime.

Full Access
Question # 43

Given the code fragments:

What is the result?

A.

Compilation fails only at line n2.

B.

RTool::exportTool::export

C.

Tool::exportTool:export

D.

Compilation fails only at line n1.

E.

Compilation fails at both line n1 and line n2.

Full Access
Question # 44

Given the code fragment:

Which two code fragments can be independently inserted at line n1 to enable the code to print the elements of the array in reverse order? (Choose two.)

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Full Access
Question # 45

Given the class definitions:

class C1 {}

class C2 extends C1 {}

class C3 extends C2 {}

and the code fragment:

16.C1 obj1 = (C1) new C2();

17.C2 obj2 = (C2) new C3();

18.C2 obj3 = (C2) new C1();

19.C3 obj4 = (C3) obj2;

Which line throws ClassCastException?

A.

line 18

B.

line 17

C.

line 19

D.

line 16

Full Access
Question # 46

Given:

What is the result?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 47

Given:

What is the result?

A.

Good Luck!

B.

Good Day!

C.

Welcome!

D.

Hello!

Full Access
Question # 48

Given this segment of code:

Which two statements, if either were true, would make the code compile? (Choose two.)

A.

MotorCycle is an interface that implements the Cycle class.

B.

Cycle is an interface that is implemented by the MotorCycle class.

C.

Cycle is an abstract superclass of MotorCycle.

D.

Cycle and MotorCycle both extend the Transportation superclass.

E.

Cycle and MotorCycle both implement the Transportation interface.

F.

MotorCycle is a superclass of Cycle.

Full Access
Question # 49

Given the following main method:

What is the result?

A.

5 4 3 2 1 0

B.

5 4 3 2 1

C.

4 2 1

D.

5

E.

Nothing is printed

Full Access
Question # 50

Given:

What is the result?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 51

Given the code fragment:

Which modification enables the code fragment to print TrueDone?

A.

Replace line 5 With String opt = "true";Replace line 7 with case "true":

B.

Replace line 5 with boolean opt = l;Replace line 7 with case 1:

C.

At line 9, remove the break statement.

D.

Remove the default section.

Full Access
Question # 52

Given:

And the code fragment:

Which code fragment, when inserted at line 14, enables the code to print Mike Found?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 53

Given this class:

And given this main method, located in another class:

Which three lines, when inserted independently at line n1, cause the program to print a 0 balance?

A.

acct.setAmount(-acct.getAmount());

B.

acct.amount = 0;

C.

acct.setAmount(0);

D.

acct.getAmount() = 0;

E.

this.amount = 0;

F.

acct.changeAmount(0);

G.

acct.changeAmount(-acct.amount);

Full Access
Question # 54

Given:

And given the commands:

What is the result?

A.

Success

B.

Failure

C.

Compilation fails.

D.

An exception is thrown at runtime

Full Access
Question # 55

Given the code fragment:

What is the result?

A.

100

B.

101

C.

102

D.

103

E.

Compilation fails

Full Access
Question # 56

Given the code fragment:

Which three lines fail to compile? (Choose three.)

A.

Line 7

B.

Line 8

C.

Line 9

D.

Line 10

E.

Line 11

F.

Line 12

Full Access
Question # 57

Given:

What is the result?

A.

3 4 5 6

B.

3 4 3 6

C.

5 4 5 6

D.

3 6 5 6

Full Access
Question # 58

This grid shows the state of a 2D array:

The grid is created with this code:

Which line of code, when inserted in place of //line n1, adds an X into the grid so that the grid contains three consecutive Xs?

A.

grid[2][1] = ‘X’;

B.

grid[3][2] = ‘X’;

C.

grid[3][1] = ‘X’;

D.

grid[2][3] = ‘X’;

Full Access
Question # 59

Given:

Which code fragment can replace the if block?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 60

Given the code fragment:

Which modification enables the code fragment to print TrueDone?

A.

Replace line 5 With String opt = "true";Replace line 7 with case "true":

B.

Replace line 5 with boolean opt = l;Replace line 7 with case 1:

C.

At line 9, remove the break statement.

D.

Remove the default section.

Full Access
Question # 61

Given the code fragment:

Which code fragment, inserted at line n1, prints The Top element: 30?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Full Access
Question # 62

Given:

What is the result?

A.

true

B.

false

C.

-1

D.

0

Full Access
Question # 63

You are asked to develop a program for a shopping application, and you are given this information:

  • The application must contain the classes Toy, EduToy, and ConsToy. The Toy class is the superclass of the other two classes.
  • The int calculatePrice (Toy t) method calculates the price of a toy.
  • The void printToy (Toy t) method prints the details of a toy.

Which definition of the Toy class adds a valid layer of abstraction to the class hierarchy?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 64

Given these classes:

And given this main method:

Which two options compile when placed at line n1 of the main method? (Choose two.)

A.

director.stockOptions = 1_000;

B.

employee.salary = 50_000;

C.

manager.budget = 1_000_000;

D.

manager.stockOption = 500;

E.

employee.budget = 200_000;

F.

director.salary = 80_000;

Full Access
Question # 65

Given the code fragment:

What is the result?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 66

Given the code fragment:

Which code fragment, when inserted at line n1, enables the App class to print Equal?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 67

Given the code fragment:

Which two modifications, made independently, enable the code to compile? (Choose two.)

A.

Make the method at line n1 public.

B.

Make the method at line n2 public.

C.

Make the method at line n3 public.

D.

Make the method at line n3 protected.

E.

Make the method at line n4 public.

Full Access