• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 7 pages
Exam (elaborations)

CMSC 132 EXAM #1(All solved)

Document preview thumbnail
Preview 2 out of 7 pages

Classes can only extend more than one other class if at least one of those classes is an abstract class. correct answers False - a Class can never extend more than one class. Downcasting can be done implicitly. correct answers False - it must be done explicitly or your code will not compile. "Sideways" casting is never allowed correct answers True '' will refer to the current object, treating it as an instance of the parent of the parent of the current class. correct answers True. For example, if class C extends class B, which extends class A, then calling "String()" from within class C will return the result of A's toString method. Constructors in subclasses must directly invoke the constructors of every single parent class before initializing the instance variables unique to that subclass. correct answers False - usually, a single call to the constructor of the immediate superclass is needed, however. This is done with the keyword 'super' and must be the first line in the constructor. . Assume there is a method named foo in a superclass A, which has been overridden in B (a subclass of A). If () is called from within class B, it will run the foo() method from class A, but if foo() is called from within class B, it will run the foo() method from class B. correct answers True Every class is a subclass of Object. correct answers True - note that this question doesn't necessarily mean that the class is ONLY a subclass of Object, but every class does inherit from Object, either directly or indirectly. When you override a method, you are allowed to change the number of arguments. correct answers False - the method signature must be exactly the same When you overload a method, you are allowed to change the number of arguments. correct answers True To sort an ArrayList of MyObject objects using C, MyObject must have an implementation of the compareTo method defined in the class. correct answers False - you can also pass in a Comparator with the compare method. Unchecked exceptions are generally for common exceptions that need to be accounted for. correct answers False - this is describing checked exceptions, not unchecked exceptions. An abstract class must include at least one abstract method. correct answers False An abstract class can contain instance variables and constructors. correct answers True


Document information

Uploaded on
May 28, 2024
Number of pages
7
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers
$11.69

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

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.
Sold
23
Followers
6
Items
4026
Last sold
1 month 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

Whoops! We can’t load your doc right now. Try again or contact support.