Ip Viva
Ip Viva
1. Q: What does CSS stand for, and what is its primary function?
○ A: CSS stands for Cascading Style Sheets, and it is used to
style HTML documents by controlling layout, colors, and fonts.
2. Q: Explain Inline, Internal, and External CSS.
○ A: Inline CSS applies styles directly to HTML elements, Internal
CSS uses a <style> block within the HTML, and External CSS
links to a .css file.
3. Q: What is a CSS selector?
○ A: CSS selectors are patterns used to select elements on the
page to apply styles, such as element, class, or ID selectors.
4. Q: How does the CSS Box Model work?
○ A: The Box Model considers each element as a rectangular box,
including content, padding, border, and margin to manage
space and layout.
5. Q: What is a pseudo-class in CSS?
○ A: A pseudo-class, like :hover or :active, applies styles
based on an element's state, such as when a user hovers over
it.
6. Q: What are the pros and cons of External CSS?
○ A: External CSS keeps HTML files cleaner and allows reusable
styles across multiple pages but requires an additional HTTP
request.
7. Q: How does CSS cascade and inheritance affect styling?
○ A: CSS applies styles based on specificity, importance, and
source order, with inherited properties coming from parent
elements.
Experiment 3: Bootstrap
1. Q: What is Node.js?
○ A: Node.js is a JavaScript runtime built on Chrome’s V8 engine,
allowing JavaScript to be run on the server side.
2. Q: How do you start a Node.js REPL?
○ A: Open the terminal and type node to start the REPL, where
you can run JavaScript interactively.
3. Q: How do you display "Hello World" in Node.js REPL?
○ A: Type console.log("Hello World"); in the REPL to output
"Hello World".
4. Q: What are the advantages of Node.js?
○ A: Node.js is asynchronous, non-blocking, and efficient for
real-time, scalable applications.
5. Q: How can you exit Node.js REPL?
○ A: Type .exit or press Ctrl + C twice to exit the REPL.
6. Q: What does console.log do in Node.js?
○ A: console.log prints output to the terminal, helpful for
debugging and logging.
7. Q: What is npm?
○ A: npm (Node Package Manager) is used to manage packages
and dependencies in Node.js projects.
1. Q: What is useState?
○ A: useState is a React hook that adds state to functional
components, allowing dynamic data changes.
2. Q: How does useEffect work?
○ A: useEffect runs side effects in a component, like fetching
data or setting up subscriptions.
3. Q: When does useEffect run?
○ A: useEffect runs after the initial render and whenever
dependencies change.
4. Q: How do you manage multiple useState hooks?
○ A: Multiple useState hooks can be added to a component to
manage different pieces of state.
5. Q: How can you control useEffect execution?
○ A: Pass an array of dependencies to useEffect to control
when it re-runs based on changes in those dependencies.
6. Q: What is a dependency array in useEffect?
○ A: It’s an array that tells React when to re-run useEffect based
on specific variable changes.
7. Q: How do useState and useEffect differ?
○ A: useState manages component state, while useEffect
handles side effects and runs after rendering.
8. Q: What is useContext?
○ A: useContext is a React hook that allows you to access
context values in functional components, making it easier to
share data between components without passing props down
manually.
9. Q: How do you create a context?
○ A: You create a context using React.createContext(), which
returns a Context object that can be used to provide and
consume values.
10.Q: How do you provide context values?
○ A: You provide context values by wrapping components in a
Context Provider, using the value prop to specify the data you
want to share.
11. Q: How do you consume context values?
○ A: You consume context values by calling
useContext(MyContext) in a functional component, where
MyContext is the context object you created.
12.Q: When should you use useContext?
○ A: Use useContext when you need to share state or data
across multiple components without prop drilling, especially for
global states like themes or user authentication.
1. Q: What is Express.js?
○ A: Express.js is a minimal and flexible Node.js framework for
building web applications and APIs.
2. Q: How do you install Express.js?
○ A: Use npm install express to add Express to your project.
3. Q: How do you create a basic Express server?
○ A: Import Express, create an app, set up a route with
app.get(), and use app.listen() to start the server.
4. Q: What is middleware in Express?
○ A: Middleware functions execute during request processing,
commonly used for authentication and logging.
5. Q: How do you define routes in Express?
○ A: Use app.get() for GET requests, app.post() for POST
requests, and so on, defining routes and their handlers.
6. Q: What does app.listen() do?
○ A: It starts the server on a specified port, making it accessible
via that port.
7. Q: How do you handle JSON data in Express?
○ A: Use express.json() middleware to parse JSON data in
request bodies.