Rahul Vijayan
Follow for more updates
TCS Wings 1 T1 MERN - Set 3
- Ethan is working with MongoDB and needs to perform an aggregation to calculate the average price of products in each category. Which MongoDB pipeline stage should he use?
- a)
$group
- b)
$match
- c)
$sort
- d)
$project
Answer: a) $group
- Amelia has created a form in her React app to add new items to her MongoDB collection through an Express API. Which HTTP method should she use for this request?
- a) GET
- b) POST
- c) PUT
- d) DELETE
Answer: b) POST
- Lucas wants to prevent his React component from re-rendering when a prop changes. Which hook should he use to memoize the component to prevent unnecessary renders?
- a)
useEffect
- b)
useCallback
- c)
useMemo
- d)
React.memo
Answer: d) React.memo
- Mia is designing a MongoDB query to find all products with a price greater than $100. Which operator will help her achieve this?
- a)
$lt
- b)
$gt
- c)
$ne
- d)
$in
Answer: b) $gt
- Liam has a PWA and wants it to load as a fullscreen app when launched from the home screen on mobile. Which attribute in the
manifest.json
file will help him achieve this?
- a)
display
- b)
theme_color
- c)
background_color
- d)
orientation
Answer: a) display
- Sofia is optimizing her Express app by adding middleware for logging. Which popular middleware package can she use for this purpose?
- a)
morgan
- b)
body-parser
- c)
cors
- d)
helmet
Answer: a) morgan
- Ryan wants to ensure his MongoDB collections are accessible only to authenticated users in his Express app. Which middleware is best suited to protect routes requiring authentication?
- a) Logging middleware
- b) Authorization middleware
- c) Error-handling middleware
- d) Static middleware
Answer: b) Authorization middleware
- Harper is implementing a feature in her React app that updates based on a prop change. Which hook will allow her to respond to the prop change in a controlled way?
- a)
useState
- b)
useEffect
- c)
useCallback
- d)
useMemo
Answer: b) useEffect
- Noah is building a Node.js app and wants to handle JSON data in incoming requests. Which Express middleware should he add?
- a)
express.static
- b)
express.json
- c)
express.urlencoded
- d)
body-parser
Answer: b) express.json
- Ava has an API call in her React component and wants to avoid rendering it twice when the component mounts. Which dependency array setup should she use in
useEffect
?
- a)
[]
- b)
[props]
- c)
[state]
- d)
useEffect without array
Answer: a) []
No comments:
Post a Comment