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
Document preview thumbnail
Preview 2 out of 7 pages
Exam (elaborations)

ITSC 1213 QUESTIONS AND ANSWERS SET A.pdf

Document preview thumbnail
Preview 2 out of 7 pages

ITSC 1213 QUESTIONS AND ANSWERS SET A.pdf

Content preview

ITSC 1213 QUESTIONS AND ANSWERS SET A+
✔✔A car dealership needs a program to store information about the cars for sale. For
each car, they want to keep track of the following information: number of doors (2 or 4),
whether the car has air conditioning, and its average number of miles per gallon. Which
of the following is the best design? - ✔✔Use a class Car, with fields: numDoors, hasAir,
and milesPerGallon.

✔✔If you have a parent class Animal that has a method speak() which returns: Awk.
Cat has a speak method that returns: Meow. Bird does not have a speak method. Dog
has a speak method that returns: Woof. Pig does not have a speak method. Cow has a
speak method that returns: Moo. What is the output from looping through the array a
created below and asking each element to speak()?

Animal[] a = { new Cat(), new Cow(), new Dog(), new Pig(), new Bird() } - ✔✔Meow Moo
Woof Awk Awk

✔✔What Java keyword is used to set up an inheritance relationship between a subclass
and a superclass? - ✔✔extends

✔✔What best describes the purpose of a class's constructor? - ✔✔Initialize the fields in
the object.

✔✔define polymorphism: - ✔✔NOT using the same name for a method but altering
which parameters it accepts for increased specificity

✔✔Given the following class definitions and a declaration of Book b = new Dictionary
which of the following will cause a compile-time error?

public class Book
{
public String getISBN()
{
// implementation not shown

, }
// constructors, fields, and other methods not shown
}
public class Dictionary extends Book
{
public String getDefinition()
{
//
implementation not shown
}
} - ✔✔b.getDefintion();

✔✔Given the following class declarations, what is the output from Student s1 = new
GradStudent(); followed by s1.getInfo();?

public class Student
{
public String getFood()
{
return "Pizza";
}
public String getInfo()
{
return this.getFood();
}
}
public class GradStudent extends Student
{
public String getFood()
{
return "Taco";
}
} - ✔✔Taco

✔✔Below is the class Greeter and its method, greet:

public class Greeter{ public String greet() { return "Hi"; }
}

What is the correct way to implement the overridden get method of the child class,
MeanGreeter, so that it returns "Go Away"?

I.
class MeanGreeter extends Greeter{ public String greet() { return "Go Away"; }}

II.

Document information

Uploaded on
August 8, 2026
Number of pages
7
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$17.49

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

Sold
1
Followers
2
Items
2433
Last sold
1 week ago


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