100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
PRO192 Chapter 6 Questions and Answers 2024 $9.49   Add to cart

Exam (elaborations)

PRO192 Chapter 6 Questions and Answers 2024

 4 views  0 purchase
  • Course
  • Institution

PRO192 Chapter 6 Questions and Answers 2024 Consider this class: 1. public class Test1 { 2. public float aMethod(float a, float b) { 3. } 4. 5. } Which of the following methods would be legal if added (individually) at line 4? (Choose all that apply.) A. public int aMethod(int a, int b) ...

[Show more]

Preview 2 out of 6  pages

  • August 11, 2024
  • 6
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
avatar-seller
PRO192 Chapter 6

Consider this class:
1. public class Test1 {
2. public float aMethod(float a, float b) {
3. }
4.
5. }
Which of the following methods would be legal if added (individually) at line 4? (Choose
all
that apply.)
A. public int aMethod(int a, int b) { }
B. public float aMethod(float a, float b) { }
C. public float aMethod(float a, float b, int c) throws Exception { }
D. public float aMethod(float c, float d) { }
E. private float aMethod(int a, int b, int c) { } ** Answ** a,c,e

Consider these classes, defined in separate source files:
1. public class Test1 {
2. public float aMethod(float a, float b)
3. throws IOException {...
4. }
5. }
1. public class Test2 extends Test1 {
2.
3. }
Which of the following methods would be legal (individually) at line 2 in class Test2?
(Choose
all that apply.)
A. float aMethod(float a, float b) {...}
B. public int aMethod(int a, int b) throws Exception {...}
C. public float aMethod(float a, float b) throws Exception {...}
D. public float aMethod(float p, float q) {...} ** Answ** b,d

You have been given a design document for a veterinary registration system for
implementation
in Java. It states:
"A pet has an owner, a registration date, and a vaccination-due date. A cat is a pet that
has a
flag indicating whether it has been neutered, and a textual description of its markings."
Given that the Pet class has already been defined, which of the following fields would
be
appropriate for inclusion in the Cat class as members? (Choose all that apply.)
A. Pet thePet;

, B. Date registered;
C. Date vaccinationDue;
D. Cat theCat;
E. boolean neutered;
F. String markings; ** Answ** e,f

You have been given a design document for a veterinary registration system for
implementation
in Java. It states:
"A pet has an owner, a registration date, and a vaccination-due date. A cat is a pet that
has a
flag indicating if it has been neutered, and a textual description of its markings."
Given that the Pet class has already been defined and you expect the Cat class to be
used freely
throughout the application, how would you make the opening declaration of the Cat
class, up
to but not including the first opening brace? Use only these words and spaces: boolean,
Cat,
class, Date, extends, Object, Owner, Pet, private, protected, public, String.
A. protected class Cat extends Owner
B. public class Cat extends Object
C. public class Cat extends Pet
D. private class Cat extends Pet ** Answ** c

Consider the following classes, declared in separate source files:
1. public class Base {
2. public void method(int i) {
3. System.out.print("Value is " + i);
4. }
5. }
1. public class Sub extends Base {
2. public void method(int j) {
3. System.out.print("This value is " + j);
4. }
5. public void method(String s) {
6. System.out.print("I was passed " + s);
7. }
8. public static void main(String args[]) {
9. Base b1 = new Base();
10. Base b2 = new Sub();
11. b1.method(5);
12. b2.method(6);
13. }
14. }
What output results when the main method of the class Sub is run?
A. Value is 5Value is 6

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller smartchoices. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $9.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

81849 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$9.49
  • (0)
  Add to cart