0% found this document useful (0 votes)
3 views4 pages

Full Stack NodeJS Part2 Solutions

Uploaded by

patanjalisharmaa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Full Stack NodeJS Part2 Solutions

Uploaded by

patanjalisharmaa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Full Stack Web Development Exam - Part

2
Question Bank & Solutions (Questions 11-24)

Question 11:

Which of the following status codes represents a successful "Created" response?

A. 200
B. 201
C. 202
D. 204

Correct Answer: B. 201

Question 14:

Which Mongoose method is used to save a new document to the database?

A. [Link]()
B. [Link]()
C. [Link]()
D. [Link]()

Correct Answer: A. [Link]()


Question 15:

In Mongoose, how do you define a schema field that is required?

A. required: true
B. mandatory: true
C. validate: true
D. check: true

Correct Answer: A. required: true

Question 16:

Which of the following is NOT a valid HTTP method used in REST APIs?

A. GET
B. POST
C. FETCH
D. DELETE

Correct Answer: C. FETCH

Question 18:

In JWT (JSON Web Token), what does the "payload" typically contain?

A. User credentials like password


B. User identity and additional metadata (claims)
C. The secret key used for signing
D. The entire database user record

Correct Answer: B. User identity and additional metadata (claims)


Question 19:

Which header is commonly used to send a JWT in an HTTP request?

A. Content-Type
B. Authorization
C. X-Auth-Token
D. Bearer

Correct Answer: B. Authorization

Question 20:

What is the primary purpose of 'bcrypt' in a [Link] application?

A. To encrypt data in transit


B. To hash and salt passwords for secure storage
C. To generate JWT tokens
D. To compress response bodies

Correct Answer: B. To hash and salt passwords for secure storage

Question 21:

Which MongoDB operator is used to update a specific field in a document?

A. $change
B. $set
C. $update
D. $replace

Correct Answer: B. $set


Question 22:

What does the MongoDB command [Link]({ price: { $gt: 100 } }) do?

A. Finds all documents where price is greater than 100


B. Finds all documents where price is equal to 100
C. Finds all documents where price is less than 100
D. Deletes all documents where price is greater than 100

Correct Answer: A. Finds all documents where price is greater than 100

Question 24:

In Mongoose, what is the purpose of .populate() when used with a query?

A. To add more fields to the document at runtime.


B. To replace a path in a document with the actual document(s) from another collection.
C. To merge two different collections into one.
D. To validate the schema against external data.

Correct Answer: B. To replace a path in a document with the actual document(s) from
another collection.

You might also like