Terms Flashcards

1
Q

<p>Primitive Data Types

| </p>

A

<p>Boolean, char, byte, short, int, long, float, and double.</p>

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

<p>Fields/Member variables/Instance Variables</p>

A

<p>A \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ is a variable that is defined outside of any methods but inside of a class.</p>

Belong to each instance of the object.

Held in slots on the heap associated with their instances.

Maintain the state of their object.

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

<p>Reference Data Types</p>

A

<p>Reference variables used to access objects.

Declared to be a specific type(Car, Dog, String, Array, ect) which cannot be changed.

Can reference any object of the declared type.</p>

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

<p>Java</p>

A

<p>A multithreaded, architecture-neutral, portable, object-oriented, interpreted, dynamic, programming language first developed by Sun Microsystems in 1995.</p>

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

<p>The four principle concepts of Object Oriented Programming</p>

A

<p>Abstraction, Polymorphism, Inheritance, and Encapsulation. (A-PIE)</p>

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

<p>String</p>

A

<p>A complex type, meaning that is is a class. It has several built in methods that you can use to perform tasks. The difference is that you do not have to use new to build it.</p>

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

<p>Methods</p>

A

<p>A collection of statements that are grouped together to perform an operation.</p>

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

<p>Method Overloading</p>

A

<p>When a class has two or more methods by the same name but different parameters. Different functionality based on the parameters. </p>

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

<p>Control Flow/Conditional Statements</p>

A

<p>Decision making structures have one or more conditions to be evaluated or tested by the program.

If: An if statement consists of a boolean expression followed by one or more statements.

If Else: An if statement can be followed by an optional else statement, which executes when the boolean expression is false.

Nested If: You can use one if or else if statement inside another if or else if statement(s).

Switch: A switch statement allows a variable to be tested for equality against a list of values.</p>

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

<p>Loop Control</p>

A

<p>Allows us to execute a statement or group of statements multiple times.

While: Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body.

For: Execute a sequence of statements multiple times and abbreviates the code that manages the loop variable.

Do While: Like a while statement, except that it tests the condition at the end of the loop body.</p>

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

<p>Break Statement</p>

A

<p>Terminates the loop or switch statement and transfers execution to the statement immediately following the loop or switch</p>

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

<p>Class</p>

A

<p>A template/blueprint that describes the behavior/state that the object of its type supports.</p>

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

<p>Local Variables</p>

A

<p>Variables defined inside methods, constructors or blocks. The variable will be declared and initialized within the method and the variable will be destroyed when the method has completed.</p>

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

<p>Instance Variables</p>

A

<p>Variables within a class but outside any method. These variables are initialized when the class is instantiated. Can be accessed from inside any method, constructor or blocks of that particular class.</p>

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

<p>Static Class Variables/Fields</p>

A

<p>Variables declared within a class, outside any method, with the static keyword. They have the same value in any instance of the class. Static, as in locked down.</p>

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

<p>Constructors</p>

A

<p>Each time a new object is created, at least one \_\_\_\_\_\_\_ will be invoked. The main rule of \_\_\_\_\_\_\_\_\_ is that they should have the same name as the class. A class can have more than one \_\_\_\_\_\_\_\_.</p>

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

<p>Package</p>

A

<p>A collection of related classes/interfaces.</p>

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

<p>Import Statements</p>

A

<p>The \_\_\_\_\_\_\_\_\_\_\_\_ \_\_\_\_\_\_\_\_\_\_\_\_ in Java is used to refer to classes which are declared in other packages to be accessed without referring to the full package name.</p>

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

<p>Inheritance</p>

A

<p>The process where one class acquires the properties (methods and fields) of another. With the use of \_\_\_\_\_\_\_\_ the information is made manageable in a hierarchical order.

Denoted by the keywords "extends" for a class and "implements" for an interface".

Creates an IS-A relationship. The class that inherits from another class IS-A type of that other class.

Makes code DRYer.</p>

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

<p>Polymorphism</p>

A

<p>The ability of an object to take on many forms. The ability of child classes to define their own behavior while also sharing some functionalities with the parent class by using the "extends" keyword.

