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.

$geoWithin replaces _______ in MongoDB 2.4.(a) $withing(b) $gwithin(c) $within(d) All of the mentionedThe question was asked in class test.I would like to ask this question from Index Types in chapter Index/Indexing Concepts of MongoDB

Answer»

Right choice is (C) $within

Easy EXPLANATION: $within is DEPRECATED since version 2.4.

52.

If the specified polygon is _______ than a single hemisphere, the behavior of $geoWithin with the MongoDB CRS is the same as with the default CRS.(a) smaller(b) bigger(c) equal(d) all of the mentionedThe question was posed to me during an interview.Question is taken from Index Types topic in division Index/Indexing Concepts of MongoDB

Answer»

Correct CHOICE is (a) smaller

Best EXPLANATION: For all other GeoJSON POLYGONS with areas greater than a hemisphere, $geoWithin queries for the complementary geometry.

53.

To query with a single-ringed GeoJSON polygon whose area is greater than a single hemisphere, the $geometry expression must specify the custom MongoDB ________(a) CRS(b) CDS(c) CLS(d) None of the mentionedThis question was addressed to me in unit test.The above asked question is from Index Types in division Index/Indexing Concepts of MongoDB

Answer»

Correct OPTION is (a) CRS

For explanation: CRS stands for COORDINATE reference SYSTEM.

54.

The $geoWithin operator uses the _______ operator to specify the GeoJSON object.(a) $sphere(b) $geoin(c) $geometry(d) All of the mentionedThis question was posed to me in an online quiz.This interesting question is from Index Types topic in chapter Index/Indexing Concepts of MongoDB

Answer»

Correct CHOICE is (c) $GEOMETRY

Easy explanation: For $geoWithin, if you specify a single-ringed polygon that has an AREA greater than a single hemisphere, include the custom MongoDB coordinate reference SYSTEM in the $geometry EXPRESSION.

55.

Point out the correct statement.(a) For $geoSphere queries that specify GeoJSON geometries with areas greater than a single hemisphere, the use of the default CRS results in queries for the complementary geometries(b) When determining inclusion, MongoDB considers the border of a shape to be part of the shape, subject to the precision of floating point numbers(c) The custom MongoDB CRS uses a anti-clockwise winding order(d) None of the mentionedThis question was posed to me during an internship interview.The question is from Index Types in section Index/Indexing Concepts of MongoDB

Answer»

The correct answer is (b) When determining inclusion, MongoDB considers the border of a shape to be PART of the shape, subject to the precision of floating point numbers

Easy EXPLANATION: The SPECIFIED shape can be either a GeoJSON Polygon, a GeoJSON MultiPolygon, or a shape defined by LEGACY coordinate pairs.

56.

Inclusion queries use the _________ operator in MongoDB.(a) $geokey(b) $geoin(c) $geoWithin(d) All of the mentionedI have been asked this question in semester exam.I want to ask this question from Index Types in chapter Index/Indexing Concepts of MongoDB

Answer»

Right ANSWER is (c) $geoWithin

Explanation: $geoWithin SELECTS documents with geospatial DATA that exists ENTIRELY within a specified shape.

57.

The coordinate reference system for GeoJSON uses the _____ datum.(a) WGS88(b) WGS84(c) JGS88(d) None of the mentionedThis question was addressed to me in homework.The question is from Index Types topic in chapter Index/Indexing Concepts of MongoDB

Answer»

Right option is (b) WGS84

For explanation I would SAY: Before storing your LOCATION data and WRITING queries, you must decide the TYPE of surface to USE to perform calculations.

58.

MongoDB supports spherical surface calculations on legacy coordinate pairs using a _______ index.(a) 2dsphere(b) 2d(c) geoHaystack(d) all of the mentionedThe question was asked in semester exam.I need to ask this question from Index Types in division Index/Indexing Concepts of MongoDB

Answer»

Correct answer is (a) 2dsphere

To elaborate: If you choose FLAT SURFACE calculations via a 2d index, you can STORE DATA only as LEGACY coordinate pairs.

59.

Point out the wrong statement.(a) MongoDB can query for locations contained entirely within a specified polygon(b) MongoDB require an index for inclusion queries; however, such indexes will improve query performance(c) Indexes on embedded fields allow you to use a “dot notation,” to introspect into embedded documents(d) None of the mentionedThe question was posed to me during an online exam.Question is taken from Index Types topic in division Index/Indexing Concepts of MongoDB

