Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

What do you mean by observer pattern?

Answer»

If several OBJECTS are TIED together in one-to-many relationships, the observer pattern is used. Every time one object is modified, then all of its dependent objects are automatically notified and updated. It falls under the behavioural pattern category. It describes the COUPLING between the objects and the observer and provides support for broadcast-type COMMUNICATION. The object that observes the state of ANOTHER object is known as the observer, and the object that is being observed is known as the subject as shown below:

2.

Explain dependency injection.

Answer»

The Dependency INJECTION (DI) pattern is a design pattern for implementing the INVERSION of Control (IOC). DEPENDENT objects can be created outside of classes and made available to classes in different ways. Three types of classes are involved in Dependency Injection as follows:

  • Client Class: A client class (dependent class) is ONE that depends on the service class.
  • Service Class: Service (dependency) classes provide services to client classes.
  • Injector Class: This class injects the objects from the service class into the client class.
3.

Is there a way to decrease the load time of a web application?

Answer»

Here are some ways to reduce load times for web applications:

  • Image Optimization: The file size of an image can be dramatically REDUCED by switching to a different file FORMAT. For example, GIFs work well for images with few colors, such as logos, JPEG is ideal for images with lots of colors and details, such as photographs, and PNG format is ideal for transparent images with high quality.
  • Keep JavaScript and CSS in external files: Embedding JavaScript and CSS in HTML documents forces them to be downloaded every time the HTML document is loaded. In this case, browser CACHING is not utilized, and the HTML document becomes larger. This is why you should always place CSS and JavaScript in external files; it is a best practice and SIMPLIFIES maintenance.
  • Reducing redirects: Too many redirects will delay the loading time of a website. HTTP requests and responses are delayed each time a page redirects. Getting rid of unnecessary redirects on your site will reduce the load time of your site significantly.
  • Load CSS and JavaScript files asynchronously: Your website contains CSS and JavaScript files that can be loaded either synchronously or asynchronously. As part of synchronous loading, each file is loaded sequentially, in the order it appears on your site. As opposed to synchronous loading, asynchronous loading allows multiple files to be loaded simultaneously, boosting the performance of a website. 
  • Minify HTML, CSS, and JavaScript: If you optimize the WAY your files load, your pages will load more quickly. You can do the same when it comes to HTML, CSS, and JavaScript code. By eliminating unnecessary spaces, characters, and comments, you can reduce the size of your files. This will make your web pages load faster.
4.

Explain event loop in Node.js.

Answer»

The event loop in JavaScript enables asynchronous programming. With JS, every OPERATION takes place on a single thread, but through smart data STRUCTURES, we can create the illusion of multi-threading. With the Event Loop, any async WORK is handled by a queue and listener. Consider the diagram below:

Therefore, when an async function (or an I/O) needs to be executed, the main thread relays it to another thread, allowing V8 (Javascript engine) to continue processing or running its code. In the event loop, there are different phases, like pending callbacks, closing callbacks, timers, idle or preparing, polling, and checking, with different FIFO (First-In-First-Out) queues.

5.

What are some of the uses of Docker?

Answer»

One of the thorniest problems in software development is dealing with the different environments across different machines and platforms. USING Docker, you can isolate your applications from your infrastructure, which is crucial to delivering software quickly. DEVELOPERS can package and run their applications into containers, executable components that have all the OS (Operating SYSTEM) libraries and dependencies needed to run the application in any environment. It does not matter what is installed on the host—containers are lightweight and include everything needed to run applications.

  • The code has to pass through many different environments as it travels from the developer's machine to production. Consequently, each of these environments may be slightly different. Using Docker streamlines code development and deployment, as it provides a consistent environment from development to production.
  • Docker's PRIMARY purpose is to simplify configuration. With VM (Virtual Machine), you can run any PLATFORM with its configuration on top of your infrastructure. Docker offers the same functionality without the overhead of virtual machines.
6.

Explain the benefits and drawbacks of using "use strict".

Answer»

In ECMAScript5, a new feature known as strict mode allows you to run a program or function within a strict operating context. Certain ACTIONS, therefore, cannot be taken due to this strict context, and more exceptions are THROWN. When the "use strict" statement is used, the browser is instructed to use "strict" mode, which is a more restricted and safer JavaScript feature set. You can specify "use strict" at the top of a function to evaluate the JS in strict mode. In strict mode, more errors are thrown and some features are disabled to make your code more robust, clear, and accurate.

