Interview QC Questions Part 4 Flashcards

1
Q

What is difference between template driven and reactive forms?

A

Template Driven Forms are based only on template directives, while Reactive forms are defined programmatically at the level of the component class.

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

What is BDD?

A

Behavior-driven development, BDD, is a testing practice that follows the idea of specification by example (e.g., Test-Driven Development [TDD]). The idea is to describe how the application should behave in a very simple user/business-focused language.

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

What is Spring?

A

The Spring Framework (Spring) is an open-source application framework that provides infrastructure support for developing Java applications.

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

What is the IoC Container?

A

The Inversion of Control, IoC, container that is also known as a DI Container is a framework for implementing automatic dependency injection very effectively. It manages the complete object creation and its lifetime, as well as it also injects the dependencies into the classes.

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

What is a spring bean?
What is the difference between Autowiring and manually wiring?

A

A bean is an object that is instantiated, assembled, and otherwise managed by a Spring IoC container. Otherwise, a bean is simply one of many objects in your application.

Auto-wiring is when a framework creates the objects at the start of the application and you can auto wire the dependent objects to a class via annotations, then the framework injects these objects when that code runs.

Manual bean wiring is when the responsibility to create dependent objects is given to a class that needs it. You instantiate the object and (manually)configure it as a bean in an xml/config file.

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

Lifecycle of a spring bean?

A

When we run the program then, first of all, the spring container gets started. After that, the container creates the instance of a bean as per the request, and then dependencies are injected. And finally, the bean is destroyed when the spring container is closed.

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

BeanFactory vs ApplicationContext

A

The BeanFactory is the most basic version of IOC containers, and the ApplicationContext extends the features of BeanFactory.

BeanFactory loads beans on-demand, while ApplicationContext loads all beans at startup. Thus, BeanFactory is lightweight as compared to ApplicationContext.

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

Lazy vs eagerly loaded?

A

While lazy loading delays the initialization of a resource, eager loading initializes or loads a resource as soon as the code is executed.

Alternative Answer:
By default in Spring, all the defined beans, and their dependencies, are created when the application context is created. In contrast, when we configure a bean with lazy initialization, the bean will only be created, and its dependencies injected, once they’re needed.

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

What are the scopes of a Spring Bean?

A

singleton
This scopes the bean definition to a single instance per Spring IoC container (default).

prototype
This scopes a single bean definition to have any number of object instances.

request
This scopes a bean definition to an HTTP request. Only valid in the context of a web-aware Spring ApplicationContext.

session
This scopes a bean definition to an HTTP session. Only valid in the context of a web-aware Spring ApplicationContext.

global session
This scopes a bean definition to a global HTTP session. Only valid in the context of a web-aware Spring ApplicationContext.

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

Stereotype annotations?

A

Stereotype annotations are markers for any class that fulfills a role within an application. This helps remove, or at least greatly reduce, the Spring XML configuration required for these components.

The main Stereotype Annotation is @component.

The following are derivatives of this annotation:

@Service (service classes)
@Repository (data access classes)
@Controller (web classes for spring MVC)
@Configuration (java configuration)

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

Explain the MVC Architecture.

How are requests processed?

What are controllers?

A

MVC (Model-View-Controller) is a pattern in software design commonly used to implement user interfaces, data, and controlling logic. It emphasizes a separation between the software’s business logic and display.

Handlers are responsible for generating the actual response in MVC. They implement the IHttpHandler class and only one handler will execute per request.

A controller is responsible for controlling the way that a user interacts with an MVC application

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

What is aspect oriented programming?

A

Aspect-oriented programming (AOP) is an approach to programming that allows global properties of a program to determine how it is compiled into an executable program.

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

What is a pointcut?

A

Pointcut is expressions that are matched with join points to determine whether advice needs to be executed or not.

Pointcut uses different kinds of expressions that are matched with the join points and Spring framework uses the AspectJ pointcut expression language.

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

What is an advice?