Answer»

Right answer is (b) MONGODB REQUIRE an index for inclusion queries; however, such INDEXES will improve QUERY performance

To explain: Both 2d and 2dsphere indexes can SUPPORT inclusion queries.

60.

Which of the following GeoJSON object is not supported in MongoDB?(a) Point(b) LineString(c) MultiPoint(d) None of the mentionedThis question was addressed to me by my college director while I was bunking the class.I'd like to ask this question from Index Types in division Index/Indexing Concepts of MongoDB

Answer»

Correct OPTION is (d) NONE of the mentioned

Easiest explanation: In version 2.2 and NEWER, capped collections do have an _id field, except those in the LOCAL database.

61.

Which of the following is used to calculate distances on a Euclidean plane?(a) 2dsph(b) 2d(c) geoHaystack(d) all of the mentionedI had been asked this question during a job interview.My enquiry is from Index Types in portion Index/Indexing Concepts of MongoDB

Answer»

Correct option is (B) 2d

To ELABORATE: STORE your location data as LEGACY coordinate PAIRS

62.

______ indexes can be constructed over arrays that hold both scalar values (e.g. strings, numbers) and nested documents.(a) Hashed(b) Unique(c) Multikey(d) CompoundThe question was posed to me in unit test.My query is from Index Types in division Index/Indexing Concepts of MongoDB

Answer»

The CORRECT choice is (c) Multikey

Easiest explanation: STORE your LOCATION data as GeoJSON OBJECTS with this coordinate-axis order: LONGITUDE, latitude.

63.

To calculate geometry over an Earth-like sphere, store your location data on a spherical surface and use _____ index.(a) 2dsphere(b) 2d(c) geoHaystack(d) all of the mentionedThe question was posed to me in an interview for internship.My question comes from Index Types in portion Index/Indexing Concepts of MongoDB

Answer»

The CORRECT answer is (a) 2dsphere

To explain: SECONDARY MEMBERS REPLICATE deletion operations from the primary.

64.

Which of the following indexes cannot be multikey?(a) Hashed(b) Unique(c) Multikey(d) compoundI had been asked this question in an interview.Question is taken from Index Types in section Index/Indexing Concepts of MongoDB

Answer»

Right ANSWER is (a) Hashed

To ELABORATE: You cannot specify a MULTIKEY index as the shard KEY index.

65.

Point out the wrong statement.(a) You may not create compound indexes that have hashed index fields(b) The order of the fields in a compound index is very important(c) You will receive a warning if you attempt to create a compound index that includes a hashed index(d) None of the mentionedThis question was posed to me by my college director while I was bunking the class.The above asked question is from Index Types topic in portion Index/Indexing Concepts of MongoDB

Answer»

The correct CHOICE is (C) You will receive a warning if you attempt to CREATE a compound INDEX that includes a hashed index

Easiest explanation: You will receive an error if you attempt to create a compound index that includes a hashed index.

66.

For a _____ multikey index, each indexed document can have at most one indexed field whose value is an array.(a) Hashed(b) Unique(c) Multikey(d) compoundI got this question by my college professor while I was bunking the class.I'm obligated to ask this question of Index Types in division Index/Indexing Concepts of MongoDB

Answer»

The correct CHOICE is (d) COMPOUND

To elaborate: As such, you cannot create a compound multikey index if more than one to-be-indexed FIELD of a DOCUMENT is an array.

67.

Before version _______ capped collections did not have an _id field.(a) 2.1(b) 2.4(c) 3.0(d) 2.2I got this question in exam.My doubt stems from Index Types topic in portion Index/Indexing Concepts of MongoDB

Answer»

The correct OPTION is (d) 2.2

The best I can explain: In VERSION 2.2 and NEWER, CAPPED collections do have an _id field, except those in the local database.

68.

Point out the wrong statement.(a) You can create indexes on fields within embedded documents(b) Indexes on embedded fields are similar to indexes on embedded documents(c) Indexes on embedded fields allow you to use a “dot notation,” to introspect into embedded documents(d) None of the mentionedThis question was addressed to me by my college professor while I was bunking the class.My enquiry is from Index Types topic in portion Index/Indexing Concepts of MongoDB

Answer»

The correct CHOICE is (c) Indexes on embedded fields allow you to use a “DOT notation,” to introspect into embedded DOCUMENTS