Advantages:

  • Errors are thrown when some COMMON coding mistakes are detected.
  • By having strict mode, mistakes that make JavaScript engines tough to optimize can be fixed. Sometimes, strict mode code runs faster than similar, non-strict mode code.
  • Generally, it prevents or throws an error when an "unsafe" action is taken (for example, accessing the global object).
  • It disables poorly thought-out or confusing features.
  • Strict mode simplifies the PROCESS of writing "secure" JavaScript.

Disadvantages:

  • Many of the functions that most developers use are absent.
  • It is not possible to access function.caller or function.arguments anymore.
  • If you concatenate scripts written in different strict modes, you may encounter problems.
7.

Explain the meaning of multithreading.

Answer»

The thread is an independent part or unit of a PROCESS (or an application) that is being executed. Whenever multiple threads execute in a process at the same time, we call this "multithreading". You can think of it as a way for an application to multitask.

Advantages:

  • By multithreading, computing RESOURCES are also minimized and used more effectively.
  • The RESPONSE time of the application is improved since requests from ONE thread do not block requests from other threads.
  • Consequently, if one of the threads encounters an exception, it will not affect the other threads.
  • Multithreading, on the other hand, uses fewer resources than running multiple PROCESSES simultaneously.
  • The overhead, time usage, and management associated with creating processes are much higher when compared to creating and managing threads.
8.

What is CI (Continuous Integration)?

Answer»

CI (Continuous Integration), as its name implies, is the process of automating and integrating code changes into a single software project, often several times a day. The purpose of this DevOps practice is to enable DEVELOPERS to merge their code changes into a central repository where automated tests and builds can run. Automated tools are used to assert the new code’s correctness before integration. A source code version control system is the crux of the CI process. The version control system is also SUPPLEMENTED with other checks like automated code quality tests, syntax style review tools, and more.

Advantages:

  • Integrating REGULARLY has the main benefit of detecting errors quickly and more easily. Since most changes introduced are small, pinpointing the specific change that caused a defect is easy.
  • As a result of the smaller code changes and easier fault ISOLATIONS, CI reduces MTTR (Mean Time to Resolution).
  • When CI is incorporated into your organization's development process, you are less likely to have noncritical defects on your backlog. Before production, these small defects are detected and fixed before they are released to the PUBLIC.
9.

State difference between GraphQL and REST (Representational State Transfer).

Answer»

For decades, REST (Representational State Transfer) has been a POPULAR architectural way to design APIs (Application Programming Interfaces), but the popularity of GraphQL over the past few years threatens to topple REST. In general, REST and GraphQL both aim to transfer data over internet protocols including HTTP. How they do so differs greatly, however.

GraphQLREST
It is a Query Language for APIs that enables declarative data fetching to provide clients control over which data to retrieve from the API. It is an API design architectural style that defines a set of constraints to create web services.
GraphQL is known for its high predictability. With this, you can send requests to your API and get the exact results you are looking for without having to include ANYTHING you don't need. GraphQL queries give predictable results, which improves their usability significantly.On the other hand, REST's behaviour depends on the HTTP and URI methods used. API consumers can therefore be unsure of what to expect when calling an endpoint.
API security can be ensured by GraphQL, though the security features aren't as mature as those of REST. GraphQL, for INSTANCE, ASSISTS in integrating data validation, but users are left to figure out how to apply authentication and authorization measures.API security can be enforced in several ways using REST. You can implement multiple methods of API authentication, such as HTTP authentication, to ensure REST API security.
With GraphQL, you can retrieve everything you need through a single API request. You can specify the structure of the information you need, and the server will return the same structure to you, so there is no need to over-and under-fetch.Consequently, since REST APIs have rigid data structures that return the specified data whenever they are accessed, you may end up with unwanted data or have to make multiple requests before getting the right data. As a result, the server's response time (to return information) can be prolonged due to these shortcomings.
It only supports JSON format.XML, YAML, JSON, HTML, and other formats are supported, as well.
The main use cases of GraphQL are mobile APPLICATIONS and multiple microservices.Rest is mainly used for simple applications and resource-driven applications.
10.

Can you tell me what are the latest trends in Full Stack Development? Also, how do you keep yourself updated about the new trends in the industry?

Answer»

Each business needs emerging technology to THRIVE, WHETHER it is mobile or web application development. This is why they hire front-end developers, back-end developers, or full-stack developers depending on their technology needs. According to industry experts, candidates who are passionate about full-stack development should be aware of these trends:

  • The rise in frameworks and LIBRARIES like ReacJs and VueJs, progressive APPS,  real-time web apps, and mobile web development.
  • Enhancements to JavaScript are beneficial to programming
  • The emergence of a more compatible extension.

The interviewer MAY ask you how you keep updated with new trends in the industry. You can explain how you gain your knowledge and understanding by learning from friends, colleagues, or online. That's an appropriate way of answering the question. This is a good time to show off any personal projects you have undertaken that apply your skills. Also, you might mention the webinars or forums that you attend regularly.

