Monday, October 28, 2024

TCS Wings 1 T1 MERN - Set 8

Rahul Vijayan
Follow for more updates

TCS Wings 1 T1 MERN - Set 8


  1. Mia is creating a dynamic list in React and wants each list item to have a unique identifier to avoid warning messages. Which attribute should she assign to each item?
  • a) ref
  • b) id
  • c) className
  • d) key

Answer: d) key


  1. Jack is implementing a sorting feature in MongoDB that arranges documents by a field in ascending order. Which value should he pass to the sort method to achieve this?
  • a) 1
  • b) -1
  • c) $asc
  • d) $desc

Answer: a) 1


  1. Sofia is handling CRUD operations in her Express app. Which method should she use to update a specific field in an existing document in MongoDB?
  • a) insertOne
  • b) updateOne
  • c) deleteOne
  • d) findOne

Answer: b) updateOne


  1. Ryan needs to call an API in his React app and wants the call to occur only once when the component mounts. What should he use as the dependency array for useEffect?
  • a) [props]
  • b) [state]
  • c) []
  • d) undefined

Answer: c) []


  1. Isla is using MongoDB and wants to limit her query results to only 10 documents. Which MongoDB method allows her to control the number of results?
  • a) skip
  • b) limit
  • c) count
  • d) filter

Answer: b) limit


  1. Mason is developing a PWA and wants the app to be available offline. Which browser feature allows his app to cache assets for offline access?
  • a) Local Storage
  • b) Service Worker
  • c) Session Storage
  • d) IndexedDB

Answer: b) Service Worker


  1. Ava wants to retrieve only specific fields from documents in a MongoDB collection. Which MongoDB method allows her to control which fields are returned?
  • a) find
  • b) select
  • c) project
  • d) limit

Answer: c) project


  1. Ethan wants to perform an aggregation in MongoDB that calculates the maximum value of a field in each group. Which operator should he use within the $group stage?
  • a) $sum
  • b) $avg
  • c) $max
  • d) $min

Answer: c) $max


  1. Mia is using axios to post data to an API and wants to handle both success and error responses. Which method allows her to catch errors from the API response?
  • a) .then()
  • b) .get()
  • c) .catch()
  • d) .finally()

Answer: c) .catch()


  1. Ella needs to pass data from a parent React component to its child component. Which React concept should she use?
  • a) State
  • b) Props
  • c) Context
  • d) Lifecycle

Answer: b) Props 

No comments:

Post a Comment

TCS Wings 1 T1 MERN - Set 10

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 acce...