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 13 pages
Exam (elaborations)

ITSC 1213 COMPREHENSIVE QUESTIONS AND ANSWERS SET A.pdf

Document preview thumbnail
Preview 2 out of 13 pages

ITSC 1213 COMPREHENSIVE QUESTIONS AND ANSWERS SET A.pdf

Content preview

ITSC 1213 COMPREHENSIVE QUESTIONS AND
ANSWERS SET A+
✔✔Given the following class definitions which of the following would not compile if it
was used in place of the missing code in the main method?
***

Parent Class
class Item
{
private int x;
public void setX(int theX)
{
x = theX;
}
// ... other methods not shown
}

Child Class
public class EnhancedItem extends Item
{
private int y;
public void setY(int theY)
{
y = theY;
}
// ... other methods not shown
public static void main(String[] args)
{
EnhancedItem currItem = new EnhancedItem();
// missing code
}
} - ✔✔currItem.x = 3;

, ✔✔A program is being written by a team of programmers. One programmer is
implementing a class called Employee; another programmer is writing code that will use
the Employee class. Which of the following aspects of the public methods and fields of
the Employee class does not need to be known by both programmers? - ✔✔How the
methods are implemented.

✔✔What is the output from running the main method in the Car class?

public class Car
{
private int fuel;
public Car()
{
fuel = 0;
}
public Car(int g)
{
fuel = g;
}
public void addFuel()
{
fuel++;
}
public void display()
{
System.out.print(fuel + " ");
}
public static void main(String[] args)
{
Car car = new Car(5);
Car fastCar = new RaceCar(5);
car.display();
car.addFuel();
car.display();
fastCar.display();
fastCar.addFuel();
fastCar.display();
}
}
class RaceCar extends Car
{
public RaceCar(int g)
{
super(2*g);
}
} - ✔✔NOT 5656

Document information

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

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
2365
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