Basic Questions
- What is full-stack web development?
- Answer: Full-stack web development involves working on both the front-end and back-end portions of an application. A full-stack developer is proficient in both client-side (HTML, CSS, JavaScript) and server-side (Node.js, Python, Ruby, etc.) technologies, as well as databases and version control systems.
- What is the difference between front-end and back-end development?
- Answer:
- Front-end development focuses on the client-side, dealing with everything that users see and interact with in their web browsers.
- Back-end development involves server-side operations, databases, and application logic that support the front-end.
- What are some commonly used front-end technologies?
- Answer: Common front-end technologies include HTML, CSS, JavaScript, and frameworks/libraries like React, Angular, and Vue.js.
- What are some commonly used back-end technologies?
- Answer: Common back-end technologies include Node.js, Python (Django, Flask), Ruby (Ruby on Rails), Java (Spring), and PHP (Laravel).
HTML and CSS
- What is the purpose of the
DOCTYPE
declaration in HTML?
- Answer: The
DOCTYPE
declaration specifies the HTML version and helps the browser to render the web page correctly. It should be the first line in an HTML document.
- What is the box model in CSS?
- Answer: The box model represents the structure of an HTML element. It includes content, padding, border, and margin. This model affects the layout and spacing of elements on the web page.
- How do you make a website responsive?
- Answer: To make a website responsive, you can use CSS media queries, flexible grid layouts, responsive images, and frameworks like Bootstrap.
- What are CSS preprocessors?
- Answer: CSS preprocessors, like SASS and LESS, extend the capabilities of CSS by adding features such as variables, nested rules, and mixins, which make CSS more maintainable and easier to write.
JavaScript
- What is the difference between
var
, let
, and const
in JavaScript?
- Answer:
var
: Function-scoped and can be re-declared and updated.
let
: Block-scoped and can be updated but not re-declared in the same scope.
const
: Block-scoped and cannot be updated or re-declared.
- What is a closure in JavaScript?
- Answer: A closure is a function that retains access to its lexical scope even when the function is executed outside that scope. It allows the function to "remember" its environment.
- What are promises in JavaScript?
- Answer: Promises are objects representing the eventual completion (or failure) of an asynchronous operation. They provide methods like
then()
, catch()
, and finally()
to handle asynchronous results.
- What is the purpose of
async
and await
in JavaScript?
- Answer:
async
and await
are used to write cleaner asynchronous code. async
makes a function return a promise, and await
pauses the execution until the promise is resolved.
Front-End Frameworks
- What is React, and how does it work?
- Answer: React is a JavaScript library for building user interfaces. It uses a component-based architecture and a virtual DOM to efficiently update and render components when the state changes.
- What are props and state in React?
- Answer:
- Props: Short for properties, props are read-only data passed from a parent component to a child component.
- State: State is an object that holds dynamic data for a component. It can be changed over time, and the component re-renders when the state changes.
- What is the difference between a class component and a functional component in React?
- Answer:
- Class Component: Uses ES6 class syntax and can have state and lifecycle methods.
- Functional Component: Uses function syntax and can use hooks (like
useState
and useEffect
) to manage state and lifecycle methods.