Any Java object that can pass more than one IS-A test is considered to be \_\_\_\_\_\_\_\_. In Java, all Java objects are \_\_\_\_\_\_\_\_ since any object will pass the IS-A test for their own type and for the class Object.

Also applies to overloaded methods, since they are methods that have multiple forms.</p>

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

<p>Composition</p>

A

<p>When an instance of a class is a field of another.

The class with and instance of another as a field is said to have a HAS-A relationship with that other class.</p>

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

<p>Encapsulation</p>

A

<p>One of the four fundamental OOP concepts. The other three are inheritance, polymorphism, and abstraction.

A mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. In \_\_\_\_\_\_\_\_, the variables of a class will be hidden (private) from other classes, and can be ACCESSED only through the methods of their current class. Therefore, it is also known as data hiding.

Requires getters and setters to access the variables.

Helps make code maintainable, flexible, and extensible.</p>

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

<p>Inner Class</p>

A

<p>A class within another class. Used when a class only makes sense in the context of another class.</p>

Two Types: Local Inner Classes and Anonymous Inner Classes.

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

<p>Abstraction</p>

A

<p>A process of HIDING implementation details, only the functionality will be shown. In other words, we have the information on what the object/method does instead of how it does it.

Makes code easier to read and understand and makes code DRYer. </p>

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

<p>Abstract Class</p>

A

<p>1) \_\_\_\_\_\_\_\_\_ \_\_\_\_\_\_\_\_ may or may not contain \_\_\_\_\_\_\_\_ methods, i.e., methods without body ( public void get(); )

2) But, if a class has at least one \_\_\_\_\_\_\_ method, then the class must be declared \_\_\_\_\_\_\_\_.
3) If a class is declared \_\_\_\_\_\_\_, it cannot be instantiated.
4) To use an \_\_\_\_\_\_\_\_ \_\_\_\_\_\_, you have to inherit it from another class, provide implementations to the abstract methods in it.
5) If you inherit an \_\_\_\_\_\_\_\_\_ \_\_\_\_\_\_, you have to provide implementations to all the \_\_\_\_\_\_\_\_ methods in it.</p>

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

<p>Interfaces</p>

A

<p>A reference type in Java, it is similar to class. It is a collection of abstract methods. A class implements an \_\_\_\_\_\_\_\_\_\_, thereby inheriting the abstract methods of the \_\_\_\_\_\_\_\_\_\_\_.

Along with abstract methods, an \_\_\_\_\_\_\_\_ may also contain constants, default methods, static methods, and inner classes. Method bodies exist only for default methods and static methods.

Writing an \_\_\_\_\_\_\_ is similar to writing a class. But a class describes the attributes and behaviors of an object. And an \_\_\_\_\_\_\_ contains behaviors that a class implements.

Unless declared abstract, any class that implements an \_\_\_\_\_\_\_\_\_\_\_ must define all of the methods inside that \_\_\_\_\_\_\_\_\_\_\_.</p>

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

<p>Algorithms</p>

A

<p>These are the methods that perform useful computations, such as searching and sorting, on objects that implement collection interfaces. The \_\_\_\_\_\_\_\_\_ are said to be polymorphic: that is, the same method can be used on many different implementations of the appropriate collection interface.</p>

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

<p>Arrays</p>

A

<p>A data structure which stores a fixed-size sequential collection of elements of the same type. An \_\_\_\_\_\_ is used to store a collection of data, but it is often more useful to think of an \_\_\_\_\_\_\_ as a collection of variables of the same type.</p>

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

<p>Boxing</p>

A

<p>Converting primitive data types into object is called \_\_\_\_\_\_\_\_, and this is taken care by the compiler.</p>

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

<p>Unboxing</p>

A

<p>Converting objects types into primitive data types is called \_\_\_\_\_\_\_\_\_\_\_, and this is taken care by the compiler.</p>

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

<p>Generics</p>

A

When creating a collection generics allow us to insure type safety by adding the diamond operator <> containing the type narrowing the specialization of the collection to only to a certain type.

