Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

51.

Which of the following method corresponds to Order by clause in SQL?(a) sort()(b) order()(c) orderby()(d) all of the mentionedThis question was addressed to me in semester exam.Enquiry is from Getting Started with MongoDB in chapter MongoDB CRUD Concepts and Operation of MongoDB

Answer»

Correct answer is (a) sort()

Best explanation: The sort() method ORDERS the DOCUMENTS in the RESULT SET.

52.

The mongo shell and the drivers provide several cursor methods that call on the cursor returned by the _______ method to modify its behavior.(a) cursor()(b) find()(c) findc()(d) none of the mentionedThis question was addressed to me during a job interview.Origin of the question is Getting Started with MongoDB in portion MongoDB CRUD Concepts and Operation of MongoDB

Answer»

Right choice is (b) FIND()

Best EXPLANATION: The method iterates completely the cursor, LOADING all the documents.

53.

Which of the following method is called while accessing documents using the array index notation?(a) cur.toArray()(b) cursor.toArray()(c) doc.toArray()(d) all of the mentionedThe question was posed to me in unit test.I'm obligated to ask this question of Getting Started with MongoDB in chapter MongoDB CRUD Concepts and Operation of MongoDB

Answer»

Right OPTION is (b) cursor.toArray()

To explain: The toArray() method RETURNS an array that CONTAINS all the documents from a cursor.

54.

Point out the wrong statement.(a) Documents have static schema in MongoDB(b) Eventually-consistent reads can be distributed over replicated servers(c) Indexes can include keys from embedded documents and arrays(d) None of the mentionedThis question was posed to me by my school teacher while I was bunking the class.I would like to ask this question from Getting Started with MongoDB topic in section MongoDB CRUD Concepts and Operation of MongoDB

Answer»

Right choice is (a) DOCUMENTS have STATIC schema in MongoDB

Explanation: Dynamic schema MEANS that documents in the same collection do not need to have the same set of fields or structure, and common fields in a collection’s documents MAY hold different TYPES of data.

55.

Which of the following method returns true if the cursor has documents?(a) hasMethod()(b) hasNext()(c) hasDoc()(d) all of the mentionedThe question was asked at a job interview.My question comes from Getting Started with MongoDB topic in portion MongoDB CRUD Concepts and Operation of MongoDB

Answer» CORRECT choice is (b) hasNext()

The best I can explain: hasNext() returns true if the CURSOR returned by the db.collection.find() QUERY can ITERATE further to return more DOCUMENTS.
56.

____________ method renders the document in a JSON-like format.(a) displayjson(b) print(c) printjson(d) printdocThis question was addressed to me in unit test.Origin of the question is Getting Started with MongoDB topic in division MongoDB CRUD Concepts and Operation of MongoDB

Answer» CORRECT answer is (c) printjson

To EXPLAIN I would say: printjson() OPERATION displays all DOCUMENTS.
57.

Point out the correct statement.(a) A database is a set of key-value pairs(b) A MongoDB deployment hosts a number of databases(c) A document holds a set of collections(d) All of the mentionedThis question was addressed to me during an interview.This is a very interesting question from Getting Started with MongoDB topic in division MongoDB CRUD Concepts and Operation of MongoDB

Answer» CORRECT choice is (b) A MONGODB deployment hosts a number of databases

The best I can EXPLAIN: A database holds a set of COLLECTIONS. A COLLECTION holds a set of documents.
58.

When you query a collection, MongoDB returns a ________ object that contains the results of the query.(a) row(b) cursor(c) colums(d) none of the mentionedI had been asked this question during an interview.This interesting question is from Getting Started with MongoDB topic in chapter MongoDB CRUD Concepts and Operation of MongoDB

Answer»

The correct option is (b) cursor

To explain: The MONGO shell then iterates over the cursor to DISPLAY the RESULTS.

59.

Command to check existence of collection is _____________(a) show collection(b) show collections(c) show collect(d) none of the mentionedThis question was addressed to me in final exam.This is a very interesting question from Getting Started with MongoDB topic in division MongoDB CRUD Concepts and Operation of MongoDB

