APIs Flashcards

1
Q

What is the difference between SOAP and REST?

A

SOAP
A Web Development protocol
Works with XML
SOAP cannot use REST

REST
An architectural platform
Works with XML, HTML, and plain text
REST can make use of SOAP

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

What is the use of a namespace in Web Development?

A

A namespace is a simple global object that is used to hold methods, properties, and other objects in them. It adds ease of use via modularity, thereby, providing users with the ability to reuse the code and avoid naming conflicts.

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

What are the newly introduced input types in HTML5?

A

HTML5 has had multiple revamps in the past years, and the addition of input types has made it very easy to work with. Some of these input types are as follows:

color
date
Datetime-local
email
month
number range

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

What are the five elements that support media content in HTML5?

A

There are five main elements in HTML5 that support media:

<audio>
<video>
<source></source>
<embed></embed>
<track></track>
</video></audio>

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

What is SVG and why is it used?

A

SVG stands for Scalable Vector Graphics. It is used to display vector-based graphics over the web. The graphical content it can render is based on an XML format. With SVG, the graphical content is of superior quality thereby providing the user with the ability to furnish high-quality images.

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

What is the use of Canvas in HTML?

A

Canvas was added onto HTML5 to give users the ability to draw graphics on the go, using JavaScript. There are a variety of methods in <canvas> to allow for the drawing of paths, circles, boxes, images, and more.</canvas>

Next up on this top Web Developer interview questions and answers, let us understand the difference between canvas and SVG.

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

What is the difference between Canvas and SVG?

A

Canvas SVG
Resolution dependent Resolution independent
Does not support event handlers Supports event handlers
Works well for small-scale rendering applications Performs better for large-scale rendering applications

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

How can page loading time be reduced?

A

There are many factors that affect the page loading time of a website. However, some methods can be implemented to reduce it drastically. They are given below:

Reduction in the image size
Removal of unnecessary widgets
HTTP compression
Reduction in lookups
Minimal redirection and caching

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

What is the use of CORS?

A

CORS stands for Cross-origin Resource Sharing. It is a mechanism that allows a variety of resources to be requested at a time from a domain that is outside the current request domain.

The next web application interview question comprises an important difference. Check it out below.

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

What is the difference between localStorage and sessionStorage objects?

A

localStorage sessionStorage
No expiry is there for stored data The object is valid for only a single session
Data is not deleted upon the closure of the window The object is immediately deleted upon closing the window

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

What are some of the new features that are introduced in CSS3?

A

CSS3 has brought about a lot of changes, making the overall framework more user-friendly and powerful. Some of the features that were added and are very popularly used now are:

Rounded corners
Animation
Custom layout
Media queries

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

What is Responsive Web Design (RWD) in HTML and CSS?

A

Responsive Web Design is a concept that is used to create web pages that can scale across multiple resolutions without any loss of information or screen tearing.

It automatically adjusts the structure of the web page based on the device it is viewed on to provide optimal viewing experience.

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

What are some of the types of CSS that are used?

A

There are three main types of CSS present:

Inline CSS: Supports the addition of CSS inline, alongside HTML elements
External CSS: Used to import an external CSS file to the HTML document
Embedded CSS: Used to add CSS styles by making use of the <style> attribute</style>

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

What is the use of a selector in CSS?

A

A CSS selector is used with a rule in the inline elements, which require styling. With the help of selectors, it is easy to find and select HTML elements based on factors, such as name, ID, attribute, etc.

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

Can you give an example of using an ID selector in CSS?

A

example {padding: 20px;}

The ID selector is used in CSS to point to a target element for usage. It is denoted in the following example:

<p>
...
</p>

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

What is the use of grouping in CSS3?

A

grouped g, ul { padding-top: 20px; margin: 1; }

Grouping is used in CSS3 to give users the ability to reuse and apply the same CSS style element to multiple HTML entities, using just one single declaration statement.

A simple example of grouping is as shown below:

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

What is the use of a class selector in CSS?

A

Class selectors in CSS begin with a “.” (period) key and are followed by the name of the class. It is used to select a statement and modify the style of that element in the corresponding part of the HTML tag.

Consider the following example:

.exampleclass {font-family: TimesNewRomanl; font-size: 20; background: red;}

<div>
...
</div>

18
Q

What is the use of Webkit in CSS3?

A

Webkit is an important software component in CSS that allows for the easy rendering of HTML and CSS elements in a variety of browsers, such as Chrome, Firefox, and Safari.

There are many engines for browsers such as:

Gecko for Mozilla
Presto for Opera
Edge for Internet Explorer

19
Q

What is HTML?

A

HTMLstands for HyperText Markup Language and it is the language of the internet. This standard text formatting language is used to create and display pages on the Internet. HTML documents include elements and tags that format it for proper display on pages.

20
Q

What are HTML tags?

A

HTML tags are used for placing elements in the proper and appropriate format. The tags, < and >, set them apart from the HTML content. It is not always necessary to close these HTML tags. For example, in the case of images, the closing tags are not required astag.

21
Q

What is JSX?

A

