Rahul Vijayan
Follow for more updates
TCS Wings 1 T1 MERN - Set 6
- Jake is using MongoDB to group documents by a field and calculate the total sum of another field within each group. Which aggregation pipeline stage should he use?
- a)
$sum
- b)
$group
- c)
$match
- d)
$project
Answer: b) $group
- Ava is implementing a search filter in her MongoDB collection where she wants to retrieve documents that match any one of several values for a given field. Which MongoDB operator will help her achieve this?
- a)
$and
- b)
$in
- c)
$or
- d)
$eq
Answer: b) $in
- Lucas wants to add an Express middleware that logs every request method and URL. Where should he place the middleware for it to log each request globally?
- a) After defining routes
- b) Before defining routes
- c) Inside each route
- d) Inside the
server.js
file only
Answer: b) Before defining routes
- Amelia needs to display a large list of items in a React component without slowing down the UI. Which React feature can help her optimize rendering performance?
- a)
useEffect
- b)
useCallback
- c)
Virtual DOM
- d)
Component Lifecycle
Answer: c) Virtual DOM
- Ethan wants to render different components in his React app based on specific URL paths. Which library is commonly used to handle routing in React?
- a)
Axios
- b)
react-router-dom
- c)
Express
- d)
MongoDB
Answer: b) react-router-dom
- Mia is setting up server-side validation in her Express app to prevent users from submitting invalid data. Which Express feature allows her to handle validation errors centrally?
- a)
Route handlers
- b)
Middleware
- c)
Controllers
- d)
Database
Answer: b) Middleware
- Sofia wants to sort documents in her MongoDB collection by the date in descending order. Which MongoDB method allows her to sort documents by a specified field?
- a)
find
- b)
sort
- c)
update
- d)
aggregate
Answer: b) sort
- Ryan wants to store the user authentication token on the client side and make it accessible across page reloads. Which storage option is recommended for sensitive tokens in a PWA?
- a) Local Storage
- b) Session Storage
- c)
httpOnly
Cookies - d) IndexedDB
Answer: c) httpOnly
Cookies
- Isla needs to display a loading message while waiting for data to be fetched from an API in her React component. Which state should she use to track this process?
- a)
useEffect
- b)
loading
- c)
isLoading
- d)
data
Answer: c) isLoading
- Leo is debugging an Express route that returns a 404 error when he tries to access it. Which method should he use to verify that the route matches the URL and HTTP method correctly?
- a)
app.post
- b)
app.put
- c)
app.use
- d)
app.get
Answer: d) app.get
No comments:
Post a Comment