Generic methods are those methods that are written with a single method declaration and can be called with arguments of different types.

Generic methods have type parameter (the diamond operator enclosing the type) before the return type of the method declaration.

Type parameters can be bounded.

Generic methods can have different type parameters separated by commas in the method signature.

Method body for a generic method is just like a normal method.

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

<p>Stand-Alone Application</p>

A

<p>A program that does not require an operating systems services to run.</p>

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

<p>JavaFx</p>

A

<p>A set of graphics and media packages that enables developers to design, create, test, debug, and deploy rich client applications that operate consistently across diverse platforms.</p>

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

<p>I/O Streams</p>

A

<p>A stream can be defined as a sequence of data. There are two kinds of Streams

\_\_\_\_\_\_\_\_\_\_: Used to read data from a source.

\_\_\_\_\_\_\_\_\_\_: Used for writing data to a destination.</p>

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

<p>Application Control Interface (API)</p>

A

<p>A set of routines, protocols, and tools for building software applications.

Specify how software components should interact.

Provide the building blocks of programs.

In Java, this is a set of pre-written packages, classes, and interfaces with their respective methods, fields, and constructors. (JVM)</p>

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

<p>Exceptions</p>

A

<p>A problem that arises during the execution of a program. When an \_\_\_\_\_\_\_\_ occurs the normal flow of the program is disrupted and the program/Application terminates abnormally, which is not recommended, therefore, these exceptions are to be handled.</p>

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

<p>Databases</p>

A

<p>A repository of information managed by a \_\_\_\_\_\_\_\_ engine which ensures integrity of data and fast access to the data.</p>

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

<p>Regular Expressions</p>

A

<p>A special sequence of characters that helps you match or find other strings or sets of strings, using a specialized syntax held in a pattern. They can be used to search, edit, or manipulate text and data.</p>

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

<p>Object</p>

A

<p>An instance of a Class, with states and behaviors.</p>

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

<p>Three steps of object creation</p>

A

<p>1. Declaration with a object type and name

2. Instantiation with the "new" keyword
3. Initialization with a call to a constructor.</p>

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

<p>Object Oriented Programming (OOP)</p>

A

<p>Instead of a procedural list of actions, \_\_\_ is modeled around objects that interact with each other. Classes generate objects and define their structure, like a blueprint. The objects interact with each other to carry out the intent of the computer program.</p>

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

<p>Platform Independent</p>

A

<p>When Java is compiled, it is not compiled into platform specific machine, rather into \_\_\_\_\_\_\_\_\_\_\_\_\_ \_\_\_\_\_\_\_\_\_\_\_\_ byte code. This byte code is distributed over the web and interpreted by the Virtual Machine (JVM) on whichever platform it is being run on.</p>

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

<p>Architecture-Neutral</p>

A

<p>Java compiler generates an \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ object file format, which makes the compiled code executable on many processors, with the presence of Java runtime system.</p>

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

<p>Portable</p>

A

<p>Being architecture-neutral and having no implementation dependent aspects of the specification makes Java \_\_\_\_\_\_\_\_\_\_.</p>

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

<p>Multi-Threaded</p>

A

<p>A program contains two or more parts that can run concurrently and each part can handle a different task at the same time making optimal use of the available resources specially when your computer has multiple CPUs.

By definition, multitasking is when multiple processes share common processing resources such as a CPU. \_\_\_\_\_\_\_\_\_\_\_ extends the idea of multitasking into applications where you can subdivide specific operations within a single application into individual threads. Each of the threads can run in parallel. The OS divides processing time not only among different applications, but also among each thread within an application.

\_\_\_\_\_\_\_\_\_\_\_ enables you to write in a way where multiple activities can proceed concurrently in the same program.</p>

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

<p>Interpreted</p>

A

<p>Java byte code is translated on the fly to native machine instructions and is not stored anywhere. The development process is more rapid and analytical since the linking is an incremental and light-weight process.</p>

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

<p>Dynamic</p>

A

<p>Java programs can carry extensive amount of run-time information that can be used to verify and resolve accesses to objects on run-time.</p>

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