11.

Explain Long Polling.

Answer»

Long polling is defined as a WEB application DEVELOPMENT technique used to push INFORMATION/data from servers to clients as QUICKLY as possible. When a request is made from the client to the server, long-polling MAINTAINS the connection between the two. This connection is maintained until the information is ready to be sent from the server to the client.  Once a server receives a request from a client, the connection does not close immediately; the connection is only closed once the server has sent the data back to the client or when a timeout threshold has been reached (connection timeout).

12.

What is Callback Hell?

Answer»

Callback Hell, or Pyramid of Doom, is a COMMON anti-pattern seen in asynchronous programming code (MULTIPLE functions running at the same time). This slang term describes a large NUMBER of nested "if" statements or functions. In simple terms, Callback hell is a situation where you have multiple asynchronous functions. Those functions depend on one another, so it could get quite messy with so many callback functions nested in so many layers. The use of callback functions leaves you with code that is difficult to read and maintain, and looks like a pyramid as shown below:

This also makes it more difficult to identify the flow of the application, which is the main obstacle to DEBUGGING, which is the reason for the famous NAME of this problem: Callback Hell.

13.

What do you mean by CORS (Cross-Origin Resource Sharing)?

Answer»

CORS refers to cross-origin resource sharing. It's a BROWSER mechanism that allows web pages in one DOMAIN to have controlled access to resources in other domains (cross-domain REQUESTS). This allows scripts that are run on a browser client to interact with and access resources from other origins. In doing so, it extends and provides greater flexibility to the SOP (Same-Origin Policy). Same-origin policies restrict the ABILITY of a website to access resources outside of its source domain. For example, a JavaScript app that wants to make a call to an API (Application Programming Interface) that runs on another domain will be blocked due to the SOP. A CORS policy was implemented to circumvent restrictions caused by same-origin policies.

In addition, if a website's CORS policy is not configured properly, it may be vulnerable to cross-domain attacks. This MEANS that it cannot stop cross-origin attacks like  CSRF (Cross-Site Request Forgery).

14.

Explain Pair Programming.

Answer»

In pair programming, two programmers share only one machine and work together. During the development process, one programmer will be the driver who codes and another will ACT as the observer (navigator) who will make sure the code is written correctly, proofread and spell-check it, while also deciding where to go next. ROLES can be swapped at any time: the driver becomes the observer and vice versa. You can also call it "pairing", "paired programming", or "programming in pairs".

Advantages:

  • Two of them will fix the problem if the driver encounters any issues with the code.
  • The two programmers working on the same program are only 15% slower than if they worked independently instead of 50%.
  • As a result of having another programmer look over your work, you are more likely to write better code. One study showed that it results in 15% fewer BUGS than code written by a single programmer.
  • It leads to improved collaboration, higher quality, better code, and SUSTAINED improved development practices.
  • During the project, each person teaches the other, resulting in more efficient and expedited knowledge exchange.
  • The team develops better communication skills.
15.

Which language is the most preferred by full-stack developers?

Answer»

Full Stack Developers UTILIZE SEVERAL PROGRAMMING languages. Ideally, a candidate should be fluent in several languages, preferably some for designing the front end and others for fixing the BACK end. Since Full Stack developers work with a variety of technologies and applications, they must be proficient in at least two to three of the most popular languages such as Java, Python, Ruby, PHP, C++, etc.

16.

To develop a project from scratch, what technologies and languages would you need or what skills a full stack developer should have?

Answer»

A full-stack developer must be familiar with the following:

  • Programming Languages: Full-stack developers should be competent in more than one programming language, such as Java, Python, PHP, Ruby, C++, etc.
  • Front End technologies: You should be familiar with front-end technologies such as HTML5, CSS3, JavaScript, etc. Knowledge of third-party libraries such as jQuery, AJAX, Angular, ReactJS, etc., is also important.
  • Frameworks: This requires proficiency in a variety of development frameworks, including Spring, Spring BOOT, Django, MyBatis, PHP, Hibernate, and others.
  • Databases and caches: As a full stack developer, you should also KNOW about various DBMS (Database Management Systems) technologies like MySQL, SQLite, Oracle, and MongoDB. It is helpful to have a basic understanding of caching mechanisms like redis, memcached, varnish.
  • Design Ability: Having a good understanding of design is also important if you wish to become a successful Full-Stack web developer. Moreover, the person should be aware of the principles of prototyping and UX/UI design.
  • Server: Experience with Apache or NGINX would be beneficial. Good knowledge of Linux helps ENORMOUSLY when administering servers.