Classes and Objects 1 Flashcards

1
Q

What are the 4 basic concepts that support all programming languages?

A
  • Calculation: constants, variables, operators, expressions
  • Selection: if-else, switch, ?
  • Iteration: while, do, for
  • Abstraction: The process of creating self-contained units of software that allows the solution to be parameterized and therefore more general purpose
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the definition of abstraction in object oriented languages?

A

Abstraction in Object Oriented (OO) languages is provided through an Abstract Data Type (ADT), which contains data and functions that operate on data

Example: class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the definition of class?

A

A fundamental unit of abstraction that represents an “entity” that is part of a problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the definition of Objects?

A

Objects are an instance of a class that contain state, or dynamic information

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an instance?

A

An instance is an object that exists in your code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the object oriented features?

A
  • Data Abstraction
  • Encapsulation
  • Information Hiding
  • Delegation
  • Inheritance
  • Polymorphism
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the definition of data abstraction?

A

The technique of creating new data types that are well suited to an application by defining new classes.

Class example: circle in the drawing pad

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the definition of encapsulation?

A

The ability to group data (attributes) and methods that manipulate the data to a single entity though defining a class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is an instance variable?

A

A property or attribute that is unique to each instance (object) of a class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a local variable?

A

A local variable is a variable declared inside the method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is null?

A

The Java keyword for “no object here”. Null objects can’t be “accessed” to get variables or methods, or used in any way

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is instantiate?

A

To create an object of a class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is new?

A

Directs the JVM to allocate memory for an object, or instantiate it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When is an object a candidate for Java Automatic Garbage Collection?

A

When the object doesn’t have a valid reference, hence cannot be used in future

How well did you know this?
1
Not at all
2
3
4
5
Perfectly