ui final Flashcards

1
Q

What is the use of the ‘os’ module in Node.js?

A

deals with operating systems

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

What is the purpose of the “path” module in Node.js?

A

handles file paths

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

Which command is used to install a package globally in Node.js using npm?

A

Apply -g

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

How do you handle file operations in Node.js?

A

“fs”

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

Which one is a key feature of Node.js?

A

Uses an event-driven, non-blocking architecture that works on single
threaded model and processes events using callbacks.
* For example, HTTP calls made to server from Node.js code is non-blocking,
asynchronous, does not wait for the response, and handles the response when it
comes, using a callback model.
* This makes Node.js extremely effective and scalable for managing concurrent
connections and processes.

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

Which of the following method of fs module is used to read a file in Node.js?

A

fs.readFile()

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

Which one of the following command will display all globally installed packages in npm?

A

npm ls –depth=0 -global

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

What does the “require” function in Node.js do?

A

a built-in function to include external modules
that exist in separate files

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

How do you append data to a file in Node.js?

A

fs.appendFile()

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

In the context of Node.js, what does the term “REPL” mean?

A

Read Evaluate Print Loop

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

How is callback function used in Node.js?

A

A callback is a function that is invoked after the asynchronous
operation is finished and is supplied as an input to another function.
* Asynchronous operations in Node.js, such as reading files, making
network requests, or querying databases, are non-blocking,
– This means the code doesn’t wait for the operation to complete before moving
on to the next line.
– Instead, it initiates the operation and continues executing the remaining code.
– When the asynchronous operation is complete, a callback function is called
to handle the result or any errors.
In Node.js, callbacks usually follow an error-first convention, where the first parameter of the callback
function is reserved for an error object.
– If no error occurred, this parameter will be null or undefined.
– If an error occurs, the subsequent parameters may hold additional data.

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

Which built-in module should you use to make a HTTP request in Node.js?

A

“http”

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

core modules of node.js

A

“fs”, which handles file system operations
* “http”, which creates HTTP servers and clients
* “path”, which handles file paths
* “os”, which deals with operating systems

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

How do you copy a file in Node.js?

A

fs.copyFile()

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

How do you read a file in Node.js?

A

fs.readFile()

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

How do you write a file in Node.js?

A

fs.writeFile()

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

Node Package Manager

A

