Back-End and Full Stack Questions Flashcards

1
Q

How do you set up communication between a React front-end and a Node.js back-end?

A

By making HTTP requests from the React front-end to the back-end. The back-end listens to the requests and sends responses back in JSON format.

Common libraries for making requests include fetch and Axios.

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

What is the difference between RESTful APIs and GraphQL?

A

RESTful APIs use HTTP methods and fixed endpoints while GraphQL allows clients to request only the data they need with a custom response shape.

GraphQL helps reduce over-fetching and under-fetching issues.

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

What are some strategies to secure a REST API?

A
  • Using HTTPS for secure communication
  • Authenticating requests using OAuth or JWT
  • Validating inputs to prevent injection attacks
  • Implementing rate-limiting to avoid DDoS attacks
  • Using role-based access control (RBAC) to limit access

These strategies help protect APIs from unauthorized access and attacks.

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

What are the advantages of using JWT (JSON Web Tokens) for authentication?

A
  • Stateless, requiring no server-side storage
  • Can be sent as part of HTTP headers
  • Self-contained, storing user’s information
  • Compact and easy to use across different domains
  • Can be securely signed

JWTs enhance scalability and simplify authentication across services.

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

What is CORS (Cross-Origin Resource Sharing)?

A

CORS is a security feature that allows or restricts web pages from making requests to domains other than their own.

It helps protect against cross-origin attacks.

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

How do you handle CORS in a Node.js application?

A

By setting appropriate headers in server responses, typically using middleware like cors in Express.

This middleware simplifies CORS configuration.

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

How would you deploy a full-stack application (React + Node.js)?

A

By using services like Heroku, AWS, or DigitalOcean. The React front-end is built and served as static files, while the Node.js back-end is deployed as a server.

Considerations include environment variables, API security, build process for React, and proper routing.

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

What is the difference between REST and GraphQL?

A

In REST, data is requested from multiple predefined endpoints, with each endpoint returning a fixed set of data. In GraphQL, clients define a single query, specifying exactly which data fields they need, reducing over-fetching and under-fetching of data.

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

What are HTTP methods (GET, POST, PUT, DELETE), and when would you use each?

A

Discuss the purpose of each HTTP method and how they map to CRUD operations.

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

Explain the concept of a “microservice” architecture.

A

Microservice Architecture: A system design where applications are divided into small, independent services, each focused on a specific business function and communicated through APIs.

Advantages:

Scalability

Independent deployment

Technology flexibility

Fault isolation

Faster development cycles

Enhanced maintainability

Continuous delivery

Flexibility in team structure

Disadvantages:

Complexity

Inter-service communication overhead

Data consistency challenges

Increased resource consumption

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

What is CORS (Cross-Origin Resource Sharing), and how do you handle it in an API?

A

Explain the issue of cross-origin requests and how to handle CORS using server-side headers or libraries.

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

What is JWT (JSON Web Token), and how is it used for authentication?

A

Describe how JWT works for secure authentication and authorization, including tokens and expiration.

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

What are the key differences between SQL and NoSQL databases?

A

Compare relational databases (SQL) and non-relational databases (NoSQL), focusing on data structure, scalability, and use cases.

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

What is the role of an ORM (Object-Relational Mapping) library in full-stack development?

A

Explain what ORM libraries do and give examples like Sequelize (Node.js), TypeORM, and Mongoose (MongoDB).

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

What is the difference between a server-side and a client-side rendering?

A

Discuss the pros and cons of server-side rendering (SSR) vs. client-side rendering (CSR) in terms of performance and SEO.

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

How do you ensure security in a full-stack application?

A

Explain common security practices such as input validation, password hashing, OAuth, preventing XSS and CSRF attacks, and using HTTPS.

17
Q

What is a RESTful API, and what are its key principles?

A

Describe the core principles of REST (Representational State Transfer), such as statelessness, resource-based URIs, and the use of HTTP methods.

18
Q

What is the role of WebSockets in full-stack development?

A

Explain how WebSockets provide real-time communication between the client and server and its use cases in applications like chat or live notifications.

19
Q

What is the purpose of version control systems like Git in full-stack development?

A

Discuss the importance of using version control systems (e.g., Git) for managing codebases, collaboration, and tracking changes.

20
Q

What are environment variables, and why are they important in a full-stack application?

A

Explain the concept of environment variables and how they store sensitive configuration like API keys, database credentials, etc.

21
Q

How do you handle error handling in both client-side and server-side code?

A

Discuss strategies for managing errors in JavaScript (e.g., try/catch) and how to return proper error messages from the server (e.g., HTTP status codes).

22
Q

What is MVC (Model-View-Controller) architecture?

A

Explain the MVC design pattern and how it’s used to organize code in both the front-end and back-end parts of an application.

23
Q

What is AJAX, and how does it work in full-stack applications?

A

Describe how AJAX allows you to make asynchronous requests to the server without reloading the page, improving the user experience.

24
Q

What is a Content Delivery Network (CDN), and why is it important in web development?

A

Explain the concept of a CDN, its role in caching and speeding up static assets (images, CSS, JavaScript), and its impact on performance.

25
Q

What is the role of Node.js in full-stack development?

A

Describe how Node.js is used on the server-side to build scalable applications, its event-driven architecture, and how it complements JavaScript on the client-side.

26
Q

What is the difference between SQL JOINs (INNER JOIN, LEFT JOIN, etc.)?

A

Explain the different types of JOIN operations in SQL and when to use them, including INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN.

27
Q

How do you handle state management in a React application?

A

Discuss the various ways to manage state in React, including using useState, useReducer, and third-party libraries like Redux or Context API.