About MongoDB

Following are some of the multiple choice questions on the MongoDB with answers that will help the students in developing their knowledge.

MongoDB MCQ

1. What is MongoDB?

  • A file system.
  • A SQL database.
  • A NoSQL database.
  • An Access database.

2. How to create a database in mongodb?

  • use databaseName
  • new databaseName
  • create databaseName
  • None of the above

3. How many byte counter in BSON is starting with a random value ?

  • 4
  • 2
  • 3
  • None of the above

4. Which of the following is not a NoSQL database ?

  • SQL
  • MONGODB
  • CASSANDRA
  • NONE

5. Which of the following is a NoSQL Database Type

  • MONGODB
  • JSON
  • CASSANDRA
  • A & C

6. How many bits involve in _id?

  • 9
  • 10
  • 11
  • 12

7. Which of the following format is supported by MongoDB ?

  • XML
  • BSON
  • SQL
  • All

8. MongoDB is a _________ database that provides high performance, high availability, and easy scalability.

  • Graph
  • Key value
  • Document
  • All of the mentioned

9. Which field is always the first field in the document.?

  • _id
  • Ob_id
  • id
  • None of these

10. A collection in MongoDB is a group of ......................

  • Databases
  • Related documents
  • Schema
  • Rows

11. Which of the following is not part of _id?

  • machineID
  • processID
  • counter
  • documentID

12. What name is given to Record in MongoDB?

  • Collections
  • Fields
  • Documents
  • Database

13. Which of the following will display details of sName "Sumit"?

  • db.Students.find({sName: "Sumit"})
  • db.Students.find({sName: "Sumit"},{"sName":1, "GPA":1, "_id":0})
  • db.Students.find({sName: "Sumit"},{"sName":1, "GPA":0})
  • db.Students.find({sName: Sumit})

14. In which format MongoDB represents document structure?

  • BSON
  • .txt
  • .Docx
  • None of these

15. Command display the list of databases.

  • show db
  • show dbs
  • show data
  • display dbs

16. Which of the following is used to start server in MongoDB?

  • mongod
  • mongo
  • start-mongo
  • start-mongo.sh

17. _____________________sorting is not supported by MongoDB.

  • collection
  • collation
  • heap
  • none of the mentioned

18. MongoDB Queries can return specific fields of documents which also include user-defined __________ functions.

  • JavaScript
  • C
  • C++
  • ALL

19. A collection and a document in MongoDB is equivalent to............. concepts respectively.

  • Table and Column
  • Table and Row
  • Column and Row
  • Database and Table

20. Here are _________ types of read requests that a coordinator can send to a replica

  • 3
  • 2
  • 4
  • 1

21. _____ is the command to create database named "myDB" in MongoDB.

  • use myDB
  • database
  • Both A & B
  • none of the above

22. Command to display list of collections?

  • list-collections
  • show collections;
  • Both A & B
  • none of the above

23. What is the equivalent command in MongoDB for the following SQL query?SELECT * FROM posts WHERE author like "%john%"

  • db.posts.find( { author: /john/ } )
  • db.posts.find( { author: {$like: /john/} } )
  • db.posts.find( { $like: {author: /john/} } )
  • db.posts.find( { author: /^john^/ } )

24. Which of the following operation adds a new document to the users collection ?

  • add
  • insert
  • truncate
  • drop

25. NoSQL databases is used mainly for handling large volumes of ______________ data.

  • Unstructured
  • Structured
  • Semi-structured
  • All of the mentioned

26. Which of the following line skips the first 5 documents in the bios collection and returns all remaining documents?

  • db.bios.find().limit( 5 )
  • db.bios.find().skip( 1 )
  • db.bios.find().skip( 5)
  • db.bios.find().sort( 5 )

