Its Java Reviewer
Its Java Reviewer
16q
Number: 98-388
Passing Score: 800
Time Limit: 120 min
File Version: 1.0
98-388
https://www.gratisexam.com/
Sections
1. Understand Java fundamentals
2. Work with data types, variables, and expressions
3. Implement flow control
4. Compile and debug code
https://www.gratisexam.com/
Exam A
QUESTION 1
You have the following code segment. Line numbers are included for reference only.
https://www.gratisexam.com/
A. -44
B. -40.0
C. 40.0
D. 44.0
Correct Answer: B
Section: Understand Java fundamentals
Explanation
Explanation/Reference:
QUESTION 2
You need to analyze the following code segment. Line numbers are included for reference only.
https://www.gratisexam.com/
What is the output of line 12 when you run printInt()?
A. 0
B. 1
C. 2
D. 3
Correct Answer: A
Section: Understand Java fundamentals
Explanation
Explanation/Reference:
QUESTION 3
HOTSPOT
https://www.gratisexam.com/
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
https://www.gratisexam.com/
Correct Answer:
Explanation/Reference:
https://www.gratisexam.com/
References:
https://docs.oracle.com/javase/7/docs/api/java/io/InputStreamReader.html
QUESTION 4
DRAG DROP
You need to evaluate the following Java program. Line numbers are included for reference only.
Which three values will be displayed in sequence? To answer, move the appropriate values from the list of values to the answer area and arrange them in the
correct order.
https://www.gratisexam.com/
Correct Answer:
Explanation/Reference:
QUESTION 5
HOTSPOT
You need to evaluate the following code. Line numbers are included for reference only.
https://www.gratisexam.com/
Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code.
Hot Area:
https://www.gratisexam.com/
Correct Answer:
https://www.gratisexam.com/
Section: Work with data types, variables, and expressions
Explanation
Explanation/Reference:
QUESTION 6
DRAG DROP
https://www.gratisexam.com/
You need to create an int array named numbers initialized with num1, num2, and num3.
How should you complete the code? To answer, drag the appropriate code segment to the correct position. Each code segment may be used once, more than
once, or not at all. You may need to drag the split bar between panes or scroll to view content.
Correct Answer:
Explanation/Reference:
Example:
int[] numbers = new int[] {num1, num2, num3}
References:
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
https://www.gratisexam.com/
https://alvinalexander.com/blog/post/java/java-faq-create-array-int-example-syntax
QUESTION 7
HOTSPOT
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
Correct Answer:
https://www.gratisexam.com/
Section: Work with data types, variables, and expressions
Explanation
Explanation/Reference:
References:
https://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html
https://www.tutorialspoint.com/java/lang/stringbuilder_substring_end.htm
QUESTION 8
DRAG DROP
The method accepts an int value named number, raises the value to the second power, and returns the negative value of the result.
How should you complete the code? To answer, drag the appropriate code segment to the correct position. Each code segment may be used once, more than
once, or not at all. You may need to drag the split bar between panes or scroll to view content.
https://www.gratisexam.com/
Correct Answer:
Explanation/Reference:
QUESTION 9
The question requires that you evaluate the underlined text to determine if it is correct.
You should use an int data type to store the numeric value 3,000,000,000 (3 billion) so that the least amount of memory is used.
Review the underlined text. If it makes the statement correct, select “No change is needed.” If the statement is incorrect, select the answer choice that makes the
statement correct.
A. No change is needed.
B. a short
C. a byte
D. a long
https://www.gratisexam.com/
https://www.gratisexam.com/
Correct Answer: D
Section: Work with data types, variables, and expressions
Explanation
Explanation/Reference:
QUESTION 10
You need to evaluate the following code segment:
Correct Answer: C
Section: Work with data types, variables, and expressions
Explanation
Explanation/Reference:
QUESTION 11
DRAG DROP
https://www.gratisexam.com/
You are writing a Java method.
How should you complete the code? To answer, drag the appropriate code segment to the correct position. Each code segment may be used once, more than
once, or not at all. You may need to drag the split bar between panes or scroll to view content.
Correct Answer:
https://www.gratisexam.com/
Section: Work with data types, variables, and expressions
Explanation
Explanation/Reference:
References:
http://www.tutorialspoint.com/java/java_strings.htm
QUESTION 12
You work as a Java programmer.
A. Double.valueOf(numberString);
B. double.parseDouble(numberString);
C. String.parseDouble(numberString);
D. Double.parseDouble(numberString);
Correct Answer: B
Section: Work with data types, variables, and expressions
Explanation
Explanation/Reference:
References:
https://www.javacodeexamples.com/convert-string-to-primitive-example/140
QUESTION 13
HOTSPOT
You are writing a Java console program. The program accepts command line arguments.
You need to ensure that the main method parses and handles each command line argument.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
https://www.gratisexam.com/
Correct Answer:
https://www.gratisexam.com/
Section: Work with data types, variables, and expressions
Explanation
Explanation/Reference:
QUESTION 14
HOTSPOT
https://www.gratisexam.com/
The method must meet the following requirements:
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
https://www.gratisexam.com/
Correct Answer:
https://www.gratisexam.com/
Section: Implement flow control
Explanation
Explanation/Reference:
https://www.gratisexam.com/
QUESTION 15
DRAG DROP
To open a new account, a user must meet one the following requirements:
How should you complete the code? To answer, drag the appropriate operator to the correct position. Each operator may be used once, more than once, or not at
all. You may need to drag the split bar between panes or scroll to view content.
Correct Answer:
https://www.gratisexam.com/
Section: Implement flow control
Explanation
Explanation/Reference:
References:
https://www.tutorialspoint.com/java/java_basic_operators.htm
QUESTION 16
The question requires that you evaluate the underlined text to determine if it is correct.
The logError method can be invoked by code in all classes in the same package as the Logger class.
Review the underlined text. If it makes the statement correct, select “No change is needed.” If the statement is incorrect, select the answer choice that makes the
statement correct.
A. No change is needed
B. only by the Logger class
C. only by the Logger class and classes in the same package that inherit from it
D. by all classes in all packages
Correct Answer: C
Section: Compile and debug code
Explanation
Explanation/Reference:
https://www.gratisexam.com/
https://www.gratisexam.com/
https://www.gratisexam.com/
Corrections & Comments
QUESTION 1
You need to evaluate the following code segment. Line numbers are included for
reference only.
01 int a = 5;
02 int b = 10;
03 int c = ++a * b--;
04 System.out.println(c);
05 int d = a-- + ++b;
06 System.out.println(d);
Use the drop-down menus to select the answer choice that answers each question based
on the information presented in the code.
ANSWER
45
50
54
60
++a = 6 ; b-- = 10 therefore c = 6 * 10 = 60
What is the output of line 06?
13
14
15
16
a-- = 6 ; ++b = 10 therefore d = 6 + 10 = 16
Postfix vs Prefix - syntax - Is there a difference between x++ and ++x in java? - Stack
Overflow
QUESTION 2
You have the following code segment. Line numbers are included for reference only.
ANSWER
Explanation
number %= -3d; ------> 27%-3d = 0.0
number += 10f; -------> 0.0 + 10f = 10.0
number *= -4; = -------> 10.0 * -4 = -40.0
Java Operators (w3schools.com)
QUESTION 3
You are presented with the following code. Line numbers are included for reference only.
Use the drop-down menus to select the answer choice that answers each question based
on the information presented in the code.
ANSWER
An exception is thrown.
If int is initialized as char, it represents the ascii character value
An exception is thrown.
Dapat 65 lang walang .0..
Long - Stores whole numbers from -9,223,372,036,854,775,808 to
9,223,372,036,854,775,807
What happens when lines 07 and 08 are run?
An exception is thrown.
Dapat -65.0..
What happens when lines 10 and 11 are run?
An exception is thrown.
Short values don’t have decimal places
QUESTION 4
You need to evaluate the following Java program. Line numbers are included for
reference only.
ANSWER
Pi is 3.141593
Pi is 3.142
Pi is 3.14
Pi is 3.1
%.3f%n means that there are 3 decimal places
What is the output of line 04?
Pi is 3.141593
Pi is 0003.141593
Pi is 3
Pi is 3.
%.0f%n means that there are no decimal places
What is the output of line 05?
Pi is 3.141593
Pi is 3.1415930
Pi is 03.141593
Pi is 0000000003.141593
%09f%n means that there are 9 character including dots and spaces
6 lang talaga yung max na decimal places, if sobra yung sa format magdadagdag lang
nang magdadagdag ng 0 sa unahan
QUESTION 5
You need to analyze the following code segment. Line numbers are included for
reference only.
01 public void printInt()
02 {
03 if (true) {
04 int num = 1;
05 if (num > 0) {
06 num++;
07 }
08 }
09 int num = 1;
10 addOne (num);
11 num = num - 1;
12 System.out.println(num);
13 }
14
15 public void addOne (int num)
16 {
17 num = num + 1;
18 }
ANSWER
A. 0
B. 1
C. 2
Sa line 9 palang na num yung num na outside ng if{}.. Pag sa loob kasi ng {} nagdeclare
ng variable.. Within those curly braces lang magagamit.
So 1 yung original value then walang magbabago sa line kasi void yung method na yun
so in line 11 magiging 1 - 1 = 0
QUESTION 6
ANSWER
Excellent
Yung pinaka unang value sa scanner before the space is 1
Good
3
The next integer in the scanner is 2 but if hindi integer yung next magkakaron ng
InputMismatchException
Fair 4 Poor
QUESTION 7
How should you complete the code? To answer, select the appropriate code segments in
the answer area.
ANSWER
import java.util.Scanner
sc.close() ;
return birthdate;
}
}
Java User Input (Scanner class) (w3schools.com)
QUESTION 8
You need to evaluate the following Java program. Line numbers are included for
reference only.
ANSWER
5 100
10 25
25
100
Sa line 5 yung main function which is yung nauuna laging mag run.. Sa line 7 cinall yung
constructor ng JavaProgram1 which prints 1 as seen in line 20 - 21.. Then in line 12 may
initialization ulit ng x but within curly braces siya kaya hindi siya magagamit outside
nun.. So in line 14 mangyayari yung first initialization ng x sa main method, which is 100,
na magagamit sa buong scope ng main… it was printed in line 15.. Sa line 16 naman
prinint yung value ng variable x sa JavaProgram1 class, which is 25 as seen in line 3,
with the use of the dot (.) operator
QUESTION 9
You are interviewing for a job at Adventure Works, Inc. The hiring manager asks you to
create a single console program.
The program takes multiple arguments from the command line and writes them to the
screen in the same order as they were typed on the command line.
Which three code segments should you use to develop the solution? To answer, move
the appropriate code segments from the list of code segments to the answer area and
arrange them in the correct order.
ANSWER
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
System.out.println(args[i]); System.out.println(args[i]);
} }
} }
System.out.println(arguments[i]);
}
}
ANSWER
5 20 50 100
Sabi sa switch If A daw yung value ng mode,l price = 50 then break out of the switch
5 20 50 100
Sabi sa switch If T daw yung value ng model, price = 20 but walang break kaya
magpoproceed siya sa case C which overrides the value of price to 5
What is the return value when mode1 has a value of 'C?
5 20 50 100
Sabi sa switch If C daw yung value ng model price = 5 then break out of the switch
What is the return value when mode1 has any other value?
5 20 50 100
Sabi sa switch If hindi daw A,T or C yung value ng model, price = 100 then break out of
the switch
QUESTION 11
You need to create an int array named numbers initialized with numl, num2, and num3.
How should you complete the code? To answer, drag the appropriate code segment to
the correct position. Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.
ANSWER
QUESTION 12
You are creating a method that processes invoices. The invoices are contained in an
ArrayList instance. After each invoice is processed, the method must remove the invoice
from the ArrayList instance.
How should you complete the code? To answer, select the appropriate code segments in
the answer area.
ANSWER
The loop must traverse the arraylist from index 0 until the last index.. So initialize i as 0
then get the index i until i is equal to the last index, .size() returns the size of the arraylist
which is greater than the last index but the condition uses < only kaya di lalagpas sa last
index yung pag iincrement ng 1 kada iteration.
The method accepts a two-dimensional String array and prints the content of each array
element.
How should you complete the code? To answer, select the appropriate code segments in
the answer area.
ANSWER
QUESTION 14
You are developing a Java program to play Tic-Tac-Toe. You define the following array to
store the state of the board:
char[][] grid = {
{ ‘-’ , ’-’ , ’x’},
{ ‘-’ , ’-’ , ’-’},
{ ‘-’ , ’o’ , ’-’}
};
Use the drop-down menus to select the answer choice that answers each question based
on the information presented in the code.
ANSWER
Grid[x][y] - x is the row number starting from zero and y is the column number starting
from zero
0 1 2
0 { ‘-’ , ’-’ , ’x’}
1 { ‘-’ , ’-’ , ’-’}
2 { ‘-’ , ’o’ , ’-’}
QUESTION 15
How should you complete the code? To answer, select the appropriate code segments in
the answer area.
ANSWER
System.out.println(output);
}
substring(0,5) = the characters from index 0 to 4 (first 5 characters of the string)
%s = for strings
%d = for decimals
.length() = returns how many characters
QUESTION 16
You are writing a Java program that collects patient information and stores it in a
database.
You need to ensure that the program stores data using the least amount of memory.
Which data type should you use to complete each variable declaration? To answer, drag
the appropriate data type from the column on the left to its code segment on the right.
Each data may be used once, more than once, or not at all. You may need to drag the
split bar between panes or scroll to view content.
ANSWER
QUESTION 17
The method accepts an int value named number, raises the value to the second power,
and returns the negative value of the result.
How should you complete the code? To answer, drag the appropriate code segment to
the correct position. Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.
ANSWER
You are creating a method that converts a string representation of a number into an
actual number.
The numbers passed into the method include whole numbers and fractional numbers.
How should you complete the code? To answer, select the appropriate code segments in
the answer area.
ANSWER
We used the data type double because it is possible to have fractional numbers which
are decimals.
Double parseDouble() method in Java with examples - GeeksforGeeks
QUESTION 19
You need to declare a two by three array of the double type with initial values.
How should you complete the code? To answer, drag the appropriate code segment to
the correct location. Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.
ANSWER
You are interviewing for a job as a Java developer. You need to evaluate the following
code. Line numbers are included for reference only.
For each of the following statements, select Yes if the statement is true. Otherwise, select
No.
ANSWER
Yes No
You should use an int data type to store the numeric value 3,000,000,000 (3 billion) so
that the least amount of memory is used.
Review the underlined text. If it makes the statement correct, select "No change is
needed." If the statement is incorrect, select the answer choice that makes the statement
correct.
ANSWER
A. No change is needed.
B. a short
C. a byte
D. a long
EXPLANATION
https://www.w3schools.com/java/java_data_types.asp
QUESTION 22
ANSWER
How should you complete the code? To answer, drag the appropriate code segment to
the correct position. Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.
ANSWER
return welcomeMsg;
}
EXPLANATION
Method overload
.substring(start index) simula start index (inclusive) hanggang dulo
.substring(start index, end index) simula start index (inclusive) hanggang bago mag end
index (exclusive)
QUESTION 24
A. Double.valueOf (numberString);
B. double.parseDouble (numberString);
C. String.parseDouble (numberString);
D. Double.parseDouble (numberString);
EXPLANATION
QUESTION 25
What is the value of each code segment? To answer, drag the appropriate value from the
column on the left to its code segment on the right. Each data may be used once, more
than once, or not at all. You may need to drag the split bar between panes or scroll to
view content.
ANSWER
CHOICES:
0 1 2 2.5 15 19 26 30
ANSWER AREA:
(2 + 3) * 4 - 1 19
4*4+2*5 26
8*2%3 1
5/2+4%2 2
EXPLANATION
You are writing a Java console program. The program accepts command line arguments.
You need to ensure that the main method parses and handles each command line
argument.
How should you complete the code? To answer, select the appropriate code segments in
the answer area.
ANSWER
{
for (int i = 0; i < args.length ; i++)
Dropdown choices
{
handleArgument(args[i]);
Dropdown choices
}
}
EXPLANATION
args.length - returns length of args.. Hindi na kailangan ng -1 kasi < lang naman so it
won’t encounter an IndexOutOfBounds
SOURCE
QUESTION 27
You work as an intern Java programmer at Adventure Works. Your team lead asks you to
create a method.
How should you complete the code? To answer, select the appropriate code segments in
the answer area.
ANSWER
EXPLANATION
Since <= may minus 1 dapat pero hanggang 2nd to the last index lang kailangan kasi
yung value ng last index ay nacompare na sa lahat pagdating sa second to the last index
so -2 yung mas efficient.. gets ba hahahaha
QUESTION 28
You are interviewing for a job as a Java developer. You need to demonstrate your
understanding of switch statements.
For each of the following code segments, select Yes if the code segment can be changed
to a switch statement with up to three case statements. Otherwise, select No.
ANSWER
Yes No
if (grade == “A”){
message = “Exceeds Standards”;
} else if (grade == “B”) {
message = “Meets Standards”;
} else {
message = “Needs Improvement”;
}
if (gpa == 4.0){
priority = 1;
} else if (gpa >= 3.0) {
priority = 2;
} else if (gpa >= 2.5) {
priority = 3;
}
EXPLANATION
Ginagamit lang switch statement if alam mo exactly yung possible inputs so dapat ==
langs (dapat yung condition specific character or value hindi yung range)
How should you complete the code? To answer, select the appropriate code segments in
the answer area.
ANSWER
EXPLANATION
Enhanced For Loop/For-Each Loop: Java for-each Loop (With Examples)
(programiz.com)
QUESTION 30
To open a new account, a user must meet one the following requirements:
How should you complete the code? To answer, drag the appropriate operator to the
correct position. Each operator may be used once, more than once, or not at all. You may
need to drag the split bar between panes or scroll to view content.
ANSWER
if (num > 65 && income >= 10000 || age >= 21 && income > 25000){
System.out.println(“Approved”);
}
else {
System.out.println(“Declined”);
}
EXPLANATION
Java operators: Java Operators (w3schools.com)
QUESTION 31
ANSWER
EXPLANATION
From start to zero (included yung zero) kaya >=
For loop syntax: Java For Loop (w3schools.com)
QUESTION 32
You work as a Java programmer. A member of the team creates the following program.
Line numbers are included for reference only.
ANSWER
EXPLANATION
Java operators: Java Operators (w3schools.com)
QUESTION 33
How should you complete the code? To answer, select the appropriate code segments in
the answer area.
ANSWER
EXPLANATION
Usually, iniimport yung Scanner utility sa taas (import java.util.Scanner;) pero pede ring
hindi na by typing java.util.Scanner instead na Scanner lang pag ginagamit yung utility
.hasNext() returns boolean values (either true or false) kaya siya lang pede na sagot
among the choices
System.out.println kasi sabi separate line
.next() - returns the next value ng scanner (input)
QUESTION 34
You need to evaluate the following code. Line numbers are included for reference only.
ANSWER
You need to evaluate the following class. Line numbers are included for reference only.
For each of the following statements, select Yes if the statement is true. Otherwise, select
No.
ANSWER
Yes No
QUESTION 36
You have the following code segment. Line numbers are included for reference only.
For each of the following statements, select Yes if the action is required to resolve the
compilation error. Otherwise, select No.
ANSWER
Yes No
QUESTION 37
You need to define a constant data member named RATE. The data member must be
accessible by any class without instantiating the InsurancePolicy class.
How should you complete the code? To answer, drag the appropriate code segment to
the correct position. Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.
ANSWER
You work on a team that develops e-commerce applications. A member of the team
creates a class named DB that connects to a database. The class contains a method
named query.
You need to initiate the DB class and invoke the query method.
How should you complete the code? To answer, select the appropriate code segments in
the answer area.
ANSWER
DB db = new DB();
Dropdown choices
db.query();
Dropdown choices
QUESTION 39
}
@Override
Dropdown choices
QUESTION 40
class Logger
{
public void logError (String message)
{
}
}
The logError method can be invoked by code in all classes in the same package as the
Logger class.
Review the underlined text. If it makes the statement correct, select "No change is
needed." If the statement is incorrect, select the answer choice that makes the statement
correct.
ANSWER
A. No change is needed
B. only by the Logger class
C. only by the Logger class and classes in the same package that inherit from it
D. by all classes in all packages
QUESTION 41
You write the following Java program for Munson's Pickles and Preserves Fam. Line
numbers are included for reference only.
01 class Pickle {
02 boolean isPreserved = false;
03 private boolean iscreated = false;
04
05 void preserve() {
06 isPreserved = true;
07 }
08
09 public static void main(String[] args)
10 {
11 Pickle pickle = new pickle();
12 iscreated = true;
13 pickle.preserve;
14 }
15 }
You encounter error messages when you attempt to compile the program.
How should you complete the code? To answer, select the appropriate code segments in
the answer area.
ANSWER
class Pickle {
boolean isPreserved = false;
private boolean isCreated = false;
void preserve() {
isPreserved = true;
}
QUESTION 42
You need to evaluate the output of the following code segment. Line numbers are
included for reference only.
01 try
02 {
03 int x = 1/ 0;
04 System.out.println("try");
05 }
06 catch (ArithmeticException ex)
07 {
08 System.out.println("catch ArithmeticException");
09 }
10 catch (Exception ex)
11 {
12 System.out.println("catch Exception");
13 }
14 finally
15 {
16 System.out.println("finally");
17 }
For each of the following outputs, select Yes if the output is displayed. Otherwise,
select No.
ANSWER
Yes No
try
catch ArithmeticException
catch Exception
finally
Explanation
Per line chinecheck yung within try and since first line palang ng try may na encounter
agad na exception which is an Arithmetic exception, hindi na aabot sa
System.out.println("try"); instead, ipiprint niya na yung System.out.println("catch
ArithmeticException"); and System.out.println("finally"); kasi kahit na may exception or
wala.. laging magrurun yung finally
Corrections & Comments
QUESTION 1
You need to create an if statement that evaluates to true when both of the following
conditions are met:
OPERATORS
ANSWER
QUESTION 2
You are evaluating the following Java method that calculates scholarships and award
amounts. Line numbers are included for reference only.
ANSWER
You are writing a Java program to calculate the admission fee for Baldwin Museum of
Science. The standard ticket price is $10.00. The program must meet the following
requirements:
ANSWER
QUESTION 4
You are writing a Java console program that accepts command line arguments.
The program needs to display each command line argument on a separate line.
ANSWER
You are writing a Java method. The method must meet the following requirements:
ANSWER
return classification;
}
QUESTION 6
ANSWER
You need to refactor the following code without changing its functionality.
Line numbers are included for reference only.
01 displayMenu();
02 for ( ; ; )
03 {
04 boolean b = makeNewTransaction();
05 if (!b)
06 break;
07 displayMenu();
08 ;
} break;
do
} do;
while (makeNewTransaction())
} while (makeNewTransaction());
continue
} continue;
ANSWER
do
{
displayMenu();
} while (makeNewTransaction())
The minBoxWidth and maxBoxWidth data members can be accessed only by the Box
class.
ANSWER
B. only by classes in the same package and classes that inherit the Box class.
QUESTION 9
- A method named displayTerms that can be called from any code without
instantiating the Account class
- An instance method named addAccount that can only be accessed by classes in
the same package and by subclasses of the Account class in any package
ANSWER
ANSWER
int areaNum;
Rectangle rect = new Rectangle(20,40);
areaNum = rect.area();
System.out.printf(“Width = %d Length = %d\n”, rect.getWidth(), rect.getLength());
System.out.printf(“Area is correct %b\n”, areaNum == 800);
QUESTION 11
You write the following code for the School of Fine Art.
Line numbers are included for reference only.
The Student class must use a custom toString method instead of the standard one.
Which annotation should you use at line 05?
ANSWER
D. @Override
The Object class has some basic methods like clone(), toString(), equals(),.. etc. The
default toString() method in Object prints “class name @ hash code”. We can override
toString() method in our class to print proper output.
QUESTION 12
You have a Java class named Account. The constructor of the Account class accepts a
String object. You need to create a class named SavingsAccount that inherits from the
Account class.
The constructor of the SavingsAccount class must meet the following requirements:
QUESTION 13
You work on a team that develops e-commerce applications. A member of the team
creates a class named DB that connects to a database. The class contains a method
named query. You need to instantiate the DB class and invoke the query method.
ANSWER
DB db = new DB();
db.query();
QUESTION 14
ANSWER
the double value 89.99 is assigned to float variable fNum which requires explicit casting
int x = 50;
x += 100 % 5 + 10 * 2;
ANSWER
E. 70
QUESTION 16
You are choosing the data types for some Java literals. You need to ensure that each
literal is stored precisely and uses the least amount of memory.
ANSWER
double 100.45232d
float 50.256f
boolean true
byte 120 byte value range: -128 to 127
int 1200000
QUESTION 17
Initialize the following variables:
int a = 5;
double b = 3.5;
int c = 33;
float d = 0.5f;
short e = 22;
ANSWER
a += 4 % 2 + e; = 27
b /= 10 * 2 = 0.175
c %= e * 2 + 1 = 33
d *= 2 + 6 % 7 = 4.0
QUESTION 18
You are writing Java code to declare and initialize data types.
ANSWER
The Character class offers a number of useful class (i.e., static) methods for
manipulating characters such as isLetter(), isDigit(), isWhitespace(), etc.
https://www.tutorialspoint.com/java/java_characters.htm
QUESTION 19
The method accepts a String parameter named text. It returns true if text meets any of the
following conditions:
- is null
- contains only an empty string
- contains only whitespace characters
ANSWER
You are interviewing for a job as a Java developer. You need to evaluate the following
code. Line numbers are included for reference only.
For each of the following statements, select Yes if the statement is true. Otherwise, select
No.
ANSWER
Once String object is created its data or state can't be changed but a new String object is
created.
https://www.javatpoint.com/immutable-string
When compiler optimizes your string literals, it sees that both s1 and s2 have same value
and thus you need only one string object. It's safe because String is immutable in Java.
String Pool is the mechanism that all already defined string are stored in some 'pool' and
before creating new String object compiler checks if such string is already defined.
https://stackoverflow.com/questions/15805578/will-two-strings-with-same-content-be-stor
ed-in-the-same-memory-location
QUESTION 21
ANSWER
QUESTION 22
ANSWER
scores[1][2] = 50;
QUESTION 23
ANSWER
The parseBoolean() method of Boolean Class is a built in static method of the class
java.lang.Boolean which is used to convert a given string to its boolean value.
https://www.geeksforgeeks.org/boolean-parseboolean-method-in-java-with-examples/
QUESTION 24
ANSWER
return max;
}
The method accepts an int value named number, raises the value to the second power,
and returns the negative value of the result.
-1 2 number + - * ^
ANSWER
QUESTION 26
You need to evaluate the following code. Line numbers are included for reference only.
ANSWER
QUESTION 27
ANSWER
char ‘c’
short 234
boolean false
float 234.55f
QUESTION 28
You are writing a Java class to implement an Integer stack based on an ArrayList.
You need to implement the following methods:
ANSWER
QUESTION 29
You are creating a method that processes invoices. The invoices are contained in an
ArrayList instance. After each invoice is processed, the method must remove the invoice
from the ArrayList instance.
ANSWER
QUESTION 30
ANSWER
Integer.parseInt()
Using the Integer.parseInt() method will return the string as a primitive type int. For e.g.,
Integer.valueOf()
Integer.valueOf() is to be used when an instance of the Integer class is required. For e.g.,
//Declaring a string
String number = "10";
You are interviewing for a job as a Java developer. You need to evaluate the following
code:
ANSWER
- When cast to byte, Narrowing Primitive Conversion is done which discards all but the
lower 8 bits so the value fits into the byte. Since Java uses two's complement to
represent byte, this number is considered negative since the highest bit is set.
https://stackoverflow.com/questions/55990095/what-happens-when-i-assign-value-larger-
than-byte/55990215
https://www.youtube.com/watch?v=cwfC366jFFU&ab_channel=GagMansa-LearnJava
QUESTION 32
int result = 3 + 5 * 3 % 2;
ANSWER
B. 4
QUESTION 33
You are interviewing for a job as a Java developer. You need to demonstrate your
understanding of the main method.
For each of the following statements, select Yes if the statement is true. Otherwise, select
No.
ANSWER
QUESTION 34
You are interviewing for a job as a Java developer. You are presented with the following
code. Line numbers are included for reference only.
QUESTION 35
You need to evaluate the following code. Line numbers are included for reference only.
ANSWER
QUESTION 36
You need to evaluate the following code. Line numbers are included for reference only.
ANSWER
You are writing a method that changes the player score in a game.
You need to evaluate the code. Line numbers are included for reference only.
For each of the following statements, select Yes if the statement is true. Otherwise, select
No.
ANSWER
QUESTION 38
You are writing a Java console program. The program reads a temperature on the Celsius
scale and converts it to the Fahrenheit scale.
ANSWER
import java.util.Scanner;
public class TemperatureConverter {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print(“Enter a degree in Celsius: ”);
double celsius = input.nextDouble();
double fahrenheit = 1.8 * celsius + 32;
System.out.print(celsius + “ Celsius is ” + fahrenheit + “ Fahrenheit”);
}
}
QUESTION 39
ANSWER
// TODO
}
}
QUESTION 40
You need to determine the values of the data1, data2, data3 and data4 variables.
ANSWER
The value of data1 is 1
The value of data2 is Excellent
The value of data3 is 2
The value of data4 is Good 3 Fair 4 Poor
QUESTION 41
You are creating a Java console application for City Power & Light.
You need to define the signature of the first method that gets executed when the
application starts.
ANSWER
QUESTION 42
You are writing the following Java program for Munson’s Pickles and Preserves Farm.
Line numbers are included for reference only.
01 class Pickle {
02 boolean isPreserved = false;
03 private boolean isCreated = false;
04
05 void preserve() {
06 isPreserved = true;
07 }
08
09 public static void main(String[] args)
10 {
11 Pickle pickle = new pickle();
12 isCreated = true;
13 pickle.preserve;
14 }
15 }
ANSWER
01 class Pickle {
02 boolean isPreserved = false;
03 private boolean isCreated = false;
04
05 void preserve() {
06 isPreserved = true;
07 }
08
09 public static void main(String[] args)
10 {
11 Pickle pickle = new Pickle();
12 pickle.isCreated = true;
13 pickle.preserve();
14 }
15 }
QUESTION 43
For each of the following statements, select Yes if the statement is True. Otherwise,
select No.
ANSWER
- If an exception occurs due to file handling errors, the exception details need to be
displayed.
- If any other exception occurs, the stack information needs to be displayed.
ANSWER
try
{
/* add logic */
}
catch (IOException e1)
{
System.out.println(e1.getMessage());
}
catch (Exception e2)
{
System.out.println(e2.printStackTrace());
}
98-388.16q
Number: 98-388
Passing Score: 800
Time Limit: 120 min
File Version: 1.0
98-388
https://www.gratisexam.com/
Sections
1. Understand Java fundamentals
2. Work with data types, variables, and expressions
3. Implement flow control
4. Compile and debug code
https://www.gratisexam.com/
Exam A
QUESTION 1
You have the following code segment. Line numbers are included for reference only.
https://www.gratisexam.com/
A. -44
B. -40.0
C. 40.0
D. 44.0
Correct Answer: B
Section: Understand Java fundamentals
Explanation
Explanation/Reference:
QUESTION 2
You need to analyze the following code segment. Line numbers are included for reference only.
https://www.gratisexam.com/
What is the output of line 12 when you run printInt()?
A. 0
B. 1
C. 2
D. 3
Correct Answer: A
Section: Understand Java fundamentals
Explanation
Explanation/Reference:
QUESTION 3
HOTSPOT
https://www.gratisexam.com/
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
https://www.gratisexam.com/
Correct Answer:
Explanation/Reference:
https://www.gratisexam.com/
References:
https://docs.oracle.com/javase/7/docs/api/java/io/InputStreamReader.html
QUESTION 4
DRAG DROP
You need to evaluate the following Java program. Line numbers are included for reference only.
Which three values will be displayed in sequence? To answer, move the appropriate values from the list of values to the answer area and arrange them in the
correct order.
https://www.gratisexam.com/
Correct Answer:
Explanation/Reference:
QUESTION 5
HOTSPOT
You need to evaluate the following code. Line numbers are included for reference only.
https://www.gratisexam.com/
Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code.
Hot Area:
https://www.gratisexam.com/
Correct Answer:
https://www.gratisexam.com/
Section: Work with data types, variables, and expressions
Explanation
Explanation/Reference:
QUESTION 6
DRAG DROP
https://www.gratisexam.com/
You need to create an int array named numbers initialized with num1, num2, and num3.
How should you complete the code? To answer, drag the appropriate code segment to the correct position. Each code segment may be used once, more than
once, or not at all. You may need to drag the split bar between panes or scroll to view content.
Correct Answer:
Explanation/Reference:
Example:
int[] numbers = new int[] {num1, num2, num3}
References:
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
https://www.gratisexam.com/
https://alvinalexander.com/blog/post/java/java-faq-create-array-int-example-syntax
QUESTION 7
HOTSPOT
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
Correct Answer:
https://www.gratisexam.com/
Section: Work with data types, variables, and expressions
Explanation
Explanation/Reference:
References:
https://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html
https://www.tutorialspoint.com/java/lang/stringbuilder_substring_end.htm
QUESTION 8
DRAG DROP
The method accepts an int value named number, raises the value to the second power, and returns the negative value of the result.
How should you complete the code? To answer, drag the appropriate code segment to the correct position. Each code segment may be used once, more than
once, or not at all. You may need to drag the split bar between panes or scroll to view content.
https://www.gratisexam.com/
Correct Answer:
Explanation/Reference:
QUESTION 9
The question requires that you evaluate the underlined text to determine if it is correct.
You should use an int data type to store the numeric value 3,000,000,000 (3 billion) so that the least amount of memory is used.
Review the underlined text. If it makes the statement correct, select “No change is needed.” If the statement is incorrect, select the answer choice that makes the
statement correct.
A. No change is needed.
B. a short
C. a byte
D. a long
https://www.gratisexam.com/
https://www.gratisexam.com/
Correct Answer: D
Section: Work with data types, variables, and expressions
Explanation
Explanation/Reference:
QUESTION 10
You need to evaluate the following code segment:
Correct Answer: C
Section: Work with data types, variables, and expressions
Explanation
Explanation/Reference:
QUESTION 11
DRAG DROP
https://www.gratisexam.com/
You are writing a Java method.
How should you complete the code? To answer, drag the appropriate code segment to the correct position. Each code segment may be used once, more than
once, or not at all. You may need to drag the split bar between panes or scroll to view content.
Correct Answer:
https://www.gratisexam.com/
Section: Work with data types, variables, and expressions
Explanation
Explanation/Reference:
References:
http://www.tutorialspoint.com/java/java_strings.htm
QUESTION 12
You work as a Java programmer.
A. Double.valueOf(numberString);
B. double.parseDouble(numberString);
C. String.parseDouble(numberString);
D. Double.parseDouble(numberString);
Correct Answer: B
Section: Work with data types, variables, and expressions
Explanation
Explanation/Reference:
References:
https://www.javacodeexamples.com/convert-string-to-primitive-example/140
QUESTION 13
HOTSPOT
You are writing a Java console program. The program accepts command line arguments.
You need to ensure that the main method parses and handles each command line argument.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
https://www.gratisexam.com/
Correct Answer:
https://www.gratisexam.com/
Section: Work with data types, variables, and expressions
Explanation
Explanation/Reference:
QUESTION 14
HOTSPOT
https://www.gratisexam.com/
The method must meet the following requirements:
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
https://www.gratisexam.com/
Correct Answer:
https://www.gratisexam.com/
Section: Implement flow control
Explanation
Explanation/Reference:
https://www.gratisexam.com/
QUESTION 15
DRAG DROP
To open a new account, a user must meet one the following requirements:
How should you complete the code? To answer, drag the appropriate operator to the correct position. Each operator may be used once, more than once, or not at
all. You may need to drag the split bar between panes or scroll to view content.
Correct Answer:
https://www.gratisexam.com/
Section: Implement flow control
Explanation
Explanation/Reference:
References:
https://www.tutorialspoint.com/java/java_basic_operators.htm
QUESTION 16
The question requires that you evaluate the underlined text to determine if it is correct.
The logError method can be invoked by code in all classes in the same package as the Logger class.
Review the underlined text. If it makes the statement correct, select “No change is needed.” If the statement is incorrect, select the answer choice that makes the
statement correct.
A. No change is needed
B. only by the Logger class
C. only by the Logger class and classes in the same package that inherit from it
D. by all classes in all packages
Correct Answer: C
Section: Compile and debug code
Explanation
Explanation/Reference:
https://www.gratisexam.com/
https://www.gratisexam.com/
https://www.gratisexam.com/
98-388.exam-labs.pemium.exam.42q
Number: 98-388
Passing Score: 800
Time Limit: 120 min
File Version: 1.0
98-388
Version 1.0
Sections
1. Topic 1, Understand Java fundamentals
2. Topic 2, Work with data types, variables, and expressions
3. Topic 3, Implement flow control
4. Topic 4, Perform object-oriented programming
5. Topic 5, Compile and debug code
VCEConvert.com
Exam A
QUESTION 1
HOTSPOT
You need to evaluate the following code segment. Line numbers are included for reference only.
Use the drop-down menus to select the answer choice that answers each question based on the information
presented in the code.
Hot Area:
Correct Answer:
VCEConvert.com
Explanation/Reference:
QUESTION 2
You have the following code segment. Line numbers are included for reference only.
A. -44
B. -40.0
C. 40.0
D. 44.0
Correct Answer: B
Section: Topic 1, Understand Java fundamentals
Explanation
Explanation/Reference:
QUESTION 3
HOTSPOT
You are presented with the following code. Line numbers are included for reference only.
Use the drop-down menus to select the answer choice that answers each question based on the information
presented in the code.
Hot Area:
VCEConvert.com
Correct Answer:
Explanation/Reference:
QUESTION 4
HOTSPOT
You need to evaluate the following Java program. Line numbers are included for reference only.
VCEConvert.com
Use the drop-down menus to select the answer choice that answers each question based on the information
presented in the code.
Hot Area:
Correct Answer:
VCEConvert.com
Section: Topic 1, Understand Java fundamentals
Explanation
Explanation/Reference:
References:
https://docs.oracle.com/javase/tutorial/java/data/numberformat.html
QUESTION 5
You need to analyze the following code segment. Line numbers are included for reference only.
A. 0
B. 1
C. 2
VCEConvert.com
D. 3
Correct Answer: A
Section: Topic 1, Understand Java fundamentals
Explanation
Explanation/Reference:
QUESTION 6
HOTSPOT
You need to determine the values of the data1, data2, data3, and data4 variables.
Use the drop-down menus to select the answer choice that answers each question based on the information
presented in the code.
Hot Area:
Correct Answer:
VCEConvert.com
Section: Topic 1, Understand Java fundamentals
Explanation
Explanation/Reference:
References:
https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
QUESTION 7
HOTSPOT
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
VCEConvert.com
Correct Answer:
VCEConvert.com
Section: Topic 1, Understand Java fundamentals
Explanation
Explanation/Reference:
References:
https://docs.oracle.com/javase/7/docs/api/java/io/InputStreamReader.html
QUESTION 8
DRAG DROP
You need to evaluate the following Java program. Line numbers are included for reference only.
VCEConvert.com
Which three values will be displayed in sequence? To answer, move the appropriate values from the list of
values to the answer area and arrange them in the correct order.
Correct Answer:
Explanation/Reference:
QUESTION 9
DRAG DROP
VCEConvert.com
You are interviewing for a job at Adventure Works, Inc. The hiring manager asks you to create a single console
program.
The program takes multiple arguments from the command line and writes them to the screen in the same
order as they were typed on the command line.
Which three code segments should you use to develop the solution? To answer, move the appropriate code
segments from the list of code segments to the answer area and arrange them in the correct order.
Correct Answer:
Explanation/Reference:
References:
https://docs.oracle.com/javase/tutorial/getStarted/cupojava/netbeans.html
QUESTION 10
HOTSPOT
You need to evaluate the following code. Line numbers are included for reference only.
VCEConvert.com
Use the drop-down menus to select the answer choice that answers each question based on the information
presented in the code.
Hot Area:
Correct Answer:
VCEConvert.com
Section: Topic 2, Work with data types, variables, and expressions
Explanation
Explanation/Reference:
QUESTION 11
DRAG DROP
You need to create an int array named numbers initialized with num1, num2, and num3.
How should you complete the code? To answer, drag the appropriate code segment to the correct position.
Each code segment may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.
VCEConvert.com
Correct Answer:
Explanation/Reference:
Example:
int[] numbers = new int[] {num1, num2, num3}
References:
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
https://alvinalexander.com/blog/post/java/java-faq-create-array-int-example-syntax
QUESTION 12
HOTSPOT
You are creating a method that processes invoices. The invoices are contained in an ArrayList instance.
After each invoice is processed, the method must remove the invoice from the ArrayList instance.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
VCEConvert.com
Correct Answer:
Explanation/Reference:
References:
https://beginnersbook.com/2013/12/java-arraylist/
QUESTION 13
HOTSPOT
The method accepts a two-dimensional String array and prints the content of each array element.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
VCEConvert.com
Correct Answer:
VCEConvert.com
Explanation
Explanation/Reference:
References:
https://www.tutorialgateway.org/two-dimensional-array-in-java/
QUESTION 14
HOTSPOT
You are developing a Java program to play Tic-Tac-Toe. You define the following array to store the state of the
board:
Use the drop-down menus to select the answer choice that answers each question based on the information
presented in the code.
Hot Area:
Correct Answer:
VCEConvert.com
Section: Topic 2, Work with data types, variables, and expressions
Explanation
Explanation/Reference:
QUESTION 15
HOTSPOT
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
Correct Answer:
VCEConvert.com
Section: Topic 2, Work with data types, variables, and expressions
Explanation
Explanation/Reference:
References:
https://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html
https://www.tutorialspoint.com/java/lang/stringbuilder_substring_end.htm
QUESTION 16
DRAG DROP
You are writing a Java program that collects patient information and stores it in a database.
You need to ensure that the program stores data using the least amount of memory.
Which data type should you use to complete each variable declaration? To answer, drag the appropriate data
type from the column on the left to its code segment on the right. Each data may be used once, more than
once, or not at all. You may need to drag the split bar between panes or scroll to view content.
Correct Answer:
VCEConvert.com
Explanation/Reference:
References:
http://www.tutorialspoint.com/java/java_basic_datatypes.htm
QUESTION 17
DRAG DROP
The method accepts an int value named number, raises the value to the second power, and returns the
negative value of the result.
How should you complete the code? To answer, drag the appropriate code segment to the correct position.
Each code segment may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.
Correct Answer:
Explanation/Reference:
QUESTION 18
HOTSPOT
You are creating a method that converts a string representation of a number into an actual number.
The numbers passed into the method include whole numbers and fractional numbers.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
VCEConvert.com
Correct Answer:
Explanation/Reference:
References:
https://docs.oracle.com/javase/tutorial/java/data/converting.html
QUESTION 19
DRAG DROP
You need to declare a two by three array of the double type with initial values.
How should you complete the code? To answer, drag the appropriate code segment to the correct location.
Each code segment may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.
VCEConvert.com
Correct Answer:
Explanation/Reference:
References:
https://www.dummies.com/programming/java/java-use-arrays-with-two-dimensions-or-more/
QUESTION 20
HOTSPOT
You are interviewing for a job as a Java developer. You need to evaluate the following code. Line numbers are
included for reference only.
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Hot Area:
VCEConvert.com
Correct Answer:
Explanation/Reference:
References:
https://www.tutorialspoint.com/java/java_strings.htm
QUESTION 21
The question requires that you evaluate the underlined text to determine if it is correct.
You should use an int data type to store the numeric value 3,000,000,000 (3 billion) so that the least amount of
memory is used.
Review the underlined text. If it makes the statement correct, select “No change is needed.” If the statement is
incorrect, select the answer choice that makes the statement correct.
A. No change is needed.
B. a short
C. a byte
D. a long
Correct Answer: D
Section: Topic 2, Work with data types, variables, and expressions
Explanation
Explanation/Reference:
VCEConvert.com
QUESTION 22
You need to evaluate the following code segment:
Correct Answer: C
Section: Topic 2, Work with data types, variables, and expressions
Explanation
Explanation/Reference:
QUESTION 23
DRAG DROP
How should you complete the code? To answer, drag the appropriate code segment to the correct position.
Each code segment may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.
Correct Answer:
VCEConvert.com
Section: Topic 2, Work with data types, variables, and expressions
Explanation
Explanation/Reference:
References:
http://www.tutorialspoint.com/java/java_strings.htm
QUESTION 24
You work as a Java programmer.
A. Double.valueOf(numberString);
B. double.parseDouble(numberString);
C. String.parseDouble(numberString);
D. Double.parseDouble(numberString);
Correct Answer: B
Section: Topic 2, Work with data types, variables, and expressions
Explanation
Explanation/Reference:
References:
https://www.javacodeexamples.com/convert-string-to-primitive-example/140
QUESTION 25
DRAG DROP
What is the value of each code segment? To answer, drag the appropriate value from the column on the left to
its code segment on the right. Each data may be used once, more than once, or not at all. You may need to
drag the split bar between panes or scroll to view content.
VCEConvert.com
Correct Answer:
Explanation/Reference:
QUESTION 26
HOTSPOT
You are writing a Java console program. The program accepts command line arguments.
You need to ensure that the main method parses and handles each command line argument.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
VCEConvert.com
Correct Answer:
VCEConvert.com
Section: Topic 2, Work with data types, variables, and expressions
Explanation
Explanation/Reference:
QUESTION 27
HOTSPOT
You work as an intern Java programmer at Adventure Works. Your team lead asks you to create a method.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
VCEConvert.com
Correct Answer:
VCEConvert.com
Section: Topic 3, Implement flow control
Explanation
Explanation/Reference:
References:
https://stackoverflow.com/questions/3951547/java-array-finding-duplicates
QUESTION 28
HOTSPOT
You are interviewing for a job as a Java developer. You need to demonstrate your understanding of switch
statements.
For each of the following code segments, select Yes if the code segment can be changed to a switch
statement with up to three case statements. Otherwise, select No.
Hot Area:
VCEConvert.com
Correct Answer:
VCEConvert.com
Section: Topic 3, Implement flow control
Explanation
Explanation/Reference:
References:
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html
QUESTION 29
HOTSPOT
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
VCEConvert.com
Correct Answer:
VCEConvert.com
Section: Topic 3, Implement flow control
Explanation
Explanation/Reference:
QUESTION 30
DRAG DROP
To open a new account, a user must meet one the following requirements:
How should you complete the code? To answer, drag the appropriate operator to the correct position. Each
operator may be used once, more than once, or not at all. You may need to drag the split bar between panes
or scroll to view content.
VCEConvert.com
Correct Answer:
Explanation/Reference:
References:
https://www.tutorialspoint.com/java/java_basic_operators.htm
QUESTION 31
HOTSPOT
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
VCEConvert.com
Correct Answer:
Explanation/Reference:
References:
https://docs.oracle.com/javase/tutorial/java/javaOO/arguments.html
QUESTION 32
HOTSPOT
You work as a Java programmer. A member of the team creates the following program. Line numbers are
included for reference only.
VCEConvert.com
The program is supposed to display a message to the console while it counts down from 60. The method does
not work as intended.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
VCEConvert.com
Correct Answer:
VCEConvert.com
Section: Topic 3, Implement flow control
Explanation
Explanation/Reference:
References:
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html
QUESTION 33
HOTSPOT
How should you complete the code? To answer, select the appropriate code segments in the answer area.
VCEConvert.com
Hot Area:
Correct Answer:
Explanation/Reference:
References:
https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
QUESTION 34
HOTSPOT
VCEConvert.com
You need to evaluate the following code. Line numbers are included for reference only.
Use the drop-down menus to select the answer choice that answers each question based on the information
presented in the code.
Hot Area:
Correct Answer:
Explanation/Reference:
VCEConvert.com
QUESTION 35
HOTSPOT
You need to evaluate the following class. Line numbers are included for reference only.
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Hot Area:
Correct Answer:
Explanation/Reference:
References:
https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html
QUESTION 36
HOTSPOT
You have the following code segment. Line numbers are included for reference only.
VCEConvert.com
The code does not compile.
For each of the following statements, select Yes if the action is required to resolve the compilation error.
Otherwise, select No.
Hot Area:
Correct Answer:
Explanation/Reference:
References:
https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
QUESTION 37
DRAG DROP
You need to define a constant data member named RATE. The data member must be accessible by any class
without instantiating the InsurancePolicy class.
VCEConvert.com
How should you complete the code? To answer, drag the appropriate code segment to the correct position.
Each code segment may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.
Correct Answer:
Explanation/Reference:
References:
https://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html
QUESTION 38
HOTSPOT
You work on a team that develops e-commerce applications. A member of the team creates a class named DB
that connects to a database. The class contains a method named query.
You need to initiate the DB class and invoke the query method.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
VCEConvert.com
Correct Answer:
Explanation/Reference:
References:
https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Method.html#invoke-java.lang.Object-
java.lang.Object...-
QUESTION 39
VCEConvert.com
HOTSPOT
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
Correct Answer:
VCEConvert.com
Section: Topic 4, Perform object-oriented programming
Explanation
Explanation/Reference:
References:
https://www.tutorialspoint.com/java/java_inheritance.htm
QUESTION 40
The question requires that you evaluate the underlined text to determine if it is correct.
VCEConvert.com
The logError method can be invoked by code in all classes in the same package as the Logger class.
Review the underlined text. If it makes the statement correct, select “No change is needed.” If the statement is
incorrect, select the answer choice that makes the statement correct.
A. No change is needed
B. only by the Logger class
C. only by the Logger class and classes in the same package that inherit from it
D. by all classes in all packages
Correct Answer: C
Section: Topic 5, Compile and debug code
Explanation
Explanation/Reference:
QUESTION 41
HOTSPOT
You write the following Java program for Munson’s Pickles and Preserves Farm. Line numbers are included for
reference only.
You encounter error messages when you attempt to compile the program.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
Hot Area:
VCEConvert.com
Correct Answer:
VCEConvert.com
Section: Topic 5, Compile and debug code
Explanation
Explanation/Reference:
QUESTION 42
HOTSPOT
You need to evaluate the output of the following code segment. Line numbers are included for reference only.
VCEConvert.com
For each of the following outputs, select Yes if the output is displayed. Otherwise, select No.
Hot Area:
Correct Answer:
VCEConvert.com
Section: Topic 5, Compile and debug code
Explanation
Explanation/Reference:
References:
https://www.w3schools.com/java/java_try_catch.asp
VCEConvert.com