Java SE 8 Programmer I Questions and Answers
Given the code fragment:
What is the result?
Given:
What is the result?
Given the code fragment:
What is the result?
Given:
What is the result?
Given the code fragment from three files:
Which code fragment, when inserted at line 2, enables the code to compile?
Given:
What is the result?
Given the code fragment:
Which two modifications, when made independently, enable the code to print Joe:true: 100.0? (Choose two.)
Given the code fragment:
What is the result?
Given:
and the code fragment:
S2 sobj = new S2(); sobj.display(10, 100);
What is the result?
Which two array initialization statements are valid? (Choose two.)
Given the code fragments:
And:
Which statement is true?
Given the code fragment:
And given the requirements:
1. Process all the elements of the array in the order of entry.
2. Process all the elements of the array in the reverse order of entry.
3. Process alternating elements of the array in the order of entry.
Which two statements are true? (Choose two.)
Given:
What is the result?
Given:
Which code fragment can replace the if block?
Given the code fragment:
Which two modifications, made independently, enable the code to compile? (Choose two.)
Given these requirements:
- Bus and Boat are Vehicle type classes.
- The start() and stop() methods perform common operations across the Vehicle class type.
- The ride() method performs a unique operations for each type of Vehicle.
Which set of actions meets the requirements with optimized code?
Given the code fragment:
What is the result?
Given the code fragment:
Which option represents the state of the num array after successful completion of the outer loop?
Given the code fragment:
What is the result?
Given:
What is the result?
Given the code fragment:
Which two modifications enable the code to compile?
Given the code fragment:
What is the result?
Given the code fragment:
Which code fragment, when inserted at line 9, enables the code to print true?
Given:
What is the result?
Given the code snippet from a compiled Java source file:
and this output:
Which command should you run to obtain this output?
Given this code for the classes MyException and Test:
What is the result?
Given:
Given the code fragment:
Which two sets of actions, independently, enable the code fragment to print Fit?
Given:
And given the code fragment:
What is the result?
Which statement is true about the switch statement?
Given the code fragment:
What is the result?
Which one of the following code examples uses valid Java syntax?
Given:
What is the result?
Given the code fragment:
What is the result?
Given the following code:
What is the output?
Given the code fragment:
What is the result?
Given the code fragment:
Which three lines fail to compile? (Choose three.)
Given these classes:
And given this main method:
Which two options compile when placed at line n1 of the main method? (Choose two.)
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?
Given the code fragment:
Which code fragment at line 10 prints Welcome 100?
Given the code fragment:
And given the requirements:
1. Process all the elements of the array in the order of entry.
2. Process all the elements of the array in the reverse order of entry.
3. Process alternating elements of the array in the order of entry.
Which two statements are true? (Choose two.)
Which statement is true about Java byte code?
Given:
What is the result?
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
Given the code fragment:
Assume that the system date is June 20, 2014. What is the result?
Given the code fragment:
What is the result?
Given the code fragment:
Which modification enables the code to print 54321?
Given:
What is the result?
Given the code fragment:
What is the result?
Given:
What is the result?
Given the code fragment:
What is the result?
Given the code fragment:
What is the result?
Given the code fragments:
What is the result?
Given the code fragment:
Which code fragment, when inserted at line n1, enables the App class to print Equal?
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.)
Given:
What is the result?
Which one of the following code examples uses valid Java syntax?
Given the code fragment:
What is the result?
Given the code fragment:
What is the result?
You are asked to create a method that accepts an array of integers and returns the highest value from that array.
Given the code fragment:
Which method signature do you use at line n1?
Given the code fragment:
Which code fragment, inserted at line n1, prints The Top element: 30?
Which two class definitions fail to compile? (Choose two.)
Given the code fragment:
Which code fragment, when inserted at line 3, enables the code to print 10:20?
Which two code fragments cause a compilation error? (Choose two.)
What is the name of the Java concept that uses access modifiers to protect variables and hide them within a class?
You are developing a banking module. You have developed a class named ccMask that has a maskcc method.
Given the code fragment:
You must ensure that the maskcc method returns a string that hides all digits of the credit card number except the four last digits (and the hyphens that separate each group of four digits).
Which two code fragments should you use at line n1, independently, to achieve this requirement? (Choose two.)
Given:
Acc.java:
Which statement is true?
Examine the content of App.java:
Which is true?