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.

_______ returns the remainder of the first number divided by the second.(a) $rem(b) $mod(c) $div(d) None of the mentionedThe question was asked in quiz.Enquiry is from Pipeline Limits in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer» RIGHT option is (b) $mod

To EXPLAIN I would say: $DIVIDE RETURNS the result of dividing the first NUMBER by the second.
52.

$multiply __________ numbers to return the result.(a) multiplies(b) divides(c) comapres(d) all of the mentionedI got this question in exam.My query is from Pipeline Limits topic in division Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer» RIGHT choice is (a) multiplies

The BEST I can explain: $MULTIPLY accepts any number of ARGUMENT expressions.
53.

_______ adds numbers to return the sum, or adds numbers and a date to return a new date.(a) $addnum(b) $setadd(c) $adds(d) $addThis question was addressed to me during an internship interview.This intriguing question originated from Pipeline Limits in division Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The CORRECT option is (d) $add

For explanation: If adding NUMBERS and a date, treats the numbers as MILLISECONDS.

54.

______ returns true if the first value is less than the second.(a) $lte(b) $lt(c) $setEquals(d) None of the mentionedThe question was asked during a job interview.Asked question is from Pipeline Limits topic in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Correct CHOICE is (b) $lt

To elaborate: $LTE returns true if the first value is less than or equal to the SECOND.

55.

$ne returns true if the values are not _______(a) equivalent(b) null(c) 0(d) none of the mentionedThis question was addressed to me in an international level competition.My question is from Pipeline Limits in division Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The correct answer is (a) EQUIVALENT

Explanation: $NE COMPARES TWO values and returns FALSE when the values are equivalent.

56.

Comparison expressions return a boolean except for ________ which returns a number.(a) $copy(b) $cmp(c) $num(d) None of the mentionedI had been asked this question in an internship interview.Question is from Pipeline Limits in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Right choice is (b) $cmp

The BEST I can EXPLAIN: The $cmp compares both VALUE and TYPE, using the SPECIFIED BSON comparison order for values of different types.

57.

________ returns a set with elements that appear in any of the input sets.(a) $setIntersection(b) $setDifference(c) $setEquals(d) $setUnionThe question was posed to me at a job interview.The question is from Pipeline Optimization in division Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Right answer is (d) $setUnion

The best I can explain: $setUnion PERFORMS SET OPERATION on arrays, treating arrays as sets.

58.

$allElementsTrue returns true if no element of a set evaluates to ____________(a) false(b) true(c) 0(d) 1The question was posed to me by my school teacher while I was bunking the class.My enquiry is from Pipeline Optimization in section Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Correct answer is (a) false

Explanation: An empty ARRAY RETURNS TRUE.

59.

_______ accepts only single argument expression.(a) $setIsSubset(b) $bool(c) $anyElementTrue(d) None of the mentionedThis question was posed to me in an online interview.My doubt stems from Pipeline Optimization in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer» CORRECT ANSWER is (c) $anyElementTrue

To ELABORATE: $anyElementTrue returns true if any elements of a set evaluate to true; otherwise, returns false.
60.

Which of the following performs a relative complement of the second set relative to the first?(a) $setIntersection(b) $setDifference(c) $setEquals(d) $setUnionThe question was posed to me in examination.This intriguing question originated from Pipeline Optimization in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Right CHOICE is (a) $setIntersection

The explanation: $setDifference RETURNS a set with elements that APPEAR in the FIRST set but not in the SECOND set.

61.

Point out the wrong statement.(a) Boolean expressions evaluate their argument expressions as booleans and return a boolean as the result(b) In addition to the false boolean value, Boolean expression evaluates as false the following: null, 0, and undefined values(c) Set expressions performs set operation on arrays, treating arrays as sets(d) None of the mentionedThe question was posed to me in an online quiz.The above asked question is from Pipeline Optimization in division Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The correct choice is (d) None of the mentioned

