NEW
Font size
WorksheetsFull Stack Challenge
Total questions: 40
Worksheet time: 20mins
Mira is managing a database for her online store. She needs to perform various operations to keep her inventory updated. What are the basic CRUD operations she should use in MongoDB?
Generate, Access, Adjust, Dispose
Insert, Fetch, Modify, Remove
Add, Retrieve, Change, Eliminate
Create, Read, Update, Delete
Naira is working on a project that requires her to store user data in a MongoDB collection. How does she create a new document in that collection?
Execute db.collection.create({yourDocumentData}) to add a new document.
Use db.collection.addDocument({yourDocumentData}) to create a new document.
Run db.collection.insert({yourDocumentData}) to insert a new document.
Use db.collection.insertOne({yourDocumentData}) to create a new document.
Eshaan is building a web application that requires data storage. He decides to use MongoDB as his database and Mongoose as the ODM. Explain how he can read data from the MongoDB database using Mongoose.
Connect using mongoose.start(), create a schema, and use model.fetch() to retrieve data.
Use mongoose.disconnect() to connect, define a model, and use model.update() to read data.
Use mongoose.connect() to connect, define a schema, create a model, and use model.find() to read data.
Utilize mongoose.link() to connect, define a collection, and use model.get() to access data.
Vanya is managing a database for her online bookstore. She needs to update the information of a book that has recently changed its price. What is the purpose of the update operation in MongoDB?
To create new collections in the database.
To modify existing documents in a collection.
To retrieve documents from a collection.
To delete documents from a collection.
Advait is managing a MongoDB database for his project. He needs to delete a specific document from a collection that contains user data. How can he do this?
Use `db.collection.remove(filter)` to delete documents.
Apply `db.collection.clear(filter)` to erase specific documents.
Execute `db.collection.drop()` to remove the entire collection.
Use `db.collection.deleteOne(filter)` or `db.collection.deleteMany(filter)`.
In a React application, Saisha is developing a dashboard that displays user data. She needs to ensure that the data displayed is always up-to-date and reflects the current state of the application. What is state management in React?
State management in React is about styling components for better UI.
State management in React refers to routing between different pages.
State management in React is the process of optimizing performance for large apps.
State management in React is the process of handling and maintaining the state of components in an application.
Dia is building a new feature for her React application and needs to manage the state of a form input. How does she manage state using the useState hook in React?
Use the useState hook to declare state variables and update them in functional components.
Use the useEffect hook to manage state in class components.
Declare state variables using the useReducer hook in functional components.
Manage state by directly modifying the component's props in React.
Eshaan and Aanya are working on a project where they need to manage the score of a game they are developing. They realize that both of them need access to the score to update their respective components. To solve this, they decide to lift the state up by moving the score state to their common ancestor component, allowing both of them to access and update the score seamlessly.
Lifting state up is a technique in React where state is moved to a common ancestor component to allow shared access among child components.
Lifting state up is a method to isolate state within a single child component.
Lifting state up involves duplicating state in multiple components for better performance.
Lifting state up refers to moving all state management to the root component only.
Aarush is building a web application using React. He needs to perform certain actions when the component mounts and when it updates. What is the purpose of the useEffect hook in React?
To optimize rendering performance in components.
To manage side effects in function components.
To handle state management in class components.
To fetch data from APIs in class components.
Sneha is building a React application for her online store. She needs to ensure that the shopping cart state is accessible across different components of her app. How can she manage global state in her React application?
Use local storage for state management in React.
Utilize component props for state sharing.
Use Context API, Redux, or MobX to manage global state in a React application.
Implement global variables for state handling.
In a full stack application developed for a local bookstore, Anika, one of the developers, is considering various methods for authenticating users to ensure secure access to their accounts. What are the common methods for authenticating users in full stack applications?
Password-based authentication, biometric authentication, SAML
IP address verification, CAPTCHA, email verification
Session-based authentication, token-based authentication (JWT), OAuth, OpenID Connect
Two-factor authentication, security questions, device fingerprinting
Asher is developing a Node.js application that requires secure user authentication. He needs to implement a method to ensure that users can log in and access protected routes safely. How does he implement JWT authentication in his application?
Implement OAuth for user authentication and authorization.
Use 'jsonwebtoken' to create and verify JWTs, protect routes with middleware.
Use 'express' to handle routing and sessions.
Store user credentials in a database for validation.
In a web application built with Express.js, Aashi is trying to access a protected route that requires authentication. What role does middleware play in this process?
Middleware in Express.js is used to handle authentication by verifying user credentials before granting access to protected routes.
Middleware in Express.js formats user input before processing requests.
Middleware in Express.js manages database connections for user sessions.
Middleware in Express.js is used to log user activity on the server.
In a React application for a banking service, how can Ishika protect routes based on user authentication?
Redirect users to a login page without checking their status.
Use local storage to save user credentials for route access.
Implement a global state to manage user sessions across the app.
Use a higher-order component or 'PrivateRoute' to check authentication before rendering protected routes.
Advait is working on a project to deploy a MERN stack application. What are the steps he should follow to successfully deploy it?
Set up a Python server, build a mobile app, configure cloud storage, deploy frontend, manage API keys, and optimize performance.
Create a Node.js app, design the UI, write SQL queries, deploy frontend, manage user sessions, and debug the code.
Build the React app, set up the server, configure environment variables, deploy backend, host the database, and test the application.
Develop a Java application, create a static website, set up a NoSQL database, deploy backend, configure SSL, and monitor traffic.
Riyaan is looking to deploy his MERN application and wants to know which platforms he can use for this purpose.
Firebase Hosting
Netlify
Heroku, AWS, DigitalOcean, Vercel, Docker, Kubernetes
GitHub Pages
Rohan is working on a MERN stack app and needs to set up environment variables for his project. How does he do it?
Create a .env file, define variables as KEY=VALUE, use dotenv to load them.
Use a config.js file to store settings.
Define environment variables in the server.js file.
Set variables in the package.json file.
Riyaan is preparing to launch his new React application. He knows that before he can share it with users, he needs to ensure that it runs smoothly and efficiently. What is the purpose of a build process in deploying React applications?
To manage state and props in components.
To optimize and prepare the application for production deployment.
To create a user interface for the application.
To handle API requests and responses.
Avni is deploying her MongoDB database for her new application. How can she ensure her MongoDB database is secure when deployed?
Use default user roles
Enable authentication, use role-based access control, enable TLS/SSL, configure IP whitelisting, regularly update MongoDB, use strong passwords, and monitor logs.
Disable logging and monitoring
Allow all IP addresses
During a recent project, Ishika and her team faced several challenges while deploying their MERN application. What are some common challenges they encountered?
Version control conflicts
Code refactoring challenges
User interface design issues
Common challenges include environment configuration, dependency management, performance optimization, security concerns, and database connectivity.
Rohan is building a complex user interface for his application and needs a way to manage the state of various components efficiently. What is the purpose of using the useReducer hook in React?
To manage local component state in a more complex way than useState.
To handle side effects in functional components.
To optimize performance by memoizing components.
To create context for global state management.
Avyaan is building a React application for a local bookstore that needs to display data from a RESTful API to show available books. How does he connect his React application to the API?
Use the fetch API or Axios to make HTTP requests from the component lifecycle methods.
Directly manipulate the DOM to display API data.
Use local storage to store API data.
Implement a WebSocket connection for real-time data.
Nikita is developing a new Node.js application for her startup. She needs to manage various aspects of her project efficiently. What is the role of the package.json file in her Node.js application?
It defines the structure of the database.
It contains metadata about the project, including dependencies, scripts, and versioning.
It is used to configure the server settings.
It stores user authentication information.
Riya is developing a Node.js application that requires secure data transmission. What method can she use to encrypt sensitive data before sending it over the network?
Use plain text for data transmission.
Store data in a secure database.
Implement data encryption using libraries like 'crypto' or 'bcrypt'.
Use HTTPS to secure the connection.
Arjun is developing a user-friendly form in his React application that needs to efficiently handle user input. What is the purpose of controlled components in React?
Controlled components are used to directly manipulate the DOM.
Controlled components are for optimizing performance in rendering.
Controlled components are used to manage component lifecycle methods.
Controlled components allow form data to be handled by React state.
Meera is setting up a RESTful API for her application. What is the purpose of using middleware in her Express.js application?
Middleware is used to handle routing between different pages.
Middleware allows for processing requests and responses, such as logging and authentication.
Middleware is used to manage database connections.
Middleware is for styling components in the application.
Rohan is exploring different ways to manage side effects in his React application. What is the primary purpose of the useEffect hook?
To handle state updates in class components.
To optimize performance by preventing unnecessary re-renders.
To manage local component state without side effects.
To perform side effects in functional components after rendering.
Aarav is developing a RESTful API using Express.js and needs to handle incoming requests. What is the role of middleware in his Express application?
Middleware is used to serve static files in the application.
Middleware is used to define routes for the application.
Middleware processes requests and responses, allowing for tasks like logging and authentication.
Middleware is responsible for connecting to the database.
Meera is implementing user authentication in her Node.js application. What is a common method for securely storing user passwords?
Store passwords in a separate database without encryption.
Encrypt passwords using symmetric encryption.
Use hashing algorithms like bcrypt to securely store passwords.
Store passwords in plain text for easy access.
In a React application, what is the primary purpose of using the useContext hook?
To share state across multiple components without prop drilling.
To optimize performance by memoizing components.
To manage local component state.
To handle side effects in functional components.
When building a RESTful API, what is the significance of using status codes in HTTP responses?
Status codes indicate the type of request being made.
Status codes provide information about the outcome of the request.
Status codes are used to format the response data.
Status codes are irrelevant in RESTful APIs.
In a Node.js application, what is the purpose of using the 'dotenv' package?
To manage database connections.
To optimize performance by caching data.
To load environment variables from a .env file into process.env.
To handle routing in the application.
Riyaan is considering different methods to optimize the performance of his React application. What is one effective way to prevent unnecessary re-renders in functional components?
Directly manipulate the DOM to improve performance.
Utilize React.memo to memoize components and prevent re-renders.
Use class components instead of functional components.
Use the useEffect hook to manage state updates.
Meera is looking to implement error handling in her Express.js application. What is a common practice for handling errors in middleware?
Throw an error and let the application crash.
Use a try-catch block to catch errors and send a response.
Ignore errors and continue processing requests.
Log errors to the console without sending a response.
Avyaan is developing a feature in his React application that requires fetching data from an API. What is the best practice for handling asynchronous data fetching in functional components?
Use the useEffect hook to fetch data when the component mounts.
Fetch data directly in the render method of the component.
Use local storage to store fetched data.
Fetch data in the constructor of the component.
You are passing a function as a prop to a child component. The child re-renders every time. Which hook helps optimize performance?
In a list rendered using map(), what problem occurs if keys are not unique?
You need to manage complex state logic (multiple related state updates). Which hook is most suitable?
A component must access data without causing re-render when the value changes. What should you use?
A button click updates state, but the updated value is not immediately available. Why?