<p>Modifiers</p>

A

<p>Keywords used during declaration that can change the variable/method/class behavior.

Two types:

- Access modifiers
- Non-access modifiers</p>

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

<p>Model-View-Controller (MVC)</p>

A

<p>An architecture used to develop flexible web applications.

The \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ pattern results in separating the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements.

The \_\_\_\_\_ Encapsulates the application data (generally POJOs).

The \_\_\_\_ renders the model data and generates HTML output.

The \_\_\_\_\_\_\_\_\_ processes user requests before building a model and passing it to the \_\_\_\_ to be rendered.</p>

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

<p>Structured Query Language (SQL)</p>

A

<p>A domain specific language used for designing and managing data in a Relational Database.</p>

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

<p>RDBMS</p>

A

<p>Relational Database Management System</p>

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

<p>Representational State Transfer Application Programming Interface (REST API)</p>

A

<p>A \_\_\_\_ \_\_\_ is one built on the \_\_\_\_ architecture which uses HTTP requests to GET, PUT, POST, and DELETE data.</p>

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

<p>Java Database Connectivity (JDBC)</p>

A

<p>An API for Java that specifies how a client may access a database.</p>

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

<p>H2</p>

A

<p>An RDBMS written in Java that can support both in-memory (temporary during runtime) and persistent databases.</p>

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

<p>Java Persistence API (JPA)</p>

A

<p>A Java specification for accessing, persisting, and managing data between Java objects/classes and Relational Databases.</p>

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

<p>CRUD Repository</p>

A

<p>Create, Read, Update, Delete</p>

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

<p>Document Object Model (DOM)</p>

A

<p>A platform and language neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document.</p>

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

<p>Content Delivery Network (CDN)</p>

A

<p>A geographically distributed network of proxy servers and their data centers. The goal is to distribute service spatially relative to end-users to provide high availability and high performance.</p>

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

<p>Data Warehouse (DW or DWH)</p>

A

<p>A central repository of integrated data from one or more disparate sources.

Store current and historical data in one place.

Used for reporting and data analysis.</p>

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

<p>Lean Managment</p>

A

<p>An approach to running an organization that supports the concept of continuous improvement, a long-term approach to work that systematically seeks to achieve small, incremental changes in processes in order to improve efficiency and quality.

More and more value, less and less waste.</p>

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

<p>Thymeleaf</p>

A

<p>A modern server-side Java Template Engine for both web and standalone environments, capable of processing HTML, XML, JavaScript, CSS, and even plain text.</p>

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

<p>"private" Modifier</p>

A

<p>An access modifier which makes the class/method/ variable only visible to the class it's in.

The most restrictive access modifier.

Helps with encapsulation.

\_\_\_\_\_\_\_ variables need getters and setters to access them.</p>

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

<p>"public" Modifier</p>

A

<p>An access modifier which makes the class/method/ variable visible to every class, even ones outside the package via an import.</p>

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

<p>"protected" Modifier</p>

A

<p>An access modifier which makes the class/method/ variable only visible to its class, other classes in its package, and any subclasses of its class in other packages.</p>

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

<p>"static" Modifier</p>

A

<p>A non-access modifier which makes the declaration more general than instance specific.

Variables/methods declared \_\_\_\_\_\_ exist outside of instances of the class. The values of the \_\_\_\_\_ variables/methods are the same in any instance of the class.

Can be accessed independently of any class instance.

\_\_\_\_\_\_ variables are also called "class variables".</p>

66
Q

<p>"final" Modifier</p>

A

<p>A non-access modifier which doesn't allow a variable to be reassigned to another object. The state of the object that the variable is assigned to may still be changed.

When used on a method, that method cannot be overridden by any subclass.

~~~
Immutable class means that once an object is created, we cannot change its content. Along with being declared final, an immutable class has to have all data members declared final, a parameterized constructor, getter methods for all variables, and no setters.
</p>

~~~

67
Q

<p>The Default Modifier</p>

A

<p>In use when no modifier keyword is present on a class/method/variable.

