MongoDB MCQ Questions - Datatypes
This section focuses on "Datatypes" in MongoDB. These Multiple Choice Questions (MCQs) should be practiced to improve the MongoDB skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.
1. _______ in MongoDB must be UTF-8 valid.
A. Integer
B. String
C. Boolean
D. Double
View Answer
Ans : B
Explanation: String : This is the most commonly used datatype to store the data. String in MongoDB must be UTF-8 valid.
2. Integer ________ bit depending upon your server.
A. 16
B. 32
C. 64
D. Both B and C
View Answer
Ans : D
Explanation: Integer can be 32 bit or 64 bit depending upon your server.
3. Which type is used to store a true/ false value.
A. Enum
B. Object
C. Boolean
D. Symbol
View Answer
Ans : C
Explanation: Boolean : This type is used to store a boolean (true/ false) value.
4. Double type is used to store floating point values.
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: Yes, Double type is used to store floating point values.
5. Min/ Max keys type is used to compare a value against the _____ BSON elements.
A. lowest
B. highest
C. lowest and highest
D. All of the above
View Answer
Ans : C
Explanation: Min/ Max keys type is used to compare a value against the lowest and highest BSON elements.
6. Arrays type is used to store ________ into one key.
A. arrays
B. list
C. multiple values
D. All of the above
View Answer
Ans : D
Explanation: Arrays type is used to store arrays or list or multiple values into one key.
7. Which datatype is used to store binary data?
A. Code
B. Regular expression
C. Binary data
D. Object ID
View Answer
Ans : C
Explanation: Binary data : This datatype is used to store binary data.
8. Regular expression datatype is used to store regular expression.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, Regular expression datatype is used to store regular expression..
9. Null type is used to store a Null value.
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: Yes, Null type is used to store a Null value.
10. Which datatype is used to store the current date or time in UNIX time format?
A. Timestamp
B. Date
C. Symbol
D. Null
View Answer
Ans : B
Explanation: Date : This datatype is used to store the current date or time in UNIX time format. You can specify your own date time by creating object of Date and passing day, month, year into it.
Discussion