The best I can EXPLAIN: The BOOLEAN EXPRESSION evaluates all other VALUES as true, including non-zero numeric values and arrays.

62.

Which of the following accepts any number of argument expression?(a) $setIntersection(b) $setDifference(c) $setEquals(d) None of the mentionedThe question was posed to me in an interview.I'm obligated to ask this question of Pipeline Optimization topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Correct choice is (a) $setIntersection

The best I can EXPLAIN: $setIntersection RETURNS a set with ELEMENTS that APPEAR in all of the input sets.

63.

________ returns true if the input sets have the same distinct elements.(a) $setUnion(b) $setDifference(c) $setEquals(d) None of the mentionedI had been asked this question in semester exam.Origin of the question is Pipeline Optimization topic in section Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The CORRECT answer is (c) $setEquals

Explanation: $setEquals ACCEPTS two or more argument EXPRESSIONS.

64.

Point out the correct statement.(a) To avoid parsing ambiguity if the argument is a literal array, you must wrap the literal array in a $lits expression or keep the outer array that designates the argument list(b) Expressions cannot include field paths and system variables, literals, expression objects, and expression operators(c) Operator expressions are similar to functions that take arguments(d) All of the mentionedI have been asked this question in a national level competition.My question is based upon Pipeline Optimization topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Right ANSWER is (c) Operator EXPRESSIONS are similar to functions that take arguments

To ELABORATE: In general, these expressions take an array of arguments and have the FOLLOWING form: { : [ , … ] }

65.

______ expressions ignores the duplicate entries in each input array and the order of the elements.(a) set(b) boolean(c) aggregate(d) none of the mentionedThis question was posed to me at a job interview.The doubt is from Pipeline Optimization topic in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The correct option is (a) SET

Best explanation: If the set OPERATION returns a set, the operation filters out duplicates in the result to OUTPUT an ARRAY that contains only unique entries.

66.

MongoDB treats the literals as projection flags, valid only in the _______ stage.(a) $project(b) $gmap(c) $match(d) None of the mentionedThis question was addressed to me in quiz.My query is from Aggregation Mechanics in section Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The CORRECT OPTION is (a) $project

The EXPLANATION is: PROJECTION flags can be 1 or true to INCLUDE the field.

67.

In the vars assignment block, ________ refers to the value of an externally defined variable low.(a) “$$low”(b) “$$lowin”(c) “$$1”(d) None of the mentionedI have been asked this question by my school teacher while I was bunking the class.The above asked question is from Aggregation Mechanics topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Correct choice is (a) “$$LOW

The best I can EXPLAIN: If low is not DEFINED outside this $LET expression block, the expression is invalid.

68.

To avoid treating numeric or boolean literals as projection flags, use the _______ expression to wrap the numeric or boolean literals.(a) $literal(b) $bool(c) $unwin(d) None of the mentionedI got this question during an internship interview.The origin of the question is Aggregation Mechanics in section Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Correct option is (a) $LITERAL

Easiest EXPLANATION: The $literal expression has the FOLLOWING syntax: { $literal: }

69.

________ applies an expression to each item in an array and returns an array with the applied results.(a) $map(b) $geo(c) $geoRear(d) None of the mentionedThe question was asked in exam.Question is taken from Aggregation Mechanics in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer» CORRECT choice is (a) $MAP

Easiest EXPLANATION: The $map expression has the following SYNTAX: { $map: { input: , as: , in: } }
70.

______ binds variables for use in the specified expression.(a) $skip(b) $let(c) $bind(d) None of the mentionedThe question was asked during an online interview.The question is from Aggregation Mechanics topic in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Right ANSWER is (B) $let

For EXPLANATION: $let ALSO returns the result of the expression.

71.

Point out the wrong statement.(a) Literals can be of any type(b) CURRENT cannot be rebound(c) MongoDB parses string literals that start with a dollar sign $(d) None of the mentionedThe question was asked in semester exam.My question is based upon Aggregation Mechanics topic in section Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer» RIGHT answer is (b) CURRENT cannot be rebound