npm is a package manager for node.js and is comprised of
three components
– Website - to discover packages (https://www.npmjs.com/)
– Command Line Interface (CLI) – to run commands from a terminal
* this is how most developers interact with npm.
* npm gets installed automatically when you install node.js
* npm –v //tells version of npm installed
– Registry - a large public database of JavaScript libraries and the
meta-information surrounding it.

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

External Modules

A

External modules produced by the community can be installed
and utilized in Node.js applications using package managers like
npm
* These modules are available for installation with a single
command and are kept in the npm registry.
* Examples of external modules include:
* Axios for sending HTTP requests,
* Moment.js for handling dates and times, and
* Mongoose for interacting with MongoDB databases

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

even-driven architecture of Node.js

A

Node.js is based on a non-blocking, event-driven architecture,
* as a result, it is extremely effective at managing concurrent connections and I/O activities.
* Node.js uses a “single-threaded, event-driven” architecture, which eliminates the
need to create new threads for every connection
* and instead allows a single event loop to manage multiple concurrent connections.
* An event loop is used by Node.js to control events and callbacks.
* The callbacks are triggered by the event loop, which continuously scans for events like incoming
requests or finished I/O operations.
* Node.js handles asynchronous actions by using callbacks as a common pattern.
* All I/O operations in Node.js are carried out asynchronously via callbacks,
* Enabling the program to carry out other tasks without waiting for the I/O activity to finish.
* Examples of this include reading from a file, sending an HTTP request, or querying a database.

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

execute the content of a JavaScript file (module) from inside
another JavaScript file, include the 2nd file in the first file

A

require(/relative path of the 2nd file) statement

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

Node.js built-in functions: exports

A

Exports allows you to call functions that are defined in one module
(calculator.js file) from another module (hello.js file) using module.exports

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

What does the @SpringBootApplication annotation do in Spring Boot?

A

annotation is used to bootstrap a Spring Boot
application. It is a combination of @Configuration, @EnableAutoConfiguration,
and @ComponentScan.

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

In Spring Boot, what is the purpose of the @ResponseBody annotation?

A

used to indicate that the return value of a controller method should be
serialized and sent as the response body. It is typically used with the @RequestMapping annotation.

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

In Spring Boot, what is the purpose of the @PathVariableannotation?

A

used to extract a variable from the URI of a request. It is typically used
with the @RequestMapping annotation.

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

@Autowired

A

used to inject dependencies into a Spring Bean. It can be used to inject
dependencies on other beans, properties, and constructors.

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

Which of the following is a Spring module that allows you to work with relational database management systems (RDBMS) using Java Database Connectivity (JDBC)?

A

Spring JDBC module

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

@Service

A

It is typically used to define a business logic layer in a Spring application.

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

@RestController

A

used to create a RESTful web service. It is a specialized version of the
@Controller annotation that adds support for the HTTP methods GET, POST, PUT, DELETE, and others.

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

@RequestBody:

A

This annotation is used to extract the body of a request. It is typically used with the
@RequestMapping annotation.

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

@ExceptionHandler

A

This annotation is used to handle exceptions thrown by a controller method. It can be
used to return a specific HTTP response code or error message.

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

In Spring Boot, which of the following is used to bind a method parameter to the value of an HTTP header?

A

@RequestHeader

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

In Spring Boot, which of the following is a core module in Spring Framework?

A

Core Container
* DataAccess/Integration
* Web
* AOP/Instrumentation/Messaging
* Test

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

annotation is used to declare a JPA repository in Spring Data JPA?

A

@Repository

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

What is the purpose of the Spring Boot @Repository annotation?

A

This annotation is used to mark a class as a Spring Data repository. It tells
Spring to generate a repository implementation for the interface.

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

@Column

A

This annotation is used to specify the mapping between an entity field and a
column in a database table. It is typically used with the @Entity annotation.

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

@GeneratedValue

A

: This annotation is used to specify how the primary key of an entity is
generated.

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

@Id

A

This annotation is used to specify the primary key of an entity. It is typically used
with the @Entity annotation.

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

@Table:

A

This annotation is used to specify the name of the table that an entity is mapped
to. It is typically used with the @Entity annotation.

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

@Entity

A

This annotation is used to define an entity class. It is typically used to represent a
table in a database.

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

What does the Spring Framework provide to enterprise Java developers?

A

: Spring provides enterprise-level features like transaction management, security, and data access,

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

dependency management and build automation tool used in Spring Boot projects?

A

maven and gradle

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

What does the @EnableJpaRepositories annotation do in Spring Boot?

A

used to enable Spring Data JPA repositories

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

In a Spring Boot application, which of the following is the default embedded server?

A

Apache Tomcat.

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

What is Spring Data JPA primarily used for?

A

primarily used for simplifying the development of data access layers for Java applications that use the Java Persistence API (JPA) to interact with relational databases.

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

What does the Spring Boot @DeleteMapping annotation do?

A

used to map HTTP DELETE requests onto specific handler methods in your controller classes.

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

In Spring Boot, which of the following specifies a method parameter should be bound to the body of the web request?

A

@RequestBody

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

In Spring Boot, which of the following is used to handle exceptions?

A

@ExceptionHandler

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

What does the @Component annotation do in Spring Boot?

A

used to mark a class as a Spring Bean. It tells Spring to manage the
lifecycle of the bean and to inject its dependencies.

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

What is the purpose of the Spring Framework’s Inversion of Control (IoC) container?

A

A programming principle in which the control flow of a program is
inverted, with objects receiving dependencies from external
sources (like the Spring Framework) rather than (programmers)
creating them themselves (in the program)
The Spring IoC container is responsible for instantiating,
configuring and managing the lifecycle of the objects (beans).
* It simplifies the development of complex applications by reducing the
amount of boilerplate code required and promoting modularity and flexibility.

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

In Spring Boot, which of the following allows you to setup the application without the need of XML?

A

@Configuration and @Bean annotations.

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

What does the @RequestMapping annotation do in Spring Boot?

A

This annotation is used to map HTTP requests to controller methods. It is used to
specify the URI of the request and the HTTP method that the method should handle.

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

What does the Spring Boot @PutMapping annotation do?

A

used to map HTTP PUT requests onto specific handler methods

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

In Spring Boot, which of the following specifies a method, constructor argument, or field should be automatically populated with a value by Spring’s dependency injection facilities?

A

@Autowired.

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

Dependency Injection

A

A design pattern that allows objects to
receive their dependencies from
external sources rather than creating
them themselves.

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

Core Container

A

This contains the fundamental modules that are
the cornerstone of the Spring framework.
* Core (spring-core) is the core of the framework
that power features such as Inversion of Control
and dependency injection.
* Beans (spring-beans) provides Beanfactory,
which is a sophisticated implementation of the
factory pattern.
* Context (spring-context) builds on Core and
Beans and provides a medium to access defined
objects. ApplicationContext interface is the core
part of the Context module.
* SpEL (spring-expression) enables users to use
the Spring Expression Language to query and
manipulate the object graph at runtime.

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

Data Access/Integration

A

This includes the modules that are used to handle
data access and transaction processing in an
application.
* JDBC (spring-jdbc) provides a JDBC abstraction
layer that eliminates the need to separate JDBC
coding when dealing with databases.
* ORM (spring-orm) are integration layers for
popular object-relational mapping API such as
JPA, JDO Hibernate.
* OXM (spring-oxm) is the abstraction layer that
supports Object/XML mapping implementations
like JAXB, XStream.
* JMS (spring-jms) is the Java Messaging Service
module that creates and consumes messages
that directly integrate with the Spring messaging
module.
* Transaction (spring-tx) offers programmatic and
declarative transaction management for classes
that include special interfaces and POJOs.

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

Web

A

The Web layer relates to modules that
power web-based functions in Spring.
* WebSocket (spring-websocket) powers
the web socket-based communication for
clients and servers.
* Servlet (spring-webmvc) is the Spring
WebMVC module that contains the MVC
and REST implementations.
* Web (spring-web) provides all the basic
web-oriented features and contains an
HTTP client and web-related parts of the
Spring remoting.
* Portlet (spring-webmvc-portlet) provides
the MVC implementation to be used in a
portlet environment.

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

Other modules

A

AOP (spring
-aop) provides an aspect
-oriented
programming implementation. AOP aims to provide
more modularity to the cross
-cutting concerns, which
are functions that span across the application, such as
Logging, Caching, Transaction management,
Authentication
.
* Aspects (spring
-aspects) enables direct integration
with the AspectJ programming extension by the
eclipse foundation.
* Instrumentation (spring
-instrument) is the class
instrumentation support and class loader
implementations for application servers.
* Messaging (spring
-messaging) provides a robust
platform to manage messaging in applications.
* Spring Messaging module includes key abstractions
from the Spring Integration project and a set of
annotations for mapping messages to methods.
* Test (spring
-test) is the Spring test module that
supports unit and integration testing with JUnit and
TestNG.

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

Main Features of Spring Boot

A

Autoconfiguration automatically configures most of the application components
Embedded Server includes an embedded Tomcat, Jetty or Undertow server
Dependency
Management
manages the dependencies and their versions
Actuator provides information about the application health, metrics, and other details
Spring Data provides support for database integration
Spring Security provides security features such as authentication and authorization

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

What is the purpose of Hibernate in relation to JPA?

A

Hibernate is an open-source, lightweight, ORM tool.
* Hibernate implements JPA and further extends it with additional
features.

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

What does JPA stand for in the context of Java development?

A

Java Persistence API

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

In the context of JPA, what is an Entity?

A

Entities are persistence objects that are stored as records in database tables.
An entity represents a table in a relational database, and each entity instance
corresponds to a row in the table.

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

What does the @Entity annotation indicate in JPA?

A

ndicating that it is a JPA entity

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

How can CRUD operations be implemented using JPA and Hibernate?

A

using entitymanager

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

Which of the following best describes Object-Relational Mapping (ORM)?

A

JPA provides a way to map Java classes to
database tables and Java data types to SQL data types. This is defined through
annotations or XML, or a combination of both.

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

What does the @Table annotation do in JPA?

A

used to specify the details of the table that will be used to persist an entity in the database

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

What is the difference between @Embeddable and @Entity in JPA?

A

@Entity: Marks a class as a persistent entity, representing a table in the database.

@Embeddable: Defines a class whose instances are stored as part of an owning entity, sharing its identity

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

In JPA, what is a persistence context?

A

a set of entities such that for any persistent identity there is a unique entity instance

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

a valid way to create an instance of EntityManager?

A

EntityManagerFactory emf = Persistence.createEntityManagerFactory(“myPersistenceUnit”);

    // Create EntityManager
    EntityManager em = emf.createEntityManager();

or
@PersistenceContext
private EntityManager entityManager;

public void performOperation() {
    // Use EntityManager
    entityManager.getTransaction().begin();
    // Your CRUD operations here
    entityManager.getTransaction().commit();
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
70
Q

What does the @Column annotation do in JPA?

A

Specify the column mapping

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

What does the @ElementCollection annotation do in JPA?

A

used to map a collection of basic or embeddable objects to a separate table in the database.

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

Which of the following is a valid role of the persistence context in JPA?

A

Managing Entity Lifecycle,First-Level Cache

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

what is the primary purpose of the Java Persistence API?

A

to provide a standardized way for Java developers to manage the persistence of object data by mapping Java objects to relational database tables,

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

responsibility of a repository in Spring Data JPA?

A

JPA Repository manages the persistent data in
a Spring Boot Application.

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

What does the term “Lazy Loading” refer to in the context of JPA?

A

to defer the loading of data until it is actually needed

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

What is the role of the @GeneratedValue annotation in JPA?

A

This annotation is used to specify how the primary key of an entity is
generated. It is typically used with the @Id annotation.

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

What is the purpose of the @Transient annotation in JPA?

A

Fields that should not be persisted

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

What is the purpose of the persistence.xml file in a JPA application?

A

used to configure a given JPA Persistence Unit

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

What is the purpose of the @OrderBy annotation in JPA?

A

Specifies the ordering of the elements of a collection valued association or element collection at the point when the association or collection is retrieved.

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

What is the purpose of the @SecondaryTable annotation in JPA?

A

Specifies a secondary table for the annotated entity class

81
Q

In JPA, which of the following best describes a persistent field?

A

Every non-static non-final entity field is persistent by default unless explicitly specified otherwise. persist:storing data to be retrieved and used even after the application that generated it has stopped running.

82
Q

In the context of JPA, when would you use CascadeType.ALL on a relationship?

A

the persistence will propagate (cascade) all EntityManager operations (PERSIST, REMOVE, REFRESH, MERGE, DETACH) to the relating entities.

83
Q

What does the EntityManager interface in JPA handle?

A

the primary way for interacting with the persistence context.

84
Q

What is the difference between the persist() and merge() methods in JPA?

A

Persist takes an entity instance, adds it to the context and makes that instance managed (i.e. future updates to the entity will be tracked). Merge returns the managed instance that the state was merged with.

85
Q

In JAX-RS, what is the purpose of @PathParam annotation?

A

used to bind template parameters to a
resource class field.

86
Q

What does SOAP stand for in the context of web services?

A

(Simple Object Access Protocol

87
Q

In JAX-RS, what is the purpose of the @Path annotation?

A

to define a URI matching pattern for incoming HTTP requests

88
Q

What is the primary data format used in RESTful Web services?

A

json

89
Q

HTTP methods

A

GET to retrieve a resource
* POST to create a new resource
* PUT or PATCH to update an existing resource
* DELETE to remove a resource

90
Q

What does REST stand for?

A

: Representational State Transfer

91
Q

What is the main purpose of the @XmlRootElement annotation in JAX-RS?

A

allowing a conversion between Java and XML

92
Q

How can you specify the consumed and produced media type of a resource in JAX-RS?

A

@Consumes and @Produces annotations to declare the media types that are acceptable for a resource method to read and write.

93
Q

Which of these annotations is used in Spring Boot to map a specific HTTP method to a Java method?

A

GET to retrieve a resource
* POST to create a new resource
* PUT or PATCH to update an existing resource
* DELETE to remove a resource

94
Q

How does Jersey help in creating RESTful Web Services with Spring Boot?

A

a reference implementation of JAX-RS specification
* Implements supports for the annotations defined in JAX-RS spec
* Jersey based REST API application is a standard Servlet application
* It has jersey jars in the class path
* Web.xml contains a jersey servlet class ServletContainer, which is mapped to a
URL pattern to handle all REST API requests
* Jersey servlet looks at your code (i.e., java class) to determine the method
to delegate the HTTP requests to be handled
* This means that http methods need to be mapped to java method

95
Q

In the context of RESTful Web services, what does “uniform interface” mean?

A

The REST architecture establishes a set of well-defined methods, headers, media types, etc. that
provide a uniform interface between clients and servers.

96
Q

Which of the following is not one of the two prevailing styles of Web services?

A

RESTful Web Services and SOAP

97
Q

What does it mean if a Web service is “stateful”?

A

allow users to store, record, and return to already established information and processes over the internet

98
Q

What does the term idempotent mean in the context of HTTP methods?

A

making multiple identical PUT requests will have the same effect as making a single request

99
Q

In Spring Boot, what is the purpose of the SpringApplication.run() method?

A

bootstraps a spring application as a stand-alone application from the main method.

100
Q

In RESTful Web services, what does statelessness mean?

A

Each HTTP request should carry enough information itself to process the request. The server should not store
anything about the latest HTTP request the client made; the server does not maintain any context between two requests

101
Q

In the context of RESTful Web services, what does CRUD stand for?

A

Create, Retrieve, Update, Delete

102
Q

How can you specify the HTTP method of a resource method in JAX-RS?

A

@GET, @POST, @PUT, @DELETE, and @HEAD.
* @Produces, @Consumes to specify data format to be sent out or
received

103
Q

In Spring Boot, how do you specify that a method should respond to HTTP GET requests?

A

@GET

104
Q

In JAX-RS, what is the purpose of the @Consumes annotation?

A

o specify which MIME media types of representations a resource can accept, or consume, from the clien

105
Q

In the context of RESTful Web services, what is a resource?

A

a specific piece of data or object that can be accessed and manipulated through a unique Uniform Resource Identifier (URI)

106
Q

Key principles of RESTful web services

A

Stateless: Each HTTP request should carry enough information itself to process the request. The server should not store
anything about the latest HTTP request the client made; the server does not maintain any context between two requests.
* Client-Server: This principle establishes that the client and the server should be able to evolve separately without any
dependency on each other. A client should know only resource URIs, and a server should know the context on which the
request came for.
* Cacheable: Caching in RESTful web services is similar to caching in web browsers. If the server response is defined as
cacheable, then the client cache can reuse the response data for equivalent responses in the future.
* Uniform Interface: The REST architecture establishes a set of well-defined methods, headers, media types, etc. that
provide a uniform interface between clients and servers.
* Multiple Representation of Data - Supports multiple representation of data for data exchange: XML, JSON,
XHTML, plain text, PDF, JPEG, and others

107
Q

Parameter annotations

A

There are annotations to extract information from a request:
* @PathParam, @QueryParam, @FormParam, @HeaderParam, and
@CookieParam.

108
Q

Application class and @ApplicationPath

A

used to specify the
base path for all the RESTful resources in the packaged archive

109
Q

What is the responsibility of a Kafka broker in a Kafka cluster?

A

storing and managing data streams

110
Q

How can a Kafka cluster be made fault-tolerant?

A

replicated across brokers

111
Q

In Apache Kafka, what is a consumer group?

A

one or more consumers that work together to consume a topic and
parallelize the read.
– The group ensures that each partition is only consumed by one member.
– Consumers within a consumer group do not read data from the same
partition but can receive data from one or more partitions.

112
Q

In Apache Kafka, how is data written to a partition?

A

Key-Based Partitioning
Round-Robin Partitioning
Custom Partitioning (Using a Custom Partitioning Strategy)
Default Partition (When No Key is Provided)

113
Q

What is the responsibility of a JMS producer in a JMS Publish/Subscribe messaging model?

A

A JMS client that creates and sends messages.

114
Q

Java Message Service

A

Java API that allows applications to
create, send, receive, and read messages.

115
Q

JMS Provider:

A

A messaging system that implements the JMS interfaces. It
provides administrative and control features.

116
Q

JMS Client

A

An application or process that produces and/or receives messages.

117
Q

JMS Consumer:

A

A JMS client that receives messages.

118
Q

JMS Message:

A

An object that contains the data being transferred between JMS
clients.

119
Q

JMS Queue

A

A staging area that contains messages that have been sent and are
waiting to be read (note that queues retain all messages sent to them until the
messages are consumed or until the messages expire).

120
Q

JMS Topic

A

A distribution mechanism for publishing messages that are
delivered to multiple subscribers.

121
Q

jms Point-to-Point (PTP) model

A

In the PTP model, a producer sends messages to a queue, and a consumer reads these messages
from the queue. Here, the consumer acknowledges the message upon receipt.
* In this model, messages are not published to all consumers. Instead, only a single consumer will get
the message and process it

122
Q

JMS Publish/Subscribe (pub/sub) model:

A

In the pub/sub model, a producer sends messages to a topic, and all subscribers to that topic receive
the messages.
* If a new subscriber is added, they will only receive messages that were published after they
subscribed; they will not receive messages that were published before their subscription.

123
Q

Kafka Producers

A

Producers create new messages.
– Producers are applications that get the data into the Kafka
* Kafka producers are the publishers responsible for writing
records to topics.
– Typically, this means writing a program using the
KafkaProducer API.
– Producers typically send events or records to a given topic in
Kafka to a certain partition
– Producers publish log to topics in monotonically increasing order

124
Q

Message Key

A

determines which partition your message
should be written to.
– The key identifies the subject of the message, or a property of the
message.
* All message with same key go to the same partition.
* Messages without the (optional) key are sent to partitions in
round-robin fashion

125
Q

In a Kafka cluster, how can high availability be achieved?

A

Partitions are the way that Kafka provides redundancy and
scalability.
* Each partition can be hosted on a different server,
– which means that a single topic can be scaled horizontally across
multiple servers to provide performance far beyond the ability of a
single server.
* Partitions can be replicated, so that different servers will
store a copy of the same partition in case one server fails.

126
Q

In the context of Apache Kafka, what is a partition?

A

the way that Kafka provides redundancy and
scalability. a division in a topic

127
Q

In Apache Kafka, what happens when a broker fails?

A

the partitions it was leading become temporarily unavailable while the Kafka controller elects a new leader from among the follower replicas, if no replicas all data is lost

128
Q

In Kafka, how is data distributed across multiple brokers?

A

By dividing topics into partitions

129
Q

What is Apache ActiveMQ?

A

opensource message broker written in Java together with a
full Java Message Service (JMS) client.

130
Q

In JMS, what is the purpose of the MessageListener interface?

A

used to receive asynchronously delivered messages

131
Q

Which JMS messaging model is inherently asynchronous?

A

Publish/Subscribe

132
Q

In the context of Kafka, what is a message record?

A

the basic unit of data, essentially a single piece of information that is stored and transmitted within a topic, consisting of a key, a value, and optional metadata (headers), essentially representing an “event” that occurred in a system

133
Q

In a Kafka cluster, how can scalability be achieved?

A

topics partitions that are distributed across brokers for distributed processing and for performance
and scalability

134
Q

What does the KafkaProducer API do?

A

allows applications to publish (write) streams of data, called messages, to one or more Kafka topics

135
Q

In a JMS topic, what happens if a message is published while a subscriber is inactive?

A

For non-durable subscribers, messages sent while inactive are lost.
For durable subscribers, the messages are stored and delivered when the subscriber reconnects.

136
Q

In Kafka, what is the purpose of the offset?

A

the offset is a numerical value that tracks the order of messages in a partition

137
Q

What is the responsibility of a JMS producer in a JMS Point-to-Point messaging model?

A

a producer sends messages to a queue, and a consumer reads these messages
from the queue

138
Q

What is a Kafka topic partition?

A

a committed append-only log –terms partitions and logs are
used interchangeably. a logical division within a Kafka topic, essentially a subset of messages within a topic that acts as a separate log

139
Q

In a JMS topic, what happens if a message is published while a non-durable subscriber is inactive?

A

messages sent while inactive are lost.

140
Q

In Kafka, how is data read from a partition?

A

by a consumer within a consumer group

141
Q

In a Kafka cluster, what is a leader replica?

A

the designated copy of a partition within a topic that is responsible for handling all read and write operations for that partition

142
Q

What does the KafkaConsumer API do?

A

enables developers to create their own consumers to read data from Kafka topic

143
Q

In Apache Kafka, what is a topic?

A

provides a channel to publish and subscribe streams
of events
– A logical representation of data or logical grouping of like messages, e.g.,
weather-data, book-orders, credit-card-transactions, a twitter feed
– Messages are sent to and received from a topic
– The closest analogies for a topic are a database table or a folder in a filesystem.

144
Q

In a Kafka cluster, what is a follower replica?

A

a copy of a partition’s data stored on a different broker, which passively replicates the data from the designated “leader” replica

145
Q

In a JMS topic, what happens if a message is published while a durable subscriber is inactive?

A

the messages are stored and delivered when the subscriber reconnects.

146
Q

In a Kafka cluster, what is an in-sync replica (ISR)?

A

has the same number of messages as the leader.

147
Q

out of sync replica:

A

A replica is out of sync if it hasn’t requested a message in more
than 10 sec or it hasn’t caught up to recent messages in 10 sec

148
Q

What is the purpose of a Kafka broker?

A

storing, managing, and distributing messages by receiving data from producers, storing it across partitions within topics, and serving that data to consumers when requested

149
Q

How do you access a web application running in a Docker container from a browser?

A

docker run –p

150
Q

How can you run a Docker container in detached mode?

A

docker run -d

151
Q

What does the ‘docker pull’ command do?

A

downloads a Docker image from a registry (typically Docker Hub) to your local machine

152
Q

How can you remove a Docker image?

A

docker rmi

153
Q

What is the purpose of Docker Swarm

A

allows users to manage a cluster of Docker hosts as a single system

154
Q

How can you specify a working directory for a command in a Dockerfile

A

WORKDIR

155
Q

What does the EXPOSE instruction in a Dockerfile do?

A

informs Docker that the container listens on specific ports at runtime

156
Q

What is the main difference between a Docker container and a virtual machine?

A

Virtual Machines virtualize underlying
hardware
* The sharing and managing of hardware
allows for multiple environments (guest OS)
to exist on same physical machine
* Containers allow OS level virtualization
* A logical packaging mechanism in which
applications can be abstracted from the
environments in which they run
* Containers run the same way on any
platform
Unlike Virtual Machines (VMs), containers do not bundle a full operating
system

157
Q

How can you specify the base image for a Dockerfile?

A

use the “FROM” directive at the very beginning of the Dockerfile, followed by the name of the desired base image (including any tag or version

158
Q

What is the ‘docker ps’ command used for?

A

lists all running containers in the Docker engine

159
Q

In Docker, what does the ‘docker logs’ command do?

A

shows information logged by a running container

160
Q

What is the main benefit of containerizing a web application?

A

Portability

161
Q

What is a Docker image?

A

a blueprint to create container.
– An immutable file - a snapshot of a container.
– Analogy: AMI for EC2 instance
* A package format that includes your application and all its
dependencies and runtime information required to run it
* Docker images are created with the docker build command
* You create containers from docker images by running docker run
command
* Essentially, containers are running instances of Docker images

162
Q

What is Docker Hub?

A

used
to publish/store and share
images

163
Q

How can you forward a port from the Docker host to a Docker container?

A

-p

164
Q

How can you start a Docker container that was previously stopped?

A

docker restart and docker start

165
Q

How can you specify multiple commands in a Dockerfile?

A

&&

166
Q

How can you specify environment variables for a Docker container?

A

-e or –env flag with the docker run command

167
Q

How can you inspect the metadata of a Docker container?

A

docker inspect

168
Q

How can you keep data across multiple runs of a Docker container?

A

Docker volumes

169
Q

How can you run a Docker container in the background and print the container ID

A

use the –detach or -d for short

170
Q

How can you stop a running Docker container?

A

docker stop

171
Q

How can you run a command in a running Docker container?

A

docker exec

172
Q

How can you specify a command to be run when a Docker container starts?

A

[COMMAND] and [ARG…]

173
Q

Docker Desktop

A

a GUI on top of Docker Engine.
– An easy way to get started with docker, especially on Mac and Windows
– Docker Desktop includes Docker Engine, Docker CLI client, Docker
Compose, etc. Docker Desktop uses Docker Engine at its core.

174
Q

How do you create an image?

A

To create a docker image, you define a Dockerfile, which is an input file to
create a container image
* Dockerfile is a text document that contains all the commands/instructions to
assemble an image from your codebase

175
Q

What is a Docker container?

A

The container technology helps you packages code (e.g., your
application) with all its dependencies in a format that can be deployed
consistently across the platform
* This makes such applications easily portable between machines.
* Enables flexibility and portability on where the application can run,
* exactly the same whether on prem, cloud, VMs, laptops, or bare metal

176
Q

How can you copy files from your Docker host to a Docker container?

A

docker cp

177
Q

In Docker, what does the ‘docker run’ command do?

A
  • create a container from the image using docker utility / runs a command in a new container, pulling the image if needed and starting the container
178
Q

In Docker, what does the ‘docker push’ command do?

A

share your images to the Docker Hub registry or to a self-hosted one

179
Q

three phases of containerization

A

Build - build a container image using docker utility (docker build)
– Run - create a container from the image using docker utility (docker run)
– Orchestrate - manage lifecycle of containers using a container
orchestration platform, such as Kubernetes

180
Q

What does a Pod in Kubernetes represent?

A

The smallest and simplest unit in the kubernetes object model that you create or deploy

181
Q

What does ‘Ingress’ in Kubernetes do?

A

an api object that manages external access to the services in a cluster

182
Q

What is the primary purpose of ‘kubectl apply’ in Kubernetes?

A

to create or update resources

183
Q

What does ‘kube-proxy’ do in Kubernetes?

A

it maintains network rules on nodes which allow network communication to your pods from network sessions inside or outside of your cluster

184
Q

What is a deployment in Kubernetes?

A

A Kubernetes API object that manages a replicated application

185
Q

In Kubernetes, what is the role of the ReplicaSet?

A

to maintain a stable set of replica Pods running at any given time

186
Q

what does a node in kubernetes represent?

A

a worker macine in kubernetes, a virtual machine or physical machine depending on the cluster, each node is managed by the Master/

A physical or virtual machine running Kubernetes master and worker
processes – master node(s) and worker nodes
– Worker nodes are where pods are scheduled/hosted
* Kubelet and Kubeproxy are the applications that runs on worker nodes and that
communicates with the master node.

187
Q

What is the primary responsibility of a container orchestration system?

A

Automation the deployment, scaling, and management of containerized applications

188
Q

What is ‘kube-apiserver’ in Kubernetes?

A

it is the fronted of the kubernetes control plane

189
Q

What is one of the main features that distinguishes Kubernetes from other container orchestrators?

A

Auto-scaling of applications

190
Q

How do you roll out an update in Kubernetes?

A

kubectly rollout update

191
Q

In Kubernetes, what is the function of the ‘kube-scheduler’?

A

it controls where pods run based on resource availability

192
Q

What is the role of kube-scheduler in a Kubernetes cluster?

A

it selects a node for the pod to run on

193
Q

What is ‘kubelet’ in Kubernetes?

A

it is an agent that runs on each node in the cluster

194
Q

How do you typically update a deployment in Kubernetes?

A

kubectl apply -f FILENAME

195
Q

What is the primary purpose of ‘kubectl apply’ in Kubernetes?

A

to retrieve the status of resources

196
Q

Which Kubernetes object is used to declare the desired state in which one or more replica instances of a Pod should be running?

A

Deployment

197
Q

What is Kubernetes?

A

Kubernetes is an open-source container orchestration system for
automating deployment, scaling, and management of
containerized applications
Kubernetes automatically reboots pods in case of
failures/crash.
* Kubernetes also support rolling updates.

198
Q

Kubernetes Cluster

A

A collection of physical or virtual machines working together

199
Q

Kubernetes Service

A

A reliable networking endpoint for a pod or a set of pods with same
configuration
– A service handles incoming requests,
* either coming from inside the Kubernetes cluster, from one node to another or from
outside the cluster, and routes them to relevant pods hosting your application.
– Service Types: ClusterIP, NodePort, Load Balancer
* Services are essentially definition of how requests should be routed and
handled within the cluster.