Skip to main content

Preparing for frontend interview: 15 questions

The list of 15 questions that are often asked for interviews with applicants for frontend development positions:

1. What is a DOM?

A DOM (Document Object Model) is a software interface to HTML documents. This interface allows you to influence a document from scripts, changing its appearance, styles, and content. The DOM presents the document as a node tree.

2. What is the difference between the < span > and < div > elements?

  • < span > is an inline element
  • < div > is a block element
< div > elements must be used to design sections of the document. And elements < span > - as containers for small volumes of text, for images and other similar page elements.

Note that you cannot place block elements in lowercase.

3. What are meta tags?

Meta tags are tags in the < head > page tag that describe the contents of the page. Meta tags are not displayed on the page. They are only in its code.

Their main task is to briefly describe the contents of pages to search engines.

4. What is the difference between ID and class selectors in CSS?

The IDs are unique. An item can have only one ID. There can be only one item with a specific ID on the page.

Class names are not unique. You can assign the same class to multiple items. An item can be assigned multiple classes.

If you want to apply a style to multiple page elements, you must solve this problem using classes.

5. How do I use media requests in CSS?

Media queries use the @ media rule, which allows you to apply CSS styles to different types of content. Media queries can also be used to customize page elements based on the characteristics of the environment in which pages are viewed.

6. What are pseudo classes in CSS?

In CSS, pseudoclasses are used to describe feature styles that are in special states. Pseudoclasses can be used with CSS selectors to customize the appearance of elements based on their states.

If you are asked about whether you can name any pseudoclasses, then here is a page with their large list.

7. What is the difference between the following types of element positioning: relative, fixed, absolute, static?

  • Relative positioning is when an element is offset from its default position.
  • Fixed positioning is when you adjust the position of an item, focusing on the edges of a browser window.
  • Absolute positioning is the placement of an element relative to the nearest positioned parent element, and precisely where indicated by the developer.
  • Static positioning is the default positioning mode that displays features in the order described in the document.

8. What are the differences between PUT and POST requests?

PUT requests replace the target resource with the data sent in the request. You can use it to update the contents of an existing resource or to create a new resource.

POST requests result in resource-specific processing of data transmitted in the request. You can use them to perform various actions. Including - to create new resources, to upload files to the server, to submit forms.

Another difference between PUT and POST queries is that PUT queries are idempotent and POST queries are not. That is, if a request in which the same data is transmitted, and which is executed at the same URL, is executed several times, this is equivalent to one-time execution of this request. Executing a POST query repeatedly is not equivalent to executing it once. That is, several such requests, for example, can lead to the creation of several objects on the server.

9. What are the differences between Long Polling, WebSocket protocol, and server-generated events?

Long Polling technology is used in the interaction of client and server systems. The client sends a request to the server, which is answered when the server has the data requested by the client. The client then executes a new request.
The WebSocket protocol allows you to establish long-lived two-way connections between the client and the server.
The events generated by the server are based on the use of a long-lived HTTP connection, which is used to send new data to the client at the initiative of the server.

10. What are the differences between cookies, session storage, and local storage?

Local storage, as can be understood from its name, is a place that browsers can use for local storage. It can store up to 10 MB of data. Session storage is a type of local storage that is bound to a session and deleted after it is completed. Session storage can store up to 5 MB of data.

Cookies are used to store small amounts of data that do not exceed 4 KB. They can be used by a browser, the server can request them from the browser.

11. What is CORS?

CORS (Cross-Origin Resource Sharing) is a browser-based mechanism that allows pages to access resources outside a domain. This expands page capabilities and adds flexibility to the same-origin policy.

12. What is promise?

Promises are objects that are used in JavaScript when performing asynchronous operations. They simplify work with asynchronous operations and provide more convenient error handling mechanisms than collectors and events.

13. What conditions can the Promise be in?

Promise can be in one of three states:
  • Fulfilled-The promise-related operation completed successfully.
  • Rejected-The promise-related operation failed.
  • Waiting - The promise is in the waiting state, that is, it cannot be said that it was completed successfully or with an error.

14. What is the hoisting of variables and functions in JavaScript?

Hoisting variables and functions is the movement of their declarations to the top of their scope (global scope or function scope).

15. What are the false values in the JavaScript?

В JavaScript ложными являются значения, которые, при преобразовании их к логическому типу, становятся значениями false. Это — следующие значения:

  • '' 
  • null
  • undefined
  • NaN
  • false
  • -0
  • 0n // значения типа BigInt, при преобразовании их к логическому типу, ведут себя так же, как значения типа Number

Conclusion

The questions I shared with you were asked at my interviews. Such questions, supplemented by practical tasks, are a good way to test the knowledge of a candidate for the position of front-line programmer.

Popular posts from this blog

The Slowest Programming Languages

Today, there are about 700 well-known programming languages ​ ​ in the world, while only 250 are used. If a task could be measured in days earlier, it is now a fraction of a second. Here are some of the slowest dynamic typing programming languages. In electronics, speed and performance depend on the number of transistors that a particular chip can have. According to Moore's law, their number doubles every two years. This is why a modern hand-sized mobile phone is much faster than a room-sized supercomputer of the 90s. When it comes to computer science, the difference between faster code and a faster PC is quite bike. Intel and AMD create powerful computing systems in terms of speed. The task of programmers is to write reliable and fast programs. One of the things to consider when creating software is programming languages . Each of them is implemented in different ways, therefore it has its own merits. And speed may simply not be among them. If you need to create a program for comp...

How to succeed in IT if you are not a programmer

There is a statement that only mathematicians are taken in IT. Is that so? Today's world of information technology answers: no. Successful in this area is not the one who quickly thinks in his mind, but rather the one who understands human psychology, knows languages and is quite ambitious. What is the secret to success and how to develop in IT if you are not a programmer? Develop communication skills and emotional intelligence Language, successful communication, the ability to "see and hear" the interlocutor are basic factors for those who want to succeed in IT. Linguistic inclinations are known to be more important for learning programming languages ​ ​ and understanding code than mathematics. That is, languages ​ ​ are a factor that allows ordinary people to develop in IT. The ability to find a common language and establish the necessary connections, easily communicate, the ability to feel and understand a colleague, subordinate, partner and client is something that is...