The best explanation: Along with the CURRENT system VARIABLE, other system VARIABLES are also AVAILABLE for use in expressions.
72.

Which of the following statement is equivalent to “$$CURRENT.”?(a) “$%”(b) “%”(c) “$$”(d) “$”This question was addressed to me during an interview.The above asked question is from Aggregation Mechanics topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The correct CHOICE is (d) “$

To explain I would SAY: CURRENT is a system variable that defaults to the root of the current OBJECT in the most STAGES, unless stated otherwise in specific stages.

73.

Aggregation expressions use ______ path to access fields in the input documents.(a) mpath(b) dbpath(c) lpath(d) fieldThis question was posed to me by my college professor while I was bunking the class.This intriguing question comes from Aggregation Mechanics in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Right choice is (d) FIELD

The best I can explain: To SPECIFY a field path, USE a string that prefixes with a DOLLAR sign $ the field name or the dotted field name, if the field is in embedded DOCUMENT.

74.

Point out the correct statement.(a) To access variables in expressions, use a string that prefixes the variable name with $$$(b) Expressions can include field paths and system variables, literals, expression objects, and expression operators(c) To specify a field path, use a string that prefixes with a dollar sign % the field name or the dotted field name(d) All of the mentionedThe question was posed to me in homework.I'm obligated to ask this question of Aggregation Mechanics in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Correct choice is (b) Expressions can include FIELD PATHS and system variables, literals, EXPRESSION OBJECTS, and expression operators

Easiest explanation: Expressions can be nested.

75.

________ deconstructs an array field from the input documents to output a document for each element.(a) $unwindelem(b) $unwind(c) $unwin(d) None of the mentionedThe question was posed to me by my college professor while I was bunking the class.This question is from Aggregation Operations in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer» RIGHT CHOICE is (C) $unwin

Best explanation: Each OUTPUT document replaces the array with an element VALUE.
76.

Which of the following operator is related to geography of data?(a) $geoSpatial(b) $geoNear(c) $geoRear(d) None of the mentionedThe question was posed to me during an interview for a job.My doubt stems from Aggregation Operations topic in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The correct choice is (B) $geoNear

The best I can explain: $geoNear RETURNS an ordered STREAM of DOCUMENTS BASED on the proximity to a geospatial point.

77.

Which of the following stages cannot appear multiple times in a pipeline?(a) $regex(b) $reg(c) $match(d) $outI had been asked this question in an online quiz.My question is taken from Aggregation Mechanics topic in section Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer» RIGHT CHOICE is (c) $match

Easiest explanation: To USE the $out STAGE, it must be the last stage in the pipeline.
78.

_____ Writes the resulting documents of the aggregation pipeline to a collection.(a) $out(b) $in(c) $output(d) None of the mentionedI have been asked this question in unit test.I would like to ask this question from Aggregation Operations topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Right option is (a) $out

To explain I would SAY: To use the $out STAGE, it MUST be the last stage in the pipeline.

79.

Which of the following operator incorporates the functionality of $match, $sort, and $limit for geospatial data?(a) $geoSpatial(b) $geoNear(c) $geoRear(d) None of the mentionedThe question was asked in an internship interview.My question is taken from Aggregation Operations topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Correct OPTION is (b) $geoNear

Explanation: The OUTPUT documents include an additional DISTANCE FIELD and can include a location identifier field.

80.

________ passes the first n documents unmodified to the pipeline where n is the specified limit.(a) $skip(b) $limit(c) $match(d) $redactThis question was addressed to me in exam.This intriguing question originated from Aggregation Operations topic in section Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The correct choice is (b) $limit

The best I can explain: For each INPUT document, OUTPUTS EITHER one document (for the first n documents) or ZERO documents (after the first n documents).

81.

Which of the following can be used to implement field level redaction?(a) $skip(b) $limit(c) $match(d) $redactThe question was asked in an online interview.My question is from Aggregation Operations in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Right option is (d) $redact