JSX is a syntax extension of JavaScript. It is used with React to describe what the user interface should look like. By using JSX, we can write HTML structures in the same file that contains JavaScript code.

22
Q

Can web browsers read JSX directly?

A

Web browsers cannot read JSX directly. This is because they are built to only read regular JS objects and JSX is not a regular JavaScript object
For a web browser to read a JSX file, the file needs to be transformed into a regular JavaScript object. For this, we use Babel

23
Q

What is the virtual DOM?

A

DOM stands for Document Object Model. The DOM represents an HTML document with a logical tree structure. Each branch of the tree ends in a node, and each node contains objects.

React keeps a lightweight representation of the real DOM in the memory, and that is known as the virtual DOM. When the state of an object changes, the virtual DOM changes only that object in the real DOM, rather than updating all the objects. The following are some of the most frequently asked react interview questions.

24
Q

What is the difference between the ES6 and ES5 standards?

A

These are the steps for creating a React app:

Install NodeJS on the computer because we need npm to install the React library. Npm is the node package manager that contains many JavaScript libraries, including React.
node-js.

Install the create-react-app package using the command prompt or terminal.
create

Install a text editor of your choice, like VS Code or Sublime Text.

25
Q

What is an event in React?

A

An event is an action that a user or system may trigger, such as pressing a key, a mouse click, etc.

React events are named using camelCase, rather than lowercase in HTML.
With JSX, you pass a function as the event handler, rather than a string in HTML.

26
Q

What are synthetic events in React?

A

Synthetic events combine the response of different browser’s native events into one API, ensuring that the events are consistent across different browsers.
* The application is consistent regardless of the browser it is running in. Here,preventDefaultis a synthetic event.

27
Q

Explain how lists work in React

A

We create lists in React as we do in regular JavaScript. Lists display data in an ordered format
The traversal of lists is done using the map() function

28
Q

Why is there a need for using keys in Lists?

A

Keys are very important in lists for the following reasons:

A key is a unique identifier and it is used to identify which items have changed, been updated or deleted from the lists
It also helps to determine which components need to be re-rendered instead of re-rendering all the components every time. Therefore, it increases performance, as only the updated components are re-rendered

29
Q

What are forms in React?

A

React employs forms to enable users to interact with web applications.

Using forms, users can interact with the application and enter the required information whenever needed. Form contain certain elements, such as text fields, buttons, checkboxes, radio buttons, etc
Forms are used for many different tasks such as user authentication, searching, filtering, indexing, etc

30
Q

How do you create forms in React?

A

We create forms in React by doing the following:

The above code will yield an input field with the label Name and a submit button. It will also alert the user when the submit button is pressed.

31
Q

What is an arrow function and how is it used in React?

A

An arrow function is a short way of writing a function to React.
It is unnecessary to bind ‘this’ inside the constructor when using an arrow function. This prevents bugs caused by the use of ‘this’ in React callbacks.

32
Q

What are the components in React?

A

Components are the building blocks of any React application, and a single app usually consists of multiple components. A component is essentially a piece of the user interface. It splits the user interface into independent, reusable parts that can be processed separately.

33
Q

What is the use of render() in React?

A

It is required for each component to have a render() function. This function returns the HTML, which is to be displayed in the component.
If you need to render more than one element, all of the elements must be inside one parent tag like <div>, <form>.

34
Q

What is a state in React?

A

The state is a built-in React object that is used to contain data or information about the component. The state in a component can change over time, and whenever it changes, the component re-renders.
The change in state can happen as a response to user action or system-generated events. It determines the behavior of the component and how it will render.

35
Q

How do you update the state of a component?

A

We can update the state of a component by using the built-in ‘setState()’ method:

36
Q

What are props in React?

A

Props are short for Properties. It is a React built-in object that stores the value of attributes of a tag and works similarly to HTML attributes.
Props provide a way to pass data from one component to another component. Props are passed to the component in the same way as arguments are passed in a function.

37
Q

What is a higher-order component in React?

A

A higher-order component acts as a container for other components. This helps to keep components simple and enables re-usability. They are generally used when multiple components have to use a common logic.

38
Q

What are the differences between class and functional components?

A

Class Components

Functional Components

State

Can hold or manage state

Cannot hold or manage state

Simplicity

Complex as compared to the stateless component

Simple and easy to understand

Lifecycle methods

Can work with all lifecycle methods

Does not work with any lifecycle method

Reusability

Can be reused

Cannot be reused

39
Q

Explain the lifecycle methods of components.

A

getInitialState(): This is executed before the creation of the component.
componentDidMount(): Is executed when the component gets rendered and placed on the DOM.
shouldComponentUpdate(): Is invoked when a component determines changes to the DOM and returns a “true” or “false” value based on certain conditions.
componentDidUpdate(): Is invoked immediately after rendering takes place.
componentWillUnmount(): Is invoked immediately before a component is destroyed and unmounted permanently.
So far, if you have any doubts about the above React interview questions and answers, please ask your questions in the section below.

40
Q

What is Redux?

A

Reduxis an open-source, JavaScript library used to manage the application state. React uses Redux to build the user interface. It is a predictable state container for JavaScript applications and is used for the entire application’s state management.