Explanation: Indexes on embedded fields differ from indexes on embedded documents, which INCLUDE the full content up to the maximum index size of the embedded DOCUMENT in the index.

69.

An index prefix is a subset of a ______ index, consisting of one or more keys starting from the beginning of the index.(a) Hashed(b) Unique(c) Sparse(d) CompoundI had been asked this question in class test.The query is from Index Types topic in section Index/Indexing Concepts of MongoDB

Answer»

Right ANSWER is (d) Compound

The best I can explain: With index INTERSECTION, MongoDB can use an intersection of EITHER the ENTIRE index or the index prefix.

70.

Which of the following method is to verify whether MongoDB used index intersection?(a) explain()(b) analyze()(c) intersect()(d) none of the mentionedThis question was addressed to me in quiz.My question is taken from Index Types in section Index/Indexing Concepts of MongoDB

Answer» RIGHT option is (a) explain()

Explanation: To determine if MongoDB used index INTERSECTION, RUN explain(); the results of explain() will include either an AND_SORTED stage or an AND_HASH stage.
71.

MongoDB can use the _________ of indexes to fulfill queries.(a) union(b) intersection(c) projection(d) none of the mentionedI got this question by my school principal while I was bunking the class.My question is taken from Index Types in chapter Index/Indexing Concepts of MongoDB

Answer»

Correct answer is (B) intersection

To explain I would say: 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.

72.

The ______ property of an index ensures that the index only contain entries for documents that have the indexed field.(a) Hashed(b) Unique(c) Sparse(d) None of the mentionedI had been asked this question during an online exam.My question is from Index Types in chapter Index/Indexing Concepts of MongoDB

Answer»

The correct answer is (c) Sparse

For EXPLANATION: The INDEX SKIPS documents that do not have the indexed FIELD.

73.

Point out the wrong statement.(a) TTL index is ideal for certain types of information like machine generated event data, logs, and session information that only need to persist in a database for a finite amount of time(b) You cannot combine the sparse index option with the unique index option(c) TTL indexes are special indexes that MongoDB can use to automatically remove documents from a collection after a certain amount of time(d) None of the mentionedThis question was posed to me by my college professor while I was bunking the class.My doubt stems from Index Types in division Index/Indexing Concepts of MongoDB

Answer»

Correct choice is (b) You cannot combine the SPARSE index OPTION with the unique index option

To elaborate: You can combine to reject documents that have duplicate values for a field but ignore documents that do not have the INDEXED KEY.

74.

The _________ property for an index causes MongoDB to reject duplicate values for the indexed field.(a) Hashed(b) Unique(c) Multikey(d) None of the mentionedI got this question during an interview.I need to ask this question from Index Types topic in section Index/Indexing Concepts of MongoDB

Answer»

The correct answer is (C) Multikey

The best I can EXPLAIN: Other than the unique constraint, unique indexes are FUNCTIONALLY interchangeable with other MONGODB indexes.

75.

________ index type, which indexes the hash of the value of a field.(a) Hashed(b) Unique(c) Multikey(d) None of the mentionedThis question was posed to me in an online quiz.I'd like to ask this question from Index Types in division Index/Indexing Concepts of MongoDB

Answer»

Right choice is (a) HASHED

For explanation I would say: Hashed INDEXES SUPPORT EQUALITY matches and cannot support range-based queries.

76.

Point out the correct statement.(a) Whether the use of a compound index or the use of an index intersection is more efficient depends on the particular query and the system(b) Certain restrictions apply to indexes, such as the length of the index keys or the number of indexes per collection(c) For queries that specify compound query conditions, if one index can fulfill a part of a query condition, and another index can fulfill another part of the query condition, then MongoDB can use the intersection of the two indexes to fulfill the query(d) None of the mentionedI had been asked this question in an international level competition.The query is from Index Types topic in division Index/Indexing Concepts of MongoDB

Answer»

The correct answer is (d) None of the mentioned

The best I can explain: In general, each INDEX INTERSECTION INVOLVES two indexes; however, MongoDB can EMPLOY multiple/nested index intersections to resolve a query.

77.

MongoDB provides a ________ index type that supports searching for string content in a collection.(a) string(b) text(c) char(d) none of the mentionedThe question was asked in my homework.The doubt is from Indexes In MongoDB topic in portion Index/Indexing Concepts of MongoDB

Answer»

Right choice is (b) text

Best explanation: These text indexes do not STORE language-specific STOP WORDS (e.g. “the”, “a”, “or”) and STEM the words in a collection to only store ROOT words.