Makes the class/method/variable accessible to all classes in the package. (same as protected)</p>

68
Q

<p>"abstract" Modifier</p>

A

<p>A non-access modifier which makes JVM wait for subclasses to implement the methods/classes.</p>

69
Q

<p>Wrapper Classes</p>

A

<p>All the \_\_\_\_\_\_\_\_ \_\_\_\_\_\_\_\_ (Integer, Long, Byte, Double, Float, Short) are subclasses of the abstract class Number.

The object of the \_\_\_\_\_\_\_ \_\_\_\_\_\_\_ contains or wraps its respective primitive data type.

It allows us to convert primitive into object and object into primitive.</p>

70
Q

<p>Overriding</p>

A

<p>A method has the same method name, return type, number of parameters, modifier etc. Uses @\_\_\_\_\_\_ notation.

One method \_\_\_\_\_\_\_ the functionality of another method.</p>

71
Q

<p>Subclass</p>

A

<p>The class which inherits the properties of another class. Also called a child-class.</p>

72
Q

<p>Superclass</p>

A

<p>The class whose properties are inherited. Also called a parent-class.</p>

73
Q

<p>The Diamond Problem</p>

A

<p>A problem entailing one class inheriting multiple forms of a single method, which is called multiple inherentance. Dealt with by using object associations.</p>

74
Q

<p>Dependency</p>

A

<p>Denotes the reliance of one class upon another to work. For example, when a class has a method which uses an instance of another class in its operation.</p>

75
Q

<p>What are the differences between an abstract class and an interface.</p>

A

<p>A class can only extend one abstract class, but can extend multiple interfaces.

An abstract class can hold non-abstract methods, while an interface cannot.

An abstract class can hold instance variables while an interface cannot.

An abstract class can have any visibility while an interface must be public.

An abstract class can contain constructors while an interface cannot.</p>

76
Q

Data Structure

A

A specialized format for organizing and storing data.

77
Q

Constants

A

Variables which cannot be reassigned or changed by a method. Denoted by the “final” keyword and ALL_CAPS_AND_UNDERSCORES naming convention.

78
Q

Association

A

Establishes relationship between two separate classes through their objects. The relationship can be one to one, One to many, many to one and many to many.

79
Q

Collection

A

Root interface for collections classes with basic methods like add(), remove(),
contains(), isEmpty(), addAll(), … etc.

80
Q

Set

A

Unordered. Doesn’t allow duplicates.

81
Q

List

A

Ordered. Can contain duplicates.

82
Q

Queue

A

Ordered by FIFO (first in, first out)

83
Q

Map

A

Contains key-value pairs. Doesn’t allow duplicates.

84
Q

ArrayList

A

Java _____ class can contain duplicate elements.

Java _____class maintains insertion order.

Java _____class is non synchronized.

Java _____allows random access because array works at the index basis.

In Java _____class, manipulation is slow because a lot of shifting needs to be occurred if any element is removed from the array list.

85
Q

LinkedList

A

Java _____ class can contain duplicate elements.

Java _____class maintains insertion order.

Java _____class is non synchronized.

In Java _____class, manipulation is fast because no shifting needs to be occurred.

Java _____class can be used as list, stack or queue.

86
Q

HashSet

A

_____stores the elements by using a mechanism called hashing.

_____contains unique elements only.

87
Q

LinkedHashSet

A

Contains only unique items, like a HashSet.

Maintains insertion order.

88
Q

TreeSet

A

Contains unique elements only like HashSet.

Access and retrieval times are quiet fast.

Maintains ascending order.

89
Q

HashMap

A

A _____contains values based on the key.

It contains only unique elements.

It may have one null key and multiple null values.

It maintains no order.

90
Q

LinkedHashMap

A

Like a HashMap, but it maintains insertion order.

91
Q

TreeMap

A

A _____ contains values based on the key.

It contains only unique elements.

It cannot have null key but can have multiple null values.

Maintains ascending order.

92
Q

HashTable

A

A _____ is an array of list. Each list is known as a bucket. The position of bucket is identified by calling the hashcode() method.

