Question 12 Consider the following Java code. Integer x = calculateValue(); if (x) { System.out.println("correct"); } in

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Question 12 Consider the following Java code. Integer x = calculateValue(); if (x) { System.out.println("correct"); } in

Post by answerhappygod »

Question 12 Consider The Following Java Code Integer X Calculatevalue If X System Out Println Correct In 1
Question 12 Consider The Following Java Code Integer X Calculatevalue If X System Out Println Correct In 1 (75.68 KiB) Viewed 15 times
Question 12 Consider the following Java code. Integer x = calculateValue(); if (x) { System.out.println("correct"); } int y = x + 3; Which of the following statements are true? Select all that apply. This code uses the principle of unboxing. □ If x is not zero, the message correct will be printed. If x is null, the message correct will not be printed. This code will cause a runtime error. This code will cause a compilation error. Question 13 2 pts Which of the following statements regarding event driven programming are correct? You may select more than one answer. An event is usually generated due to a state change. A listener can handle events only from one component. Multiple listeners can respond to the same event. Event driven design results in better encapsulation. Event driven design decreases coupling between components. 2 pts

Question 16 Which of the following statements about encapsulation are true? Select all that apply. If all instance variables are marked private, encapsulation has been achieved. Encapsulation is a method of abstraction that hides implementation details from the user of a class. Encapsulation means that an attribute cannot be modified after creation. Encapsulation helps developers write reusable and maintainable code. ☐ Encapsulation means that an object can take on several forms. For example, a Lion is both a Feline and an Animal, Question 17 2 pts Consider the following class: 1 public class IntervalTimer { 2 public int elapsed = 0; public final int interval; 6 public IntervalTimer (int interval) { 7 this.elapsed = 0; 8 this.interval= interval; 9 } 10 11 public void tick () { 12 if (++elapsed EE interval) { 13 14 15 } 16 } 17 } Select all statements that are true: The class violated the principle of information hiding. The class uses delegation. Line 12 is logically incorrect. No statement is correct. This is a complete Java application. 3 4 5 2 pts System.out.println("Interval elapsed"); elapsed = 0;

Question 20 2 pts Which one of the following statements is NOT true about abstract classes: Abstract classes cannot have static attributes. Abstract classes can contain non-abstract methods. Abstract classes can have a constructor. O Methods defined in concrete classes have priority over methods in parent classes with the same method signature.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply