Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-851
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-851.html
Java Standard Edition 6 Programmer Certified Professional Exam
Question No: 121 – (Topic 2)
A company has a business application that provides its users with many different reports: receivables reports, payables reports, revenue projects, and so on. The company has just purchased some new, state-of-the-art, wireless printers, and a programmer has been assigned the task of enhancing all of the reports to use not only the company#39;s old printers, but the new wireless printers as well. When the programmer starts looking into the application, the programmer discovers that because of the design of the application, it is necessary to make changes to each report to support the new printers. Which two design concepts most likely explain this situation? (Choose two.)
-
Inheritance
-
Low cohesion
-
Tight coupling
-
High cohesion
-
Loose coupling
-
Object immutability
Answer: B,C
Question No: 122 – (Topic 2)
Given:
-
public class Hi {
-
void m1() { }
-
protected void() m2 { } 5. }
-
class Lois extends Hi {
-
// insert code here 8. }
Which four code fragments, inserted independently at line 7, will compile? (Choose four.)
-
public void m1() { }
-
protected void m1() { }
-
private void m1() { }
-
void m2() { }
-
public void m2() { }
-
protected void m2() { }
-
private void m2() { }
-
Answer: A,B,E,F
Question No: 123 – (Topic 2)
Given:
10: public class Hello { 11: String title;
12: int value;
13: public Hello() { 14: title = quot; Worldquot;; 15: }
16: public Hello(int value) { 17: this.value = value;
18: title = quot;Helloquot;; 19: Hello();
20: }
21: }
and:
30: Hello c = new Hello(5); 31: System.out.println(c.title); What is the result?
-
Hello
-
Hello World
-
Compilation fails.
-
Hello World 5
-
The code runs with no output.
-
An exception is thrown at runtime.
Answer: C
Question No: 124 – (Topic 2)
Given:
-
class Employee {
-
String name; double baseSalary;
-
Employee(String name, double baseSalary) {
-
this.name = name;
-
this.baseSalary = baseSalary; 8. }
9. }
-
public class SalesPerson extends Employee {
-
double commission;
-
public SalesPerson(String name, double baseSalary, double commission) {
-
// insert code here
14. }
15. }
Which two code fragments, inserted independently at line 13, will compile? (Choose two.)
-
super(name, baseSalary);
-
this.commission = commission;
-
super();
this.commission = commission;
-
this.commission = commission; super();
-
super(name, baseSalary); this.commission = commission;
-
this.commission = commission;
super(name, baseSalary);
-
super(name, baseSalary, commission);
Answer: A,E
Question No: 125 – (Topic 2)
A team of programmers is reviewing a proposed API for a new utility class. After some discussion, they realize that they can reduce the number of methods in the API without losing any functionality. If they implement the new design, which two OO principles will they be promoting?
-
Looser coupling
-
Tighter coupling
-
Lower cohesion
-
Higher cohesion
-
Weaker encapsulation
-
Stronger encapsulation
Answer: A
Question No: 126 – (Topic 2)
Given:
-
class ClassA {
-
public int numberOfInstances;
-
protected ClassA(int numberOfInstances) {
-
this.numberOfInstances = numberOfInstances; 5. }
-
6. }
-
public class ExtendedA extends ClassA {
-
private ExtendedA(int numberOfInstances) {
-
super(numberOfInstances);
10. }
-
public static void main(String[] args) {
-
ExtendedA ext = new ExtendedA(420);
-
System.out.print(ext.numberOfInstances);
14. }
15. }
Which statement is true?
-
420 is the output.
-
An exception is thrown at runtime.
-
All constructors must be declared public.
-
Constructors CANNOT use the private modifier.
-
Constructors CANNOT use the protected modifier.
Answer: A
Question No: 127 – (Topic 2)
Given:
-
class Building { }
-
public class Barn extends Building {
-
public static void main(String[] args) {
-
Building build1 = new Building();
-
Barn barn1 = new Barn();
-
Barn barn2 = (Barn) build1;
-
Object obj1 = (Object) build1;
-
String str1 = (String) build1;
-
Building build2 = (Building) barn1;
14. }
15. }
Which is true?
-
If line 10 is removed, the compilation succeeds.
-
If line 11 is removed, the compilation succeeds.
-
If line 12 is removed, the compilation succeeds.
-
If line 13 is removed, the compilation succeeds.
-
More than one line must be removed for compilation to succeed.
Answer: C
Question No: 128 – (Topic 2)
Given:
-
public class TestOne {
-
public static void main (String[] args) throws Exception {
-
Thread.sleep(3000);
-
System.out.println(quot;sleepquot;); 5. }
6. }
What is the result?
-
Compilation fails.
-
An exception is thrown at runtime.
-
The code executes normally and prints quot;sleepquot;.
-
The code executes normally, but nothing is printed.
Answer: C
Question No: 129 – (Topic 2)
Given:
-
public class Threads4 {
-
public static void main (String[] args) {
-
new Threads4().go(); 4. }
-
-
-
-
public void go() {
-
Runnable r = new Runnable() {
-
public void run() {
-
System.out.print(quot;fooquot;); 9. }
10. };
-
Thread t = new Thread(r);
-
t.start();
-
t.start();
14. }
15. }
What is the result?
-
Compilation fails.
-
An exception is thrown at runtime.
-
The code executes normally and prints quot;fooquot;.
-
The code executes normally, but nothing is printed.
Answer: B
Question No: 130 – (Topic 2)
Which two statements are true? (Choose two.)
-
It is possible for more than two threads to deadlock at once.
-
The JVM implementation guarantees that multiple threads cannot enter into a deadlocked state.
-
Deadlocked threads release once their sleep() method#39;s sleep duration has expired.
-
Deadlocking can occur only when the wait(), notify(), and notifyAll() methods are used incorrectly.
-
It is possible for a single-threaded application to deadlock if synchronized blocks are used incorrectly.
-
If a piece of code is capable of deadlocking, you cannot eliminate the possibility of deadlocking by inserting invocations of Thread.yield().
Answer: A,F
100% Ensurepass Free Download!
–Download Free Demo:1z0-851 Demo PDF
100% Ensurepass Free Guaranteed!
–1z0-851 DumpsEnsurePass ExamCollection Testking Lowest Price Guarantee Yes No No Up-to-Dated Yes No No Real Questions Yes No No Explanation Yes No No PDF VCE Yes No No Free VCE Simulator Yes No No Instant Download Yes No No HOT CATEGORY!HOT EXAM!100-105 Dumps VCE PDF
200-105 Dumps VCE PDF
300-101 Dumps VCE PDF
300-115 Dumps VCE PDF
300-135 Dumps VCE PDF
300-320 Dumps VCE PDF
400-101 Dumps VCE PDF
640-911 Dumps VCE PDF
640-916 Dumps VCE PDF
70-410 Dumps VCE PDF
70-411 Dumps VCE PDF
70-412 Dumps VCE PDF
70-413 Dumps VCE PDF
70-414 Dumps VCE PDF
70-417 Dumps VCE PDF
70-461 Dumps VCE PDF
70-462 Dumps VCE PDF
70-463 Dumps VCE PDF
70-464 Dumps VCE PDF
70-465 Dumps VCE PDF
70-480 Dumps VCE PDF
70-483 Dumps VCE PDF
70-486 Dumps VCE PDF
70-487 Dumps VCE PDF
220-901 Dumps VCE PDF
220-902 Dumps VCE PDF
N10-006 Dumps VCE PDF
SY0-401 Dumps VCE PDF