The explanation: $redact reshapes each document in the STREAM by RESTRICTING the content for each document BASED on information stored in the DOCUMENTS themselves.

82.

_______ reorders the document stream by a specified sort key.(a) $skip(b) $limit(c) $sort(d) None of the mentionedThe question was posed to me during an interview.My question comes from Aggregation Operations topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer» CORRECT option is (c) $sort

To elaborate: Only the order changes; the DOCUMENTS REMAIN UNMODIFIED.
83.

Point out the wrong statement.(a) Documents do not pass through the stages in sequence(b) Pipeline stages appear in an multi dimensional array(c) $project reshapes each document in the stream, such as by adding new fields or removing existing fields(d) All of the mentionedThe question was posed to me in semester exam.My question is from Aggregation Operations in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The CORRECT option is (c) $project reshapes each DOCUMENT in the stream, such as by adding new fields or REMOVING existing fields

To explain: For each INPUT document, OUTPUTS one document.

84.

_______ filters the document stream to allow only matching documents to pass unmodified into the next pipeline stage.(a) $regex(b) $reg(c) $match(d) None of the mentionedThis question was addressed to me during an online interview.This question is from Aggregation Operations in division Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer» RIGHT ANSWER is (c) $match

To explain: $match uses standard MONGODB queries. For each INPUT DOCUMENT, outputs either one document (a match) or zero documents (no match).
85.

What would be the maximum document size for results of mapreduce operation?(a) 15 MB(b) 16 MB(c) 17 MB(d) All of the mentionedThis question was addressed to me in exam.This intriguing question comes from Map-Reduce in division Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The correct choice is (b) 16 MB

The best explanation: When returning the results of a map REDUCE operation INLINE, the result documents must be within the BSON Document Size limit, which is currently 16 megabytes.

86.

Map-reduce uses custom __________ functions to perform the map and reduce operations.(a) Java(b) Javascript(c) JSON(d) None of the mentionedI had been asked this question in examination.The origin of the question is Map-Reduce in division Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The correct choice is (B) JAVASCRIPT

Easiest EXPLANATION: JavaScript PROVIDE great flexibility COMPARED to the aggregation pipeline.

87.

_________ can return the results of a map-reduce operation as a document, or may write the results to collections.(a) mapReduce(b) mapperRed(c) RedMap(d) none of the mentionedThe question was asked in an online interview.I would like to ask this question from Map-Reduce in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The correct OPTION is (a) mapReduce

The best explanation: Map-reduce OPERATIONS take the documents of a single collection as the input and can PERFORM any arbitrary sorting and LIMITING before beginning the map stage.

88.

For most aggregation operations, the ______ Pipeline provides better performance and more coherent interface.(a) Aggregate(b) Replication(c) Sharding(d) None of the mentionedThe question was asked during an online interview.I'm obligated to ask this question of Map-Reduce in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The correct answer is (a) Aggregate

Explanation: Map-reduce OPERATIONS PROVIDE some FLEXIBILITY that is not PRESENTLY available in the aggregation PIPELINE.

89.

The output of the reduce function may pass through a ______ function to further condense or process the results of the aggregation.(a) finalize(b) filter(c) procedure(d) none of the mentionedI got this question in final exam.Question is taken from Map-Reduce topic in section Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer» CORRECT choice is (a) finalize

To explain I WOULD say: The INPUT and the output collections MAY be sharded.
90.

MongoDB applies the _________ phase, which collects and condenses the aggregated data.(a) map(b) reduce(c) mapper(d) all of the mentionedThis question was addressed to me in class test.I need to ask this question from Map-Reduce topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer» RIGHT OPTION is (b) reduce

For EXPLANATION: MONGODB then stores the results in a collection.
91.

MongoDB applies the _____ phase to each input document in mapreduce.(a) map(b) reduce(c) mapper(d) all of the mentionedI got this question during an interview.The question is from Map-Reduce topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The CORRECT OPTION is (a) MAP

