

InterviewSolution
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.
1. |
____________ works similar to HAVING clause in SQL.(a) $setcon(b) $group(c) $match(d) None of the mentionedThe question was asked during an online interview.I would like to ask this question from SQL to Aggregation Mapping Chart topic in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» CORRECT answer is (c) $MATCH To elaborate: Place the $match as EARLY in the aggregation PIPELINE as possible. |
|
2. |
_______ groups documents by some specified expression and outputs to the next stage a document for each distinct grouping.(a) $setcon(b) $group(c) $match(d) None of the mentionedThis question was addressed to me in a national level competition.Origin of the question is SQL to Aggregation Mapping Chart in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» CORRECT answer is (b) $group For EXPLANATION I WOULD say: $group works SIMILAR to group by clause in SQL. |
|
3. |
Which of the following provides similar functionality to join?(a) $unwindelem(b) $unwind(c) $unwin(d) None of the mentionedThe question was posed to me by my school teacher while I was bunking the class.The doubt is from SQL to Aggregation Mapping Chart in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Correct option is (c) $unwin |
|
4. |
Which of the following is used to retrieve like SELECT clause in SQL?(a) $reduce(b) $select(c) $project(d) None of the mentionedThe question was asked in an online interview.This is a very interesting question from SQL to Aggregation Mapping Chart in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» RIGHT CHOICE is (c) $project To explain: The $project takes a DOCUMENT that can specify the INCLUSION of fields, the suppression of the _id field, the addition of NEW fields, and the resetting the values of existing fields. |
|
5. |
________ limits the number of documents in result set.(a) $project(b) $geo(c) $limit(d) None of the mentionedThe question was asked during a job interview.I need to ask this question from SQL to Aggregation Mapping Chart in portion Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Right option is (c) $LIMIT |
|
6. |
Point out the wrong statement.(a) CURRENT references the start of the field path being processed in the aggregation pipeline stage(b) All stages start with CURRENT the same as ROOT(c) DESCENDING is one of the allowed results of a $let expression(d) None of the mentionedI have been asked this question by my school principal while I was bunking the class.Origin of the question is SQL to Aggregation Mapping Chart topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» RIGHT option is (c) DESCENDING is one of the allowed results of a $LET expression The best I can explain: HOWEVER, since $ |
|
7. |
Which of the operator is similar to order by clause in RDBMS?(a) $sort(b) $match(c) $sortby(d) None of the mentionedI had been asked this question in an interview.Origin of the question is SQL to Aggregation Mapping Chart in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» CORRECT OPTION is (a) $sort To explain I would say: 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. |
|
8. |
If all documents for the $min operation have null value for the field or are missing the field, the $min operator returns ____ for the minimum value.(a) 1(b) 0(c) null(d) none of the mentionedI had been asked this question in an interview for internship.My doubt is from Pipeline Operators topic in division Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Right answer is (c) null |
|
9. |
Point out the wrong statement.(a) Variables can hold any BSON type data(b) Aggregation expressions can use both user-defined and system variables(c) To access the value of the variable, use a string with the variable name prefixed with double dollar signs ($$)(d) None of the mentionedThis question was posed to me in my homework.I would like to ask this question from SQL to Aggregation Mapping Chart topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» The CORRECT option is (d) None of the mentioned |
|
10. |
__________ references the root document, i.e. the top-level document, currently being processed in the aggregation pipeline stage.(a) CURRENT(b) ROOT(c) PRUNE(d) All of the mentionedThe question was asked in class test.Origin of the question is SQL to Aggregation Mapping Chart topic in division Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» RIGHT OPTION is (b) ROOT For explanation I WOULD SAY: CURRENT is modifiable. |
|
11. |
$addToSet returns an array of all _______ values that results from applying an expression to each document.(a) unique(b) non unique(c) distinct(d) all of the mentionedThis question was addressed to me in an online interview.This intriguing question comes from Pipeline Operators topic in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» The CORRECT answer is (a) unique |
|
12. |
Which of the following is syntax for calculating minimum value?(a) { $minimum: }(b) { $min: }(c) { $minimum: }(d) None of the mentionedThe question was asked by my college director while I was bunking the class.Asked question is from Pipeline Operators topic in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» The correct ANSWER is (B) { $min: |
|
13. |
__________ returns the highest value from the group of values in documents.(a) $end(b) $last(c) $max(d) $maximumThe question was posed to me in homework.The doubt is from Pipeline Operators topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» CORRECT choice is (C) $MAX Explanation: $max returns the highest value that results from applying an expression to each DOCUMENT in a group of documents that share the same group by KEY. |
|
14. |
Which of the following returns the value that results from applying an expression to the last document?(a) $end(b) $last(c) $max(d) All of the mentionedThis question was addressed to me in semester exam.This interesting question is from Pipeline Operators topic in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» RIGHT option is (b) $last To EXPLAIN: $last has the FOLLOWING syntax: { $last: |
|
15. |
When using $first in a $group stage, the $group stage should follow a _______ stage to have the input documents in a defined order.(a) $order(b) $sort(c) $asc(d) None of the mentionedThis question was posed to me in an online quiz.Origin of the question is Pipeline Operators topic in division Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Correct option is (B) $sort |
|
16. |
Which of the following ignores non numeric values?(a) $order(b) $sum(c) $asc(d) None of the mentionedThis question was posed to me during an internship interview.This intriguing question comes from Pipeline Operators in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» The correct option is (B) $SUM |
|
17. |
Point out the wrong statement.(a) $avg is an accumulator operator available only in the $group stage(b) $sum accumulator can be used to compute the total amount and count for each group of documents(c) $avg ignores numeric values(d) All of the mentionedThe question was posed to me in unit test.My question comes from Pipeline Operators topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» The CORRECT answer is (c) $avg ignores numeric values |
|
18. |
$sum is an accumulator operator available only in the _______ stage.(a) $group(b) $sets(c) $accumulator(d) None of the mentionedI got this question in homework.The above asked question is from Pipeline Operators topic in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» CORRECT option is (a) $group For explanation: $sum CALCULATES and RETURNS the sum of all the NUMERIC values. |
|
19. |
__________ take as input a single expression, evaluating the expression once for each input document, and maintain their state for the group of documents.(a) Computer(b) Monitors(c) Accumulators(d) PerformonerI have been asked this question in quiz.Enquiry is from Pipeline Operators in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» RIGHT choice is (c) Accumulators To EXPLAIN: Accumulators are available only for the $group stage. |
|
20. |
___________ returns either the non-null result of the first expression.(a) $Null(b) $ifNull(c) $ElseNull(d) None of the mentionedI had been asked this question during an interview.Question is taken from Pipeline Operators topic in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» The CORRECT choice is (B) $ifNull |
|
21. |
_______ result encompasses instances of undefined values or missing fields.(a) Number(b) String(c) Null(d) None of the mentionedI have been asked this question in unit test.This intriguing question originated from Pipeline Operators topic in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» The correct ANSWER is (C) NULL |
|
22. |
__________ returns the date as a formatted string.(a) $toString(b) $dateToString(c) $letString(d) None of the mentionedThe question was posed to me in an interview for job.This question is from Pipeline Operators topic in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Right OPTION is (B) $dateToString |
|
23. |
Which of the following returns the hour for a date as a number between 0 and 23?(a) $minute(b) $hour(c) $seconds(d) All of the mentionedThis question was addressed to me during an internship interview.Question is from Pipeline Operators topic in division Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Right choice is (B) $hour |
|
24. |
Which of the following returns year for particular date?(a) $year(b) $yearday(c) $syearofmonth(d) None of the mentionedI got this question in homework.My question is from Pipeline Operators topic in division Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» RIGHT ANSWER is (a) $year To explain: $year RETURNS the year for a date as a NUMBER (e.g. 2014). |
|
25. |
Point out the wrong statement.(a) $weekDay returns the week number for a date as a number between 0 and 53 (leap year)(b) $cond accepts either two expressions in an ordered list or three named parameters(c) $toLower only has a well-defined behavior for strings of ASCII characters(d) None of the mentionedThis question was posed to me during an interview.This key question is from Pipeline Operators topic in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Correct answer is (B) $cond accepts either two expressions in an ordered LIST or three named parameters |
|
26. |
__________ returns the day of the year for a date as a number between 1 and 366.(a) $dayofWeekend(b) $dayOfWeek(c) $dayOfYear(d) None of the mentionedThis question was posed to me during an internship interview.I would like to ask this question from Pipeline Operators topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» RIGHT option is (C) $dayOfYear Best explanation: The $dayOfYear expression has the FOLLOWING syntax:{ $dayOfYear:}. |
|
27. |
Point out the wrong statement.(a) $second returns the seconds for a date as a number between 0 and 60 (leap seconds)(b) $minute returns the minute for a date as a number between 0 and 59(c) $millis returns the milliseconds of a date as a number between 0 and 1000(d) All of the mentionedThis question was posed to me in a national level competition.My question comes from Pipeline Operators in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Right choice is (c) $millis RETURNS the milliseconds of a DATE as a NUMBER between 0 and 1000 |
|
28. |
$dayOfMonth returns the day of the month for a date as a number between ________________(a) 1 and 31(b) 1 and 30(c) 1 and 28(d) None of the mentionedI got this question in examination.I want to ask this question from Pipeline Operators in portion Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» CORRECT option is (a) 1 and 31 To ELABORATE: The $dayOfMonth expression has the following SYNTAX: { $dayOfMonth:}. |
|
29. |
Which of the following mode defaults to false?(a) jsMode(b) scope(c) finalize(d) minI have been asked this question in quiz.The doubt is from Map-Reduce and Sharded Collections topic in division Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Correct option is (a) jsMode |
|
30. |
You can only use jsMode for result sets with fewer than 500,000 distinct key arguments to the mapper’s _______ function.(a) emit()(b) emitter()(c) emitted()(d) none of the mentionedThe question was asked at a job interview.My question is based upon Map-Reduce and Sharded Collections topic in division Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Correct answer is (a) EMIT() |
|
31. |
MongoDB converts the JavaScript objects emitted by the map function to ________ objects.(a) BSON(b) JSON(c) Javascript(d) None of the mentionedI have been asked this question during an interview.This intriguing question originated from Map-Reduce and Sharded Collections in division Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Right ANSWER is (a) BSON |
|
32. |
__________ specifies global variables that are accessible in the map.(a) jsMode(b) scope(c) finalize(d) MinI had been asked this question by my college director while I was bunking the class.This interesting question is from Map-Reduce and Sharded Collections in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Correct OPTION is (b) scope |
|
33. |
If the ______ field for mapReduce has the sharded value, MongoDB shards the output collection using the _id field as the shard key.(a) input(b) $in(c) $out(d) none of the mentionedI got this question in a job interview.I would like to ask this question from Map-Reduce and Sharded Collections topic in division Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Correct OPTION is (C) $out |
|
34. |
Which of the following function follows the reduce method and modifies the output?(a) finalize(b) final(c) max(d) all of the mentionedThis question was posed to me in homework.I'm obligated to ask this question of Map-Reduce and Sharded Collections in division Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» The correct CHOICE is (a) finalize |
|
35. |
Point out the wrong statement.(a) If the output collection does not exist, MongoDB creates and shards the collection on the _id field(b) Map-reduce supports operations on sharded collections, both as an input and as an output(c) mongos dispatches, in parallel, a map-reduce post-processing job to every shard that owns a chunk(d) None of the mentionedThe question was asked in an online quiz.I'm obligated to ask this question of Map-Reduce and Sharded Collections in portion Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Right ANSWER is (d) None of the mentioned |
|
36. |
In MongoDB __________ mongos retrieves the results from each shard, performs a merge sort to order the results.(a) 3.0(b) 2.0(c) 1.0(d) None of the mentionedThis question was posed to me in a job interview.The doubt is from Map-Reduce and Sharded Collections in portion Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» The correct answer is (B) 2.0 |
|
37. |
Point out the correct statement.(a) The read phase takes a exclusive lock(b) The map-reduce operation is composed of many tasks(c) Prior to version 3, JavaScript code executed in a single thread(d) All of the mentionedThis question was addressed to me during an interview for a job.My question comes from Map-Reduce and Sharded Collections in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Correct answer is (b) The MAP-reduce operation is composed of many tasks |
|
38. |
The _____ JavaScript engine allows multiple JavaScript operations to execute at the same time.(a) V8(b) V12(c) V7(d) None of the mentionedThis question was addressed to me during an interview.This interesting question is from Map-Reduce and Sharded Collections in division Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Correct answer is (a) V8 |
|
39. |
db.collection.aggregate() returns a _______ and can return result sets of any size.(a) replica(b) cursor(c) document(d) $subtractI had been asked this question by my school principal while I was bunking the class.The question is from Pipeline and Sharded Collections topic in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Correct ANSWER is (B) CURSOR |
|
40. |
_________ returns a value without parsing.(a) $string(b) $literal(c) $characters(d) None of the mentionedThis question was posed to me by my school principal while I was bunking the class.I need to ask this question from Pipeline and Sharded Collections topic in division Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» The correct choice is (B) $literal |
|
41. |
_______ returns the number of elements in the array.(a) $number(b) $size(c) $div(d) None of the mentionedThe question was posed to me during an interview.My question is based upon Pipeline and Sharded Collections topic in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» CORRECT option is (b) $size To explain I WOULD say: The argument for $size can be any expression as LONG as it RESOLVES to an ARRAY. |
|
42. |
_______ is used for access text search metadata.(a) $text(b) $metades(c) $meta(d) All of the mentionedThis question was addressed to me in final exam.The above asked question is from Pipeline and Sharded Collections in chapter Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» The correct choice is (C) $META |
|
43. |
Which of the following accepts named parameters?(a) $reduce(b) $letnum(c) $let(d) None of the mentionedI have been asked this question during an online exam.Question is taken from Pipeline and Sharded Collections topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» The correct ANSWER is (d) None of the mentioned |
|
44. |
Point out the wrong statement.(a) { $meta: “textScore” } expression is only meaningful in a pipeline that includes a $match stage with a $text query(b) The { $meta: “textScore” } expression is the only expression that the $sort stage accepts(c) $toLower only has a well-defined behavior for strings of ASCII characters(d) None of the mentionedI had been asked this question during an interview.Question is from Pipeline and Sharded Collections topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Right option is (d) NONE of the mentioned |
|
45. |
Which of the following performs case-insensitive string comparison?(a) $strcasecmpequals(b) $strcasecmp(c) $strcmp(d) None of the mentionedI have been asked this question in an internship interview.My query is from Pipeline and Sharded Collections in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» The CORRECT ANSWER is (a) $strcasecmpequals |
|
46. |
Which of the following accepts a single argument expression?(a) $toLow(b) $toUpper(c) $toEqual(d) None of the mentionedI had been asked this question in exam.My question is from Pipeline and Sharded Collections topic in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» CORRECT CHOICE is (B) $toUpper To explain: $toUpper converts a STRING to uppercase. |
|
47. |
Point out the correct statement.(a) $substr ends at a specified index position up to a specified length(b) $toLower converts a string to lowercase(c) $gtle returns true if the first value is greater than or equal to the second(d) All of the mentionedThis question was addressed to me in semester exam.This intriguing question originated from Pipeline and Sharded Collections topic in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Correct ANSWER is (B) $toLower CONVERTS a STRING to lowercase |
|
48. |
Which of the following returns a substring of a string?(a) $subs(b) $substring(c) $substr(d) None of the mentionedThis question was addressed to me at a job interview.Origin of the question is Pipeline and Sharded Collections in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» Right option is (c) $substr |
|
49. |
String expressions, with the exception of ________ only have a well-defined behavior for strings of ASCII characters.(a) $setcon(b) $concatenation(c) $concat(d) None of the mentionedThe question was asked during a job interview.I need to ask this question from Pipeline Limits in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» CORRECT option is (c) $concat The best I can EXPLAIN: $concat BEHAVIOR is well-defined REGARDLESS of the CHARACTERS used. |
|
50. |
________ subtracts two dates to return the difference in milliseconds.(a) $rem(b) $mod(c) $div(d) $subtractI had been asked this question in homework.Enquiry is from Pipeline Limits in section Aggregation Concepts and Aggregation Mechanics of MongoDB |
Answer» CORRECT OPTION is (a) $rem Explanation: The $subtract EXPRESSION has the following syntax: { $subtract: [ |
|