100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Sale notes online your Nr 1 Resource,for passing Exam at VCU $12.99   Add to cart

Exam (elaborations)

Sale notes online your Nr 1 Resource,for passing Exam at VCU

 13 views  0 purchase
  • Course
  • Institution
  • Book

I've written dozens of study guides for all my this material you'll be sure to pass your exams,Questions? Don't hesitate to send me messages

Preview 2 out of 8  pages

  • August 2, 2023
  • 8
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
avatar-seller
EXCEL ENGINEERING COLLEGE
(Autonomous)
COMPUTER SCIENCE AND ENGINEERING
III Semester
20CS302 – OBJECT ORIENTED PROGRAMMING
Regulations 2020
Question Bank with Answer Key
UNIT – II (INHERITANCE AND INTERFACES)
PART- A
Q.No Questions
State the conditions to be satisfied while declaring abstract classes.
1  An abstract class must be declared with an abstract keyword.
 It can have abstract and non-abstract methods.
 It cannot be instantiated.
What is this () and super () keyword?
2  super() acts as immediate parent class constructor and should be first line in child class constructor.
 this() acts as current class constructor and can be used in parametrized constructors
List out the two uses of final keyword.
3  In Java, the final keyword is used to denote constants.
 It can be used with variables, methods, and classes. Once any entity (variable, method or class) is declared final
, it can be assigned only once.
Define interface.
4  An interface is declared by using the interface keyword. It provides total abstraction; means all the methods in
an interface are declared with the empty body, and all the fields are public, static and final by default.
 A class that implements an interface must implement all the methods declared in the interface.
List out the different types of access modifiers.
 Public.
 Private.
5  Protected.
 Internal.
 Protected Internal.
 Private Protected.
Define Encapsulation.
 Encapsulation in Java is a process of wrapping code and data together into a single unit, for example, a capsule
6
which is mixed of several medicines.
 We can create a fully encapsulated class in Java by making all the data members of the class private.
What is meant by Garbage Collection?
 Garbage collection (GC) is a memory recovery feature built into programming languages such as C# and Java.
7
 A GC-enabled programming language includes one or more garbage collectors (GC engines) that automatically
free up memory space that has been allocated to objects no longer needed by the program.
Distinguish between method overloading and method overriding.
 Method overloading is a compile-time polymorphism. Method overriding is a run-time polymorphism. It helps to
8 increase the readability of the program.
 It is used to grant the specific implementation of the method which is already provided by its parent class or
superclass.
Distinguish between abstract class and interface.
 Abstract Class Vs. Interface: Explore the Difference between Abstract Class and Interface in Java. The Abstract
9 class and Interface both are used to have abstraction.
 An abstract class contains an abstract keyword on the declaration whereas an Interface is a sketch that is used
to implement a class.
Define abstract class.
10
 An abstract class is a class that is declared abstract —it may or may not include abstract methods.

,  Abstract classes cannot be instantiated, but they can be subclassed. When an abstract class is subclassed, the
subclass usually provides implementations for all of the abstract methods in its parent class.
What is meant by an inner class?
 In object-oriented programming (OOP), an inner class or nested class is a class declared entirely within the body
11
of another class or interface.
 It is distinguished from a subclass.
What is the difference between super class and subclass?
 A class that is derived from another class is called a subclass (also a derived class, extended class, or child
12
class).
 The class from which the subclass is derived is called a superclass (also a base class or a parent class).
Distinguish between class and interface.
 A class describes the attributes and behaviors of an object. An interface contains behaviors that a class
13
implements. A class may contain abstract methods, concrete methods.
 An interface contains only abstract methods.
Tell about Inheritance.
14  Inheritance is the process by which genetic information is passed on from parent to child.
 This is why members of the same family tend to have similar characteristics.
Define Polymorphism.
 Polymorphism is a feature of object-oriented programming languages that allows a specific routine to use
15 variables of different types at different times.
 Polymorphism is the ability of a programming language to present the same interface for several different
underlying data types.
List the four methods provided by the object class.
 toString() Method.
16  hashCode() Method.
 equals(Object obj) Method.
 getClass() method.
Define Package.
17  A package in Java is used to group related classes. Think of it as a folder in a file directory.
 We use packages to avoid name conflicts, and to write a better maintainable code.
What is the difference between a static and a non-static inner class.
 Non-static nested classes (inner classes) have access to other members of the enclosing class, even if they are
18
declared private.
 Static nested classes do not have access to other members of the enclosing class.
What are inner class and anonymous class?
 It is an inner class without a name and for which only a single object is created.
19
 An anonymous inner class can be useful when making an instance of an object with certain “extras” such as
overriding methods of a class or interface, without having to actually subclass a class.
Define Command line arguments.
 Command line arguments are nothing but simply arguments that are specified after the name of the program in
20
the system's command line.
 The argument values are passed on to your program during program execution.

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 or Stuvia-credit 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 vengatedits. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

62890 documents were sold in the last 30 days

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

Start selling
$12.99
  • (0)
  Add to cart