A _____ contains values based on the key.

It contains only unique elements.

It may have not have any null key or value.

It is synchronized.

93
Q

SOLID principles

A
  • Single-responsibility principle
  • Open-closed principle
  • Liskov substitution principle
  • Interface segregation principle
  • Dependency Inversion principle

_____ principles help software developers to achieve scalability and avoid that your code breaks every time you face a change.

94
Q

Single-Responsibility Principle

A

“A class should have only one reason to change.”

Class should have only one responsibility which means class should be highly cohesive and
implement strongly related logic.

Avoids design that is fragile and difficult to maintain.

Leads to a stronger cohesion in the class and looser coupling between dependency classes, a better readability and a code with a lower complexity.
.
95
Q

Open-Closed Principle

A

“Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification.”

Any class (or whatever you write) should be written in such a way that it can be used as is. It can be extended if need be, but it can never be modified.

Use the class in any way you need, but modifying its behavior comes by adding new code, never by modifying the old. The same principle can be applied for modules, packages, libraries.

By applying the ___________ you will get a loose coupling, you will improve readability and finally, you will be reducing the risk of breaking existing functionality.

96
Q

Liskov Substitution Principle

A

“subtypes must be substitutable for their base types”

Objects should be replaceable by instances of their subtypes, and that without affecting the functioning of your system from a client’s point of view.

Any overridden method of a subclass needs to accept the same input parameter values and return types as the method of the superclass.

This principle basically confirms that our abstractions are correct and helps us get a code that is easily reusable and class hierarchies that are very easily understood.

You can insure this by making test cases that execute a specific part of your application with objects of all subclasses to make sure that none of them causes an error or significantly changes its performance.

97
Q

Interface Segregation Principle

A

“Classes that implement interfaces, should not be forced to implement methods they do not use.”

Once an interface is becoming too large / fat and classes are implementing methods they don’t use, we absolutely need to split it into small interfaces that are more specific.

Intended to keep a system decoupled and thus easier to refactor, change, and deploy.

98
Q

Dependency Inversion Principle

A

“1. High level modules should not depend on low level modules rather both should depend on abstraction (interfaces).

  1. Abstraction should not depend on details; rather detail should depend on abstraction(interfaces).”

This can be insured by following the Open-Closed Principle and the Liskov Substitution Principle.

The Open/Closed Principle required a software component to be open for extension, but closed for modification. You can achieve that by introducing interfaces for which you can provide different implementations. The interface itself is closed for modification, and you can easily extend it by providing a new interface implementation.

Your implementations should follow the Liskov Substitution Principle so that you can replace them with other implementations of the same interface without breaking your application.

99
Q

Cohesion

A

When different parts of a system will work together to get better results than if each part would be working individually.

We want to aim for high ______.

100
Q

Coupling

A

The degree of dependence of a class, method or any other software entity.

We want to aim for low ______.

101
Q

What is a variable?

A

A named piece of memory that holds a value.

102
Q

What is a variable declaration?

A

The act of specifying the type and name of a variable

103
Q

What is a variable assignment?

A

The act of giving a declared variable a value

104
Q

What makes up a method’s signature?

A

The name of the method and it’s parameters

105
Q

What is a method parameter?

A

The variable / data that is to be passed to a method when it is called.

106
Q

What is a method body?

A

The code that executes when a method is called. Everything within the { … }

107
Q

What is the heap?

A

The location in memory where user-defined types are stored.

Reference variables referring to objects refer to the heap’s in-memory address of the objects they are referencing.

108
Q

What does the term override mean?

A

Override is when a child class implements a method differently than the parent class, thereby overridding the parents implementation.

109
Q

What does the term overload mean?

A

Overload is when methods with the same name exist, but have different parameter lists. Often seen in constructors.

110
Q

What is the difference between a while loop and a do/while loop?

A

While loops are not guaranteed to run, but Do/While loops will always run at least once.

111
Q

What is an exception?

A

An exceptional event in the running of the program. These represent events that disrupt the normal flow of the program.

112
Q

