Revature 2 Flashcards

1
Q

What is the difference between a queue and a stack?

A

A stack is an ordered list of elements where all insertions and deletions are made at the same end, whereas a queue is exactly the opposite of a stack which is open at both the ends meaning one end is used to insert data while the other to remove data.

Stack is known as LIFO and queue is known as FIFO rule .

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

What is the difference between a set and a map?

A

Both interfaces are used to store the collection of objects as a single unit. The main difference between Set and Map is that Set contains only data elements, and the Map contains the data in the key-value pair, so Map contains key and its value.

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

What is the difference between an abstract class and an interface?

A

An abstract class allows you to create functionality that subclasses can implement or override.

An interface only allows you to define functionality, not implement it

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

What is a constructor and how is it called?

A

In Java, a constructor is a block of codes similar to the method. It is called when an instance of the object is created, and memory is allocated for the object.

It is a special type of method which is used to initialize the object.

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

What does WHERE do in SQL?

A

The SQL WHERE clause is used to specify a condition while fetching the data from a single table or by joining with multiple tables. The WHERE clause is used to filter records. It is used to extract only those records that fulfill a specified condition.

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

What is the difference between method overload and method overriding?

A

Overloading occurs when two or more methods in one class have the same method name but different parameters.

Overriding means having two methods with the same method name and parameters

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

What is a class (Java)?

A

A class, in the context of Java, are templates that are used to create objects, and to define object data types and methods. Core properties include the data types and methods that may be used by the object

A class can also be defined as a blueprint from which you can create an individual object. Class doesn’t consume any space.

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