A

An advice is an action taken by an aspect at a particular join point.

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

What are the different types of advice? 

A

There are five types of advices in the Spring AOP framework: before, after, after-returning, after-throwing, and around advice. Advices are taken for a particular join point.

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

What is Spring ORM and Spring Data?

A

Spring-ORM is a technique or a Design Pattern used to access a relational database from an object-oriented language.

ORM (Object Relation Mapping) covers many persistence technologies. They are as follows: JPA(Java Persistence API): It is mainly used to persist data between Java objects and relational databases.

Spring Data is a high level SpringSource project whose purpose is to unify and ease the access to different kinds of persistence stores, both relational database systems and NoSQL data stores.

17
Q

How is Typescript different from JS?

A

TypeScript is known as an Object-oriented programming language whereas JavaScript is a prototype based language.

TypeScript has a feature known as Static typing but JavaScript does not support this feature.

TypeScript supports Interfaces but JavaScript does not.

18
Q

Different primitive data types in JS?

A

There are 7 primitive data types:

string.
number.
bigint.
boolean.
undefined.
symbol.
null.
19
Q

What is npm?
What is Package.json file in angular project?

A

npm is a short form of Node Package Manager, which is the world’s largest software registry.

The package. json file is used to share information to npm that allows it to identify the project and hand its dependencies.

20
Q

What is a SPA? How to navigate to different page?

A

A single-page application (SPA) is a web application or website that interacts with the user by dynamically rewriting the current web page with new data from the web server, instead of the default method of a web browser loading entire new pages.

Since you can’t load new pages from the server, you cannot use the regular browser navigation but need to provide one yourself. This is called routing and is provided by many JS frameworks like AngularJS.

21
Q

What are decorators?

A

Decorator is a structural pattern that allows adding new behaviors to objects dynamically by placing them inside special wrapper objects, called decorators.

22
Q

What is a component?

A

Components are the most basic UI building block of an Angular app. An Angular app contains a tree of Angular components. Angular components are a subset of directives, always associated with a template.

23
Q

What is a module?

A

In Angular, a module is a mechanism to group components, directives, pipes and services that are related, in such a way that can be combined with other modules to create an application.

24
Q

What are structural/attribute directives? Examples? (ngif, ngfor)

A

Angular provides a set of built-in structural directives (such as NgIf, NgForOf, NgSwitch and others) which are commonly used in all Angular projects.

Attribute directives change the appearance or behavior of DOM elements and Angular components.

25
Q

Different types of data binding?

A

One Way Data Binding: In one-way data binding, the flow of data is in one direction only i.e. from model to view. A value is taken from the data model, inserted in an HTML element, and displayed to the user. But there is no way to update the model according to the input given by the user which means that the data can’t flow from the view to the model.

Two Way Data Binding: In this type of data binding, the flow of data is bidirectional i.e the data can flow from the model to the view as well as from the view to the model. In simple words, we can say that when the data in the model changes, the changes are reflected in the view and when the data in the view changes the model is also updated. The view and model are updated at all times.

26
Q

What are pipes?

A

Pipes are simple functions to use in template expressions to accept an input value and return a transformed value.

27
Q

Services in angular?

A

Services in Angular let you define code or functionalities that are then accessible and reusable in many other components in your Angular project.

28
Q

What are observables?

A

Observables provide support for passing messages between parts of your application.

29
Q

How do you do testing in Angular?

A

When it comes to the Angular world, Jasmine is the recommended testing framework. Angular CLI comes by default with Jasmine and Karma as the test runner. It generates test files at component creation, collects unit tests, runs karma, and displays results on a web page.

Testing can be done using the command ng Test

30
Q

Let vs var vs const

A

var is function scoped when it is declared within a function. This means that it is available and can be accessed only within that function.

let is block scoped so a variable declared in a block with let is only available for use within that block.

Variables declared with the const maintain constant values. Like let declarations, const declarations can only be accessed within the block they were declared.