What is an unchecked exception?

A

An unchecked exception is an exception that need not be dealt with and comes about unforseen events during the course of the program. Examples would include NullPointerException or NumberFormatException.

113
Q

What is a checked exception?

A

A checked exception is an exception that must be dealt with before the program is able to compile. These are events that can be predicted and need to be thrown / caught. Example include IOException and SQLException.

114
Q

What is a runtime exception?

A

Essentially a unchecked exception.

115
Q

What is data hiding?

A

Another term for encapsulation. We hide the implementation from the user behing getters and setters so as to implement the Public Interface / Private Implementation model.

116
Q

What does it mean if one class is derived from another class?

A

That there is an inheritance or is-a relationship. One class, the base class, is the PARENT and the other, the derived class, is the CHILD.

117
Q

What does it mean if one class extends another class?

A

That there is an inheritance or is-a relationship. One class, the base class, is the PARENT and the other, the derived class, is the CHILD.

118
Q

What is a base class?

A

The parent class in an inheritance-based relationship.

119
Q

What is an abstract base class?

A

A parent class that is not able to be instantiated. Often used to represent a non-existent concept.

120
Q

What is a superclass?

A

The parent class in an inheritance-based relationship.

121
Q

What is a subclass?

A

The child class in an inheritance-based relationship.

122
Q

What is specialization?

A

In inheritance, the child class will have all the features of the parent, but then specialize based on it’s unique need.

123
Q

What does it mean to be loosely coupled?

A

That connected elements in an application depend on each other the the least extend possible.

124
Q

What does it mean to cast a variable?

A

When converting a variable from one format to a “smaller” format casting is need, such as going from long to int. Other examples would be when receiving and Object object and casting it to be a type we are expecting (as seen in Aspect Oriented Programming).

125
Q

What does a finally block do?

A

It will be the last piece of code that runs in a try/catch/finally block. This ALWAYS runs and is useful for cleaning up.

126
Q

What is a try/catch?

A

A block that will try to execute some code that is known to have a checked exception. If it fails, it will throw an exception which will be CAUGHT by the catch and should be dealt with.

127
Q

What does the throws keyword mean?

A

That a certain method throws a certain exception. This passes the “problem” up the line where it can be dealt with.

128
Q

How is the import keyword used?

A

It is used by saying import ~~~ where ~~~ is some library that we need. Commonly seen with Map/List/BigDecimal. These are all libraries that are not located in our specific program.

129
Q

What is a package?

A

A folder for code. Used to logically separate/organize the different parts of our program

130
Q

What is scope?

A

The lifecycle of a certain variable. This defines where access to a variable is allowed. Outer blocks can not access inner blocks, but inner blocks can access what’s in outer blocks.

131
Q

What is an accessor?

A

aka getter, gets values

132
Q

What is a mutator?

A

aka setter, sets values

133
Q

What is a constructor?

A

A special method in a class that is called when a new object is instantiated. This sets the “starting” state of the object.

134
Q

What is shadowing?

A

When two variables with the same name exist within the scope. The variable that has the smaller/more limited scope takes priority over the one with the broader scope.

135
Q

What is composition? How is it used?

A

Composition is objects being made up of other objects. It is used to improve cohesion in classes by having other objects do work that our object should not be doing in a form of delegation.

136
Q

What is the default constructor?

A

If not constructor for our class is called, a default constructor which takes no parameters is created and called every time we instantiate an object.

137
Q

Is the Java language pass by value or pass by reference?

A

Pass by value.

138
Q

What does pass by value mean?

A

Pass by value means that all parameters will be passed as the value stored in the stack. For primitives this is their actual value, but for user-defined objects the reference value will be passed.

This basically means that Java copies and passes the reference as the value, not the object. Thus, method manipulation will alter the objects, since the references point to the original objects. But since the references are copies, swaps will fail.

139
Q

What does pass by reference mean?

A

Pass by reference means that all parameters will be passed as their reference and not their value. This means that changes to an object in one place/method will be reflected in other places.

140
Q

What is the stack? What kinds of variables are created there?

A