To elaborate: The map FUNCTION emits key-value pairs.

92.

Which of the following database command is used for mapreduce function?(a) mapReduce(b) mapperRed(c) redmap(d) none of the mentionedI got this question during an interview for a job.This intriguing question originated from Map-Reduce in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The correct answer is (a) mapReduce

To explain: For map-reduce OPERATIONS, MONGODB PROVIDES the mapReduce DATABASE COMMAND.

93.

Which of the following method is overrided by Index filters?(a) hint(b) plan(c) execute(d) all of the mentionedThe question was asked in an internship interview.My question is taken from Aggregation Pipeline in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The CORRECT answer is (a) hint

To EXPLAIN I would say: When an index FILTER EXISTS for the query SHAPE, MongoDB ignores the hint().

94.

Query shape consists of a combination of query, sort, and _________ specifications.(a) selection(b) projection(c) collection(d) none of the mentionedThis question was posed to me during a job interview.I need to ask this question from Aggregation Pipeline in section Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Correct choice is (c) collection

The explanation is: If an INDEX FILTER exists for a GIVEN query SHAPE, the optimizer only considers those indexes SPECIFIED in the filter.

95.

Syntax for specifying an initial batch size for the cursor is ________________(a) cursor: { batchSize: }(b) cursor: { batchSize: }(c) cur: { batchSize: }(d) none of the mentionedI had been asked this question in a job interview.My question is based upon Aggregation Pipeline topic in section Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Correct answer is (b) cursor: { batchSize: }

The best explanation: A batchSize of 0 means an empty first BATCH and is USEFUL for quickly RETURNING a cursor or failure message WITHOUT doing SIGNIFICANT server-side work.

96.

To handle large datasets, set _________ option to true to enable writing data to temporary files.(a) enableDiskUse(b) allowDiskUse(c) validateDiksUse(d) none of the mentionedThis question was posed to me in exam.The origin of the question is Aggregation Pipeline topic in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Right OPTION is (b) allowDiskUse

Best EXPLANATION: In the mongo shell, when you assign the CURSOR returned from the find() method to a variable using the var KEYWORD, the cursor does not automatically ITERATE.

97.

______ can be used to iterate the cursor of document results returned by db.collection.find().(a) it(b) next(c) cur(d) none of the mentionedThis question was addressed to me in a national level competition.The query is from Aggregation Pipeline topic in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Correct CHOICE is (a) it

Easy explanation: The mongo shell iterates the returned cursor automatically to PRINT the RESULTS.

98.

Point out the wrong statement.(a) Some pipeline stages may generate new documents or filter out documents(b) Pipeline stages do need to produce one output document for every input document(c) Pipeline stages can appear multiple times in the pipeline(d) None of the mentionedThis question was addressed to me by my college director while I was bunking the class.Origin of the question is Aggregation Pipeline in section Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Correct option is (b) PIPELINE stages do need to produce ONE output document for EVERY INPUT document

To EXPLAIN: Pipeline stages do need to produce one output document for every input document.

99.

Cursors returned from aggregation only supports cursor methods like ________________(a) cursor.hasNext()(b) cursor.Next()(c) cursor.has()(d) all of the mentionedI have been asked this question in a job interview.Question is from Aggregation Pipeline topic in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Right CHOICE is (a) CURSOR.hasNext()

The explanation: cursor.hasNext() returns true if the cursor RETURNED by the db.collection.find() query can ITERATE further to return more documents.

100.

________ calculates aggregate values for the data in a collection.(a) db.collection.aggregate(b) db.collection.agg(c) db.collection.pipeline(d) all of the mentionedThe question was asked in homework.My doubt stems from Aggregation Pipeline in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The correct choice is (a) db.collection.aggregate

Easiest explanation: In the MONGO shell, if the cursor returned from the db.collection.aggregate() is not assigned to a variable USING the var keyword, then the mongo shell automatically iterates the cursor up to 20 TIMES.