100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CSE 1322 Lab and Lecture Final Exam Review Questions with 100% Actual correct answers | verified | latest update | Graded A+ | Already Passed | Complete Solution £6.37   Add to cart

Exam (elaborations)

CSE 1322 Lab and Lecture Final Exam Review Questions with 100% Actual correct answers | verified | latest update | Graded A+ | Already Passed | Complete Solution

 10 views  0 purchase
  • Institution
  • CSE

CSE 1322 Lab and Lecture Final Exam Review Questions with 100% Actual correct answers | verified | latest update | Graded A+ | Already Passed | Complete Solution

Preview 3 out of 21  pages

  • June 26, 2024
  • 21
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
All documents for this subject (326)
avatar-seller
Hkane
CSE 1322 Lab and Lecture Final Exam Review
What is inheritance? - ANS-a fundamental principle of object-oriented programming. It allows a
class to "inherit" (behavior or characteristics) of another, more general class and it allows a new
class to "absorb" an existing class's members and it saves time by reusing proven and
debugged high-quality software

The class from which we inherit is referred to as - ANS-parent class or base class / super class

What does the keyword base indicate? - ANS-that the base class must be used allows access
to its methods, constructors and member variables. Using base(), we can call the constructor of
the base class. Using base.Method(...) we can invoke a method of the base class, pass
parameters to it and use its results. Using base.field we can get the value of a member variable
from the base class or assign a different one to it

When inheriting a class, - ANS-our constructors must call the base class constructor, so that it
can initialize its member variables.

The keyword protected: - ANS-defines class members which are not visible to users of the class
(those who initialize and use it), but are visible to all inheriting classes (descendants)

The keyword protected internal: - ANS-defines class members which are both internal, i.e.
visible within the entire assembly, and protected, i.e. not visible outside the assembly, but visible
to classes who inherit it (even outside the assembly)

When a base class is inherited: - ANS-All of its public, protected and protected internal
members (methods, properties, etc.) are visible to the inheriting class. - All of its private
methods, properties and member-variables are not visible to the inheriting class. - All of its
internal members are visible to the inheriting class, only if the base class and the inheriting class
are in the same assembly (the same Visual Studio project).

Downcasting - ANS-casting a superclass to a subclass

A method, which can be overridden, is called - ANS-virtual

What is the difference between overloading and overriding methods? - ANS-overloading is when
there are 2 methods with the same name but different parameters but overriding is when
inherited methods are being redefined in another class

The class with which inherit from the parent class is referred to as either one of these: - ANS-a
derived class, a sub class, or child class

,Can you instantiate an abstract class? - ANS-no

Polymorphism - ANS-where a variable is changing types while the program is running

What does inheritance allow? - ANS-a new class to "absorb" an existing class's members

How does inheritance save time? - ANS-by reusing proven and debugged high-quality software

UML - ANS-Unified Modeling Language

UML Diagram - ANS-graphical representation of relationship between classes and is used for
depicting objects and object oriented concepts

When should inheritance be used? - ANS-when classes are similar

What does inheritance support? - ANS-through an extended / derived class supports code
reuse.

A method override occurs when two methods in the same class have the exact same method
signature. True or False? - ANS-False

toString( )(Java) or ToString() (C#) is a method that is in the Object class that is inherited by all
Java / C# classes. True or False? - ANS-True

When a set of methods have the same name but different types/number of parameters in the
same class, they are called: - ANS-Overloaded methods

Abstract methods are used in defining - ANS-classes that need no methods implemented

he reserved word super (in Java) or base (in C#). <method name> is used call the method
which is defined in - ANS-the parent class

A class can inherit from the methods from its classes. - ANS-super, parent, abstract, or
interfaces

What is the goal of encapsulation? - ANS-To hide the values or state of a structured an object
inside a class, preventing unauthorized direct access to them

Since toString() is a method that is in the Object class, any call to the toString() method refers to
the toString( ) method in the Object class unless - ANS-specifically overridden in the child class

The unique feature of an abstract class is that - ANS-a subclass that extends it doesn't need to
have the abstract reserved word in its declaration.

, In a UML diagram, the arrows - ANS-point up to classes they inherit from

What does @Override do? - ANS-tells the compiler to check the override is correct

Equals(Object) Method - ANS-Determines whether the specified object is equal to the current
object.

Equals(Object, Object) Method - ANS-Determines whether the specified object instances are
considered equal.

Finalize( ) Method - ANS-- if you wish to execute code just before an object is destroyed by the
garbage collector, create a _______ method in the class and place the code there
- accepts no arguments
- void return type
Allows an object to try to free resources and perform other cleanup operations before it is
reclaimed by garbage collection.

GetHashCode( ) Method - ANS-Serves as the default hash function

GetType( ) Method - ANS-Gets the Type of the current instance

MemberwiseClone( ) Method - ANS-Creates a shallow copy of the current Object

ReferenceEquals(Object, Object) Method - ANS-Determines whether the specified Object
instances are the same instance

ToString( ) Method - ANS-Returns a string that represents the current object

clone( ) Method - ANS-makes a new object with the same state as an existing object and
creates and returns a copy of this object

equals​(Object obj) Method - ANS-Indicates whether some other object is "equal to" this one

getClass​( ) Method - ANS-Returns the runtime class of this Object

hashCode​( ) Method - ANS-Returns a hash code value for the object

notify( ) Method - ANS-Wakes up a single thread that is waiting on this object's monitor

notifyAll​( ) Method - ANS-Wakes up all threads that are waiting on this object's monitor

toString( ) Method - ANS-Returns a string representation of the object

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 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 Hkane. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

79271 documents were sold in the last 30 days

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

Start selling
£6.37
  • (0)
  Add to cart