Revature
Assessment
(OOP &
Java)questions
and answers
Object-Oriented Programming - answer is a
methodology or paradigm to design a
program using classes and objects. It
simplifies the software development and
maintenance by providing some concepts
Object - answer Any entity that has state and
behavior. For example, a chair, pen, table,
keyboard, bike, etc. It can be physical or
logical
,Class - answer in the context of Java, are
templates that are used to create objects,
and to define object data types and methods
Advantages of OOPs over Procedure Oriented
Programming - answer OOPs makes
development and maintenance easier
whereas in a procedure-oriented
programming language it is not easy to
manage if code grows as project size
increases.
Constructor - answer It is called when an
instance of the object is created, and
memory is allocated for the object
When is a constructor called? - answer When
an object is created
Note: A default constructor is created if class
doesn't have any
Rules to remember while creating a
constructor - answer Constructor name must
be the same as its class name
, A Constructor must have no explicit return
type
A Java constructor cannot be abstract, static,
final, and synchronized
Types of constructors - answer Default
Constructor
Parameterized Constructor
Default Constructor - answer is a no-args
constructor that the Java compiler inserts on
your behalf
Parameterized Constructor - answer A
constructor which has a specific number of
parameters
Constructor Overloading - answer in Java is a
technique of having more than one
constructor with different parameter lists.
Assessment
(OOP &
Java)questions
and answers
Object-Oriented Programming - answer is a
methodology or paradigm to design a
program using classes and objects. It
simplifies the software development and
maintenance by providing some concepts
Object - answer Any entity that has state and
behavior. For example, a chair, pen, table,
keyboard, bike, etc. It can be physical or
logical
,Class - answer in the context of Java, are
templates that are used to create objects,
and to define object data types and methods
Advantages of OOPs over Procedure Oriented
Programming - answer OOPs makes
development and maintenance easier
whereas in a procedure-oriented
programming language it is not easy to
manage if code grows as project size
increases.
Constructor - answer It is called when an
instance of the object is created, and
memory is allocated for the object
When is a constructor called? - answer When
an object is created
Note: A default constructor is created if class
doesn't have any
Rules to remember while creating a
constructor - answer Constructor name must
be the same as its class name
, A Constructor must have no explicit return
type
A Java constructor cannot be abstract, static,
final, and synchronized
Types of constructors - answer Default
Constructor
Parameterized Constructor
Default Constructor - answer is a no-args
constructor that the Java compiler inserts on
your behalf
Parameterized Constructor - answer A
constructor which has a specific number of
parameters
Constructor Overloading - answer in Java is a
technique of having more than one
constructor with different parameter lists.