Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

PRO192 Chapter 6 Questions and Answers 2024

Rating
-
Sold
-
Pages
6
Grade
A+
Uploaded on
11-08-2024
Written in
2024/2025

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) { } 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) { }

Show more Read less
Institution
Course

Content preview

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

Written for

Course

Document information

Uploaded on
August 11, 2024
Number of pages
6
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$9.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF


Also available in package deal

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
smartchoices Chamberlain College Of Nursing
Follow You need to be logged in order to follow users or courses
Sold
36
Member since
5 year
Number of followers
5
Documents
4499
Last sold
4 weeks ago

4.8

9 reviews

5
7
4
2
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions