Rahul Vijayan
Follow for more updates
TCS Wings 1 T1 MERN - Set 10
- Noah is adding a custom middleware to check for a user’s role before accessing specific routes in Express. Where should he place this middleware in the route definitions?
- a) Before route handler functions
- b) After route handler functions
- c) Inside the database configuration
- d) In
app.listen
Answer: a) Before route handler functions
- Mia wants her React component to update only when a specific state variable changes, avoiding unnecessary re-renders. Which hook should she use?
- a)
useEffect
- b)
useRef
- c)
useCallback
- d)
useMemo
Answer: a) useEffect
- Ava is testing CRUD operations on an Express API endpoint using a tool that sends HTTP requests. Which tool is commonly used for this purpose?
- a) MongoDB Atlas
- b) Postman
- c) Visual Studio Code
- d) JSON Server
Answer: b) Postman
- Ethan needs to merge multiple arrays in MongoDB, removing duplicate values in the final result. Which aggregation operator should he use?
- a)
$merge
- b)
$addToSet
- c)
$push
- d)
$project
Answer: b) $addToSet
- Olivia is creating a new document in MongoDB and wants the
_id
field to be auto-generated. How does MongoDB handle the_id
field by default when inserting new documents?
- a) Generates automatically
- b) Requires manual input
- c) Must be generated in the application code
- d) Is optional for insertion
Answer: a) Generates automatically
- Grace wants to add offline capabilities to her React PWA so it can load without internet. Which technology should she implement?
- a) LocalStorage
- b) Session Storage
- c) Service Workers
- d) Redux
Answer: c) Service Workers
- Leo needs his Express server to send JSON data to a client request. Which method should he use to send JSON?
- a)
res.send
- b)
res.write
- c)
res.json
- d)
res.end
Answer: c) res.json
- Harper is performing an aggregation in MongoDB and needs to ensure only documents matching a specific condition are passed to the next stage. Which stage will help her?
- a)
$match
- b)
$project
- c)
$group
- d)
$lookup
Answer: a) $match
- Amelia wants to display the same component multiple times with different data based on an array in React. Which approach allows her to iterate over the array and render the component for each item?
- a)
forEach
- b)
map
- c)
filter
- d)
find
Answer: b) map
- Lucas is storing a sensitive token in his React app and wants to prevent it from being accessed through JavaScript. Where is the best place to store the token?
- a) Local Storage
- b) Session Storage
- c)
httpOnly
Cookies - d) Redux
Answer: c) httpOnly
Cookies
No comments:
Post a Comment