The stack maintains method invocations.

Method calls are stacked inside of frames holding the currently running methods and the local variables and reference variables of those methods.

141
Q

How does the garbage collector know when to return memory to the heap?

A

A process that runs in the heap which deletes object in the heap once they no longer have any references on the stack, freeing memory for new objects.

142
Q

What is a stream (in the context of the new Java 8 Collection API)?

A

A stream is a uncontrollable enhanced for loop that allows us to perform aggregate and terminal operations.

143
Q

What are aggregate operations?

A

Operations on a stream that manipulate the data being stream (filter, search, adjust, manipulate)

144
Q

What is a pipeline?

A

A data source, intermediate operations and a terminal operation.

145
Q

What is garbage collection?

A

Automatic memory management where unreferenced objects on the heap are cleaned up.

146
Q

What is an iterator?

A

An object that enables you to cycle through a collection, obtaining or removing elements.

Created using the iterator() method provided by each collection class.

ListIterator extends Iterator and allows for bidirectional traversal or a list and the modification of elements.

147
Q

What is JavaDoc?

A

Javadoc is a tool which comes with JDK and it is used for generating Java code documentation in HTML format from Java source code, which requires documentation in a predefined format.

148
Q

What are the two categories of nested classes?

A
  • static nested class : Nested classes that are declared static are called static nested classes.
  • inner class : An inner class is a non-static nested class.
149
Q

What is a local inner class?

A

Local Inner Classes are the inner classes that are defined inside a block. Generally, this block is a method body. Sometimes this block can be a for loop, or an if clause.Local Inner classes are not a member of any enclosing classes.

They belong to the block they are defined within, due to which local inner classes cannot have any access modifiers associated with them. However, they can be marked as final or abstract.

These class have access to the fields of the class enclosing it.

Local inner class must be instantiated in the block they are defined in.

150
Q

What is a static nested class?

A
As with class methods and variables, a static nested class is associated with its outer class. And like static class methods, a static nested class cannot refer directly to instance variables or methods defined in its enclosing class: it can use them only through an object reference.
They are accessed using the enclosing class name.
151
Q

What level of access to the properties and methods of the enclosing class does a static nested class have?

A

A static nested class cannot refer directly to instance variables or methods defined in its enclosing class: it can use them only through an object reference.

152
Q

Under what conditions can a local class access variables in the enclosing scope?

A

They always have access to the variables of the enclosing class.

153
Q

What is a lambda expression?

A

A lambda expression is an anonymous function. A function that doesn’t have a name, doesn’t have a return type, and doesn’t belong to any class.

To use lambda expression, you need to either create your own functional interface or use the predefined functional interface provided by Java.

Syntax: (parameter_list) -> {function_body}

154
Q

Anonymous Inner Classes

A

It is an inner class without a name and for which only a single object is created. An anonymous inner class can be useful when making an instance of an object with certain “extras” such as overloading methods of a class or interface, without having to actually subclass a class.

155
Q

Functional Interface

A

An interface with only single abstract method is called functional interface(or Single Abstract method interface).

156
Q

Method Reference

A

Method reference is a shorthand notation of a lambda expression to call a method.

For example:
If your lambda expression is like this:
str -> System.out.println(str)

then you can replace it with a method reference like this:
System.out::println

The :: operator is used in method reference to separate the class or object from the method name.

157
Q

The Four Types of Method References

A
  1. Method reference to an instance method of an object – object::instanceMethod
  2. Method reference to a static method of a class – Class::staticMethod
  3. Method reference to an instance method of an arbitrary object of a particular type – Class::instanceMethod
  4. Method reference to a constructor – Class::new
158
Q

Specification

A

The problem to be solved and any constraints that exist.

159
Q

What are the limitations of using Arrays?

A

They allocate continuous space in memory whether they hold any values or not.

Length is fixed.

Have to create a new array with desired length and copy the elements over by ing a loop to copy elements over or by using the System.arraycopy method.

160
Q

When are objects actually created and how long do they exist?

A

Objects are created on runtime and exist while they have a reference variable in the stack.