27. Which one of the following is equivalent in MongoDB select* from employee order by salary desc;?

  • db.employee.find.sort({“salary”:1}]
  • db.employee.sort ({“salary”:-1}]
  • db.employee.find.sort ({“salary”:-1}
  • db.employee.sort({“salary”:1}]

28. CRUD operation in mognodb are______

  • create read update drop
  • create read update delete
  • create read update local
  • none

29. Point out the wrong statement :

  • Non Relational databases require that schemas be defined before you can add data
  • NoSQL databases are built to allow the insertion of data without a predefined schema
  • NewSQL databases are built to allow the insertion of data without a predefined schema
  • all

30. What is the interactive shell for MongoDB called?

  • mongo
  • mongodb
  • dbmong
  • None

31. Which of the following method is used to query documents in collections?

  • move
  • shell
  • find
  • replace

32. MongoDB has been adopted as ________ software by a number of major websites and services

  • backend
  • frontend
  • both
  • none

33. Which of the following is not a part of Cassandra architecture?

  • column
  • memtable
  • sstable
  • cache

34. _____ is the command use to check current database mounted in mongodb.

  • db
  • dbs
  • Both A & B
  • none of the above

35. Mongo looks for a database server listening on port

  • 27017
  • 8080
  • 23
  • 443

36. Initial release of MongoDB was in the year?

  • 2000
  • 2005
  • 2009
  • 2011

37. Which command in Mongodb is equivalent to SQL select?

  • find ()
  • search()
  • document
  • none

38. Point out the correct statement :

  • Hadoop is an ideal environment for extracting and transforming small volumes of data
  • Hadoop stores data in HDFS and supports data compression/decompression
  • The Giraph framework is less useful than a MapReduce job to solve graph and machine learning
  • all

39. MongoDB supports query joins between collections.

  • True
  • false

40. What is the maximum size of a MongoDB document?

  • 2MB
  • 16MB
  • 12MB
  • No limit.Depends on RAM

41. Which is not a supported index type in MongoDB?

  • TTL Index
  • Unique
  • Neospatial
  • None of These

42. Does MongoDB supports query joins between collections ?

  • Yes
  • No

43. You have two text fields in your document and you’d like both to be quickly searchable. What should you do?

  • Create a text index on each field.
  • MongoDB is not able to do this.
  • Create a compound text index using both fields.
  • Create a text index on one field and a single field index on the other.

44. Which programming language is used to write MongoDB queries? (Alternative: In the MongoDB shell, what programming language is used to make queries?)

  • Python
  • JavaScript
  • SQL
  • TypeScript

45. How do you find documents with a matching item in an embedded array?

  • db.customers.findmatch ({“jobs”:”secretary”})
  • db.customers.find ({“jobs:secretary”})
  • db.customers.find ({“jobs”:[“secretary”]})
  • db.customers.find ({“jobs”:”secretary”})

46. Given an ObjectId in _id, how do you get the time it was created?

  • getDateTime(_id)
  • _id.createDate()
  • _id.getTimestamp()
  • _id.getDateTime()

47. Which command returns all of the documents in the customers collection?

  • db.customers.all();
  • db.find().customers();
  • db.customers.find();
  • db.customers.show();

48. One of the documents in your collection has an _id based upon an older database design and you want to change it. You write an update command to find the document and replace the _id but the _id isn’t changed. How should you fix the issue?

  • Set the replace option to true.
  • Use the replaceOne() command instead.
  • Use the updateOne() command instead.
  • You can’t. Once set, the _id field cannot be changed.

49. Suppose your aggregation pipeline terminated with an exception referring to exceeded memory limit. What is the best way to resolve the issue?

  • Set useMemory to twice amount indicated in exception.
  • Switch a 64 bit instance of MongoDB.
  • Increase the memory of the MongoDB server.
  • Set allowDiskUse to true.

50. You have just secured your previously unsecured MongoDB server, but the server is still not requiring authentication. What is the best option?

  • Restart the mongod process.
  • Issue the secure() command.
  • Issue the mongoimport command.
  • Issue the authenticate() command.

Enjoyed the Quiz. Share this with friends

Comments

Add Your Review

Your email address will not be published.

Subscribe to Newsletter!

Subscribe to get latest updates and information.