Answer»

The CORRECT option is (B) SHOW collections

To explain: The MONGO shell will return the list of the collections in the current database.

60.

Which of the following operation is used to switch to new database mydb?(a) use dbs(b) use db(c) use mydb(d) use mydbsI had been asked this question at a job interview.My doubt is from Getting Started with MongoDB topic in division MongoDB CRUD Concepts and Operation of MongoDB

Answer»

Right OPTION is (c) use mydb

The best explanation: .Confirm that your session has the mydb database as context, by checking the VALUE of the db object, which returns the name of the CURRENT database.

61.

Which of the following also returns a list of databases?(a) show databases(b) show database(c) display dbs(d) all of the mentionedI got this question during an online interview.I want to ask this question from Getting Started with MongoDB topic in portion MongoDB CRUD Concepts and Operation of MongoDB

Answer» CORRECT answer is (a) SHOW DATABASES

The BEST I can EXPLAIN: show databases is new in version 2.4.
62.

___________ command display the list of databases.(a) show db(b) show dbs(c) show data(d) display dbsThis question was posed to me in an internship interview.This key question is from Getting Started with MongoDB topic in portion MongoDB CRUD Concepts and Operation of MongoDB

Answer» CORRECT choice is (b) SHOW dbs

The explanation is: Show dbs PRINT a list of all DATABASES on the server.
63.

Point out the wrong statement.(a) MongoDB works right out of the box, and you can dive right into developing your application, instead of spending a lot of time fine-tuning obscure database configurations(b) MongoDB works hard to be very easy to install, configure, maintain, and use(c) MongoDB does not provide a lot of the features of a traditional RDBMS(d) None of the mentionedI got this question in unit test.The origin of the question is Getting Started with MongoDB in portion MongoDB CRUD Concepts and Operation of MongoDB

Answer»

The correct option is (c) MONGODB does not PROVIDE a lot of the features of a traditional RDBMS

To explain: MongoDB focuses on FLEXIBILITY, power, SPEED, and ease of use.

64.

After starting the mongo shell, your session will use the ________ database by default.(a) mongo(b) master(c) test(d) primaryI have been asked this question in my homework.Question is from Getting Started with MongoDB topic in chapter MongoDB CRUD Concepts and Operation of MongoDB

Answer»

Correct answer is (C) test

To elaborate: At any TIME, DB OPERATION at the mongo shell is used to report the name of the current database.

65.

mongo looks for a database server listening on port 27017 on the ________ interface.(a) web(b) localhost(c) web host(d) all of the mentionedThe question was posed to me during an interview.I would like to ask this question from Getting Started with MongoDB in section MongoDB CRUD Concepts and Operation of MongoDB

Answer»

The correct option is (b) localhost

The EXPLANATION is: To connect to a server on a DIFFERENT PORT or INTERFACE, use the –port and –host options.

66.

Point out the correct statement.(a) MMS provides backup and monitoring(b) MongoDB can also be configured for data replication(c) MMS is available to all users in the cloud and on-premises as part of MongoDB Standard and Enterprise Subscriptions(d) All of the mentionedI have been asked this question by my school principal while I was bunking the class.Asked question is from Getting Started with MongoDB in chapter MongoDB CRUD Concepts and Operation of MongoDB

Answer» CORRECT option is (d) All of the mentioned

To EXPLAIN I would SAY: MongoDB is limited to a total data size of about 2GB for all DATABASES in 32-bit mode.
67.

__________ is a part of the standard MongoDB distribution and provides a full JavaScript environment.(a) mongod(b) mongodb(c) mongo(d) none of the mentionedThis question was addressed to me during an online exam.This intriguing question comes from Getting Started with MongoDB topic in section MongoDB CRUD Concepts and Operation of MongoDB

Answer» RIGHT OPTION is (c) mongo

Easy EXPLANATION: mongo provides complete access to the JavaScript language and all standard functions as WELL as a full database interface for MongoDB.