78.

To support ________ based sharding, MongoDB provides a hashed index type.(a) primary(b) root(c) hash(d) all of the mentionedThis question was posed to me in an internship interview.My question is from Index Types topic in section Index/Indexing Concepts of MongoDB

Answer»

The correct option is (C) hash

Best explanation: These INDEXES have a more random distribution of values along their range, but only support EQUALITY MATCHES and cannot support range-based queries.

79.

___________ indexes use spherical geometry to return results.(a) 3dsphere(b) 2dsphere(c) 1dsphere(d) none of the mentionedThis question was addressed to me in quiz.I need to ask this question from Indexes In MongoDB in section Index/Indexing Concepts of MongoDB

Answer»

Correct CHOICE is (b) 2dsphere

Easiest explanation: To SUPPORT EFFICIENT queries of geospatial coordinate data, MONGODB provides two SPECIAL indexes.

80.

MongoDB also supports user-defined indexes on multiple fields called ____________(a) compound(b) composite(c) candidate(d) none of the mentionedI got this question during an online exam.My doubt stems from Indexes In MongoDB in portion Index/Indexing Concepts of MongoDB

Answer»

The correct OPTION is (a) compound

To elaborate: The ORDER of FIELDS listed in a compound index has SIGNIFICANCE.

81.

MongoDB supports the creation of user-defined ascending/descending indexes on a ______ field of a document.(a) Single(b) Non Unique(c) Compound(d) None of the mentionedThis question was posed to me during an interview.This intriguing question comes from Indexes In MongoDB topic in section Index/Indexing Concepts of MongoDB

Answer»

Correct option is (a) Single

To explain I WOULD say: If APPLICATIONS do not specify a value for _id the DRIVER or the mongod will CREATE an _id field with an ObjectId value.

82.

MongoDB uses ______ indexes to index the content stored in arrays.(a) singlekey(b) multikey(c) compkey(d) none of the mentionedI got this question by my college professor while I was bunking the class.Question is from Indexes In MongoDB in portion Index/Indexing Concepts of MongoDB

Answer»

The correct choice is (B) multikey

Explanation: If you index a field that HOLDS an array VALUE, MONGODB creates separate index ENTRIES for every element of the array.

83.

The ______ index is unique and prevents clients from inserting two documents with the same value for the _id field.(a) _id(b) $default(c) _def(d) None of the mentionedThis question was addressed to me during an interview for a job.Origin of the question is Indexes In MongoDB topic in portion Index/Indexing Concepts of MongoDB

Answer»

Correct answer is (a) _id

The best I can EXPLAIN: All MONGODB COLLECTIONS have an index on the _id field that exists by default.

84.

Point out the wrong statement.(a) MongoDB can return sorted results by using the ordering in the index(b) MongoDB defines indexes at the collection level and supports indexes on any field or sub-field of the documents in a MongoDB collection(c) Fundamentally, indexes in MongoDB is different to indexes in other database systems(d) None of the mentionedThis question was posed to me during an online exam.My question is taken from Indexes In MongoDB topic in division Index/Indexing Concepts of MongoDB

Answer»

Right option is (C) Fundamentally, indexes in MongoDB is different to indexes in other DATABASE systems

Explanation: Indexes are special data STRUCTURES that STORE a small portion of the collection’s data set in an EASY to traverse form.

85.

Point out the correct statement.(a) If an appropriate index exists for a query, MongoDB cannot use the index to limit the number of documents it must inspect(b) Indexes support the efficient execution of queries in MongoDB(c) The index stores the location of a specific field or set of fields, ordered by the value of the field(d) None of the mentionedThis question was addressed to me during an online interview.This intriguing question comes from Indexes In MongoDB topic in division Index/Indexing Concepts of MongoDB

Answer»

Right CHOICE is (B) Indexes support the efficient EXECUTION of queries in MongoDB

For explanation I would SAY: Without indexes, MongoDB MUST perform a collection scan.

86.

MongoDB indexes use a _______ data structure.(a) Hash(b) Map(c) B-tree(d) All of the mentionedThe question was posed to me by my school principal while I was bunking the class.This intriguing question comes from Indexes In MongoDB topic in division Index/Indexing Concepts of MongoDB

Answer» CORRECT OPTION is (B) Map

The explanation: MongoDB provides a number of different INDEX types to SUPPORT specific types of data and queries.