Java Flashcards

1
Q

OO - What is a Class ?

A

A class is an abstract blueprint that creates more specific, concrete objects.

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

OO - What is an Object

A

An object is an instance of a class.

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

OO - Encapsulation

A

Encapsulation refers to the bundling of data with the methods that operate on that data within a single unit, i.e., class.

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

OO - Inheritance

A

Inheritance allows us to define a class in terms of another class, which makes it easier to create and maintain an application. This also provides an opportunity to reuse the code functionality and fast implementation time.

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

OO - Abstraction

A

Abstraction refers to the act of representing essential features without including background details - implementation

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

OO - Polymorphism - Compile Time

A

Compile-time polymorphism is also known as static polymorphism. This type of polymorphism is achieved by function overloading or operator overloading

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

OO - Polymorphism - RunTime

A

Runtime polymorphism, on the other hand, is also known as dynamic polymorphism. This type of polymorphism is achieved by method overriding

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

Collections - Interfaces

A

The Java Collections Framework provides a set of interfaces that define the behavior of different types of collections. These interfaces include List, Set, Queue, and Map.

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

Collections - Classes

A

The Java Collections Framework also provides a set of classes that implement these interfaces. These classes include ArrayList, LinkedList, HashSet, and TreeMap.

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

Collections - Generics

A

The Java Collections Framework uses generics to ensure type safety when working with collections.

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

Collections - Iterators

A

The Java Collections Framework provides an iterator interface that allows you to traverse the elements of a collection

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

Collections - Algorithms

A

The Java Collections Framework provides a set of algorithms that can be used to perform common operations on collections, such as sorting, searching, and shuffling.

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

Collections - Concurrency

A

The Java Collections Framework provides thread-safe implementations of some collection classes, such as ConcurrentHashMap and CopyOnWriteArrayList, which can be used in concurrent environments.

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

Generics - Type Safety

A

Generics provide compile-time type safety, which means that you can catch errors at compile time rather than at runtime.

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

Generics - Type Erasure

A

Java uses type erasure to implement generics. This means that the type information is removed at runtime, which allows you to use generics with legacy code that was written before generics were introduced.

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

Generics - Wild Cards

A

Wildcards allow you to specify a range of types that a generic class can work with. This is useful when you want to write code that can work with a variety of different types.

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

Generics - Bounded Type Parameters

A

Bounded type parameters allow you to specify a range of types that a generic class can work with. This is useful when you want to write code that can work with a variety of different types, but still maintain some level of type safety.

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

Generics - Generic Methods

A

Generic methods allow you to write methods that can work with different types of objects. This is useful when you want to write code that can work with a variety of different types, but don’t want to create a new class for each type.

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

Func.Prog - Lambda expressions

A

Lambda expressions are a new feature introduced in Java 8 that allow you to write functional-style code in Java. They are used to represent anonymous functions that can be passed around as values.

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

Func.Prog - Streams

A

Streams are a new feature introduced in Java 8 that allow you to process collections of data in a functional style. They provide a way to perform operations such as filtering, mapping, and reducing on collections of data.

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

Func.Prog - Immutability

A

Immutability is an important concept in functional programming. It means that once an object is created, it cannot be changed. In Java, you can create immutable objects using the final keyword or by using the java.util.Collections class.

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

Func.Prog - Higher Order Functions

A

Higher-order functions are functions that take other functions as arguments or return functions as values. They are an important concept in functional programming and can be used to create more expressive and reusable code.

23
Q

Spring Boot - Dependency Inj - Inversion of Control

A

Dependency injection is based on the principle of inversion of control (IoC). This means that instead of your code controlling how everything works and what tools it needs, the control is inverted or shifted to the framework (Spring Boot) that manages and controls the flow of the program. In Spring Boot, this is achieved through the use of a container called the “application context”

24
Q

Spring Boot - Dependency Inj - Types of Injections

A

There are three types of dependency injection (DI) in Spring Boot: constructor injection, setter injection, and field injection. Constructor injection is a recommended way of doing DI in Spring Boot because it ensures that the dependencies are available from the moment the object is created

25
Q

Spring Boot - Auto Config - how it works

A

Spring Boot auto-configuration works by scanning the classpath for specific libraries and automatically configuring the application based on the presence of these libraries. For example, if you include the HSQLDB library in your project, Spring Boot will automatically configure an in-memory database for you

26
Q

Spring Boot - Custom Auto Config

A

You can also create your own custom auto-configuration classes to configure your application. To do this, you need to create a class annotated with @Configuration and register it as an auto-configuration candidate by adding the name of the class under the key org.springframework.boot.autoconfigure.EnableAutoConfiguration in the standard file resources/META-INF/spring.factories. You can also use @Conditional annotations to specify when your custom auto-configuration should be used

27
Q

Spring Boot - Starters

A

Spring Boot starters provide a quick and easy way to get started with Spring Boot. They include pre-configured dependencies that are commonly used together, such as web applications, security, data access, and more

28
Q

Spring Boot Boot Strap process

A
  1. The first step in the bootstrap process is to create a new Spring Boot project. This can be done using the Spring Initializr, which is a web-based tool that generates a new project with all the necessary dependencies and configuration files.
  2. Once the project has been created, the next step is to configure the application. This involves setting up the application context, which is responsible for managing the lifecycle of the application.
  3. After the application has been configured, it can be started using the SpringApplication.run() method. This method starts the application context and initializes all the necessary components.
29
Q

Spring Boot Starters examples

A

There are many different types of starters available for Spring Boot, including web starters, data starters, security starters, and more. Each starter provides a set of pre-configured dependencies that can be used to quickly get started with a specific feature or technology

30
Q

Spring Eureka - Service Discovery

A

Spring Eureka provides a way for microservices to discover each other. Each microservice registers itself with the Eureka server, which maintains a list of all the available services. Other microservices can then query the Eureka server to find the location of the services they need to communicate with.

31
Q

Spring Eureka - Load Balancing

A

Spring Eureka also provides load balancing capabilities. When a microservice needs to communicate with another service, it can query the Eureka server for a list of available instances of that service. The client-side load balancer can then choose one of the available instances to send the request to.

32
Q

Spring Eureka - Fault Tolerance

A

Spring Eureka provides fault tolerance capabilities. If a service instance goes down, it will be automatically removed from the list of available services. When the instance comes back up, it will be automatically added back to the list.

33
Q

Spring Config. Server - Centralised Config

A

Spring Cloud Config Server provides a central place to manage external properties for applications across all environments. As an application moves through the deployment pipeline from dev to test and into production, you can manage the configuration between those environments and be certain that applications have everything they need to run when they migrate

34
Q

Spring Cloud Config - Git based

A

The default implementation of the server storage backend uses Git, so it easily supports labeled versions of configuration environments as well as being accessible to a wide range of tooling for managing the content. It is easy to add alternative implementations and plug them in with Spring configuration

35
Q

Spring Cloud Config - HTTP API

A

Spring Cloud Config Server features an HTTP, resource-based API for external configuration (name-value pairs, or equivalent YAML content). It also allows you to encrypt and decrypt property values (symmetric or asymmetric) and is embeddable easily in a Spring Boot application using @EnableConfigServer

36
Q

Spring Cloud Gateway - Routing

A

Spring Cloud Gateway is able to match routes on any request attribute. This allows you to write complex routing rules that take into account any aspect of the request

37
Q

Spring Cloud Gateway - Load Balancing

A

Spring Cloud Gateway provides load balancing capabilities. It uses Ribbon to load balance requests to the specified service. Ribbon is a client-side load balancer that is often used in conjunction with the Netflix Eureka service registry

38
Q

Spring Cloud Security -

A
39
Q

Docker

A

What is a Docker Container?
What is a Docker Image?
Docker Hub
Dockerfile

40
Q

Testcontainers

A

Testcontainers is an open source framework for providing throwaway, lightweight instances of databases, message brokers, web browsers, or just about anything that can run in a Docker container

41
Q

12 Factor-app- The 12-factor app is a methodology for building software-as-a-service apps that are portable and scalable.

A

Codebase: The codebase should be tracked in revision control, with many deploys possible from the same codebase.

42
Q

12 Factor-app-Dependencies

A

Dependencies should be explicitly declared and isolated.

43
Q

12 Factor-app-

A

Configuration should be stored in the environment.

44
Q

What is an Identifier in Java ?

A

A Identifier is the name of a Class, interface or Variable or Package or Label - case sensitive (can be any length but should be between 4-15)
- characters allowed - letters, digits, underscore and $
- cannot start with a digit
- cannot be a reserved word

45
Q

Reserved words are
- keywords
- literals

A

keywords such as byte, char, short (data type reserved words)
keywords such as if, while, switch (flow control keywords)
modifiers such public, private (modifier keywords)

46
Q

what does public access modifier mean

A
47
Q

what does private access modifier mean

A
48
Q

what does protected access modifier mean

A
49
Q

what does static access modifier mean

A
50
Q

what does final access modifier mean

A
51
Q

what does abstract access modifier mean

A
52
Q

what does module mean ?

A
53
Q
A