0% found this document useful (0 votes)
19 views26 pages

Bits - VAC

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views26 pages

Bits - VAC

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

1. What type of database is MongoDB?

- A) Relational Database

- B) Key-Value Database

- C) Document-Oriented Database

- D) Graph Database

2. What is the default data storage format for documents in MongoDB?

- A) JSON

- B) BSON

- C) XML

- D) CSV

3. In MongoDB, a collection is similar to which concept in relational databases?

- A) Table

- B) Row

- C) Column

- D) Index

4. What command is used to create a new database in MongoDB?

- A) db.createDatabase("database_name")

- B) use database_name

- C) create database database_name

- D) database.new(database_name)

5. Which of the following MongoDB methods is used to insert a single document into a collection?

- A) db.collection.insertOne()

- B) db.collection.insert()

- C) db.collection.addDocument()

- D) db.collection.addOne()
6. Which of the following is NOT a supported data type in MongoDB?

- A) Array

- B) Integer

- C) Date

- D) Double-Array

7. What MongoDB command retrieves all documents in a collection?

- A) db.collection.retrieve()

- B) db.collection.find()

- C) db.collection.query()

- D) db.collection.getAll()

8. Which command will delete a collection in MongoDB?

- A) db.drop(collection_name)

- B) db.collection.delete()

- C) db.collection.drop()

- D) db.removeCollection(collection_name)

9. What is the purpose of an index in MongoDB?

- A) To reduce storage size

- B) To improve search performance

- C) To encrypt data

- D) To create backups

10. In MongoDB, the unique identifier for a document is known as what?

- A) Primary Key

- B) Document Key

- C) _id Field
- D) Object Identifier

11. In the document model, how is data typically stored?

- A) In rows and columns

- B) As structured documents

- C) In key-value pairs only

- D) As JSON arrays only

12. Which data format is commonly used by MongoDB to represent documents internally?

- A) XML

- B) BSON

- C) CSV

- D) YAML

13. In MongoDB, each document within a collection must contain which unique field?

- A) _document_id

- B) uniqueKey

- C) _id

- D) docID

14. What is a key benefit of using the document model for data storage?

- A) Supports ACID transactions only

- B) Reduces storage space by storing data as plain text

- C) Offers a flexible schema that allows fields to vary across documents

- D) Enforces a strict schema for all documents

15. In the document model, relationships between data are often represented by:

- A) Embedding documents within each other

- B) Using foreign keys


- C) SQL joins

- D) Indexing tables

16. Which of the following statements is true about MongoDB’s document model?

- A) Each document in a collection must have the same structure.

- B) Documents in a collection can have different fields.

- C) The document model enforces relational constraints.

- D) Document fields cannot store arrays.

17. What type of data can be stored in a MongoDB document?

- A) Only strings and numbers

- B) Only arrays and integers

- C) Any type, including arrays, objects, and dates

- D) Only primitive data types

18. What is one disadvantage of using embedded documents for nested data in MongoDB?

- A) Increases performance

- B) Cannot store arrays in embedded documents

- C) Increases data redundancy

- D) Limits querying capabilities

19. Which MongoDB feature allows documents to be retrieved based on their structure?

- A) Schemas

- B) Joins

- C) Indexes

- D) Aggregations

20. In MongoDB, which structure would best represent a “one-to-many” relationship within the
document model?
- A) Embedding multiple documents within a single document

- B) Storing data in separate databases

- C) Using SQL joins

- D) Storing the relationship in an external file

21. What type of architecture does MongoDB use to ensure high availability and scalability?

- A) Master-Slave

- B) Client-Server

- C) Distributed and Sharded

- D) Centralized

22. In MongoDB, what is a replica set?

- A) A single node that holds data

- B) A group of servers that maintains the same data for redundancy

- C) A set of indexes to improve query performance

- D) A temporary data store for backups

23. Which of the following is a primary component of MongoDB’s architecture that helps distribute data
across multiple servers?

- A) Indexing

- B) Sharding

- C) Aggregation

- D) Caching

24. What is the role of a primary node in a MongoDB replica set?

- A) It acts as a backup server.

- B) It handles all write operations and coordinates with secondary nodes.

- C) It only processes read requests.

- D) It performs data validation for other nodes.


25. Which MongoDB component handles read requests if the primary node is unavailable?

- A) Arbiter

- B) Config Server

- C) Secondary Node

- D) Router

26. What is the role of an arbiter node in a MongoDB replica set?

- A) To store data in case of primary node failure

- B) To vote in elections without storing a copy of the data

- C) To handle all read and write operations

- D) To create indexes for query optimization

27. Which MongoDB component is responsible for routing requests to the appropriate shard?

- A) Config Server

- B) Query Router (mongos)

- C) Primary Node

- D) Aggregator

28. How does MongoDB ensure data consistency across a replica set?

- A) Using synchronous replication

- B) Through primary node elections

- C) By allowing only one node to process requests

- D) By performing read and write operations on all nodes simultaneously

29. In a sharded cluster, which component stores the metadata of the shards?

- A) Primary Node

- B) Query Router (mongos)

- C) Config Server
- D) Arbiter

30. Which MongoDB process is used to manage sharded data across multiple shards?

- A) mongos

- B) mongo

- C) mongod

- D) mongoexport

Continuing with more questions and options:

31. Which of the following is a key feature of MongoDB that supports a flexible data structure?

- A) Fixed schema enforcement

- B) Document-oriented storage

- C) Table-based data organization

- D) Multi-dimensional arrays only

32. What is the purpose of indexing in MongoDB?

- A) To store data redundantly

- B) To improve query performance

- C) To backup the database

- D) To ensure data consistency

33. Which MongoDB feature allows it to scale horizontally across multiple servers?

- A) Replication

- B) Indexing

- C) Sharding

- D) Aggregation

34. What type of data model does MongoDB use?

- A) Relational model
- B) Hierarchical model

- C) Key-Value model

- D) Document model

35. In MongoDB, which feature ensures high availability by maintaining multiple copies of data?

- A) Sharding

- B) Aggregation

- C) Replication

- D) Indexing

36. Which feature in MongoDB allows developers to perform complex data transformations and
computations on data within a single query?

- A) Indexing

- B) Aggregation framework

- C) Sharding

- D) Clustering

37. MongoDB's capability to store arrays and sub-documents within documents is referred to as:

- A) Structured data storage

- B) Hierarchical storage

- C) Embedded documents

- D) Normalization

38. Which MongoDB feature allows users to conduct text searches within documents?

- A) GridFS

- B) Text indexing

- C) Aggregation

- D) Sharding
39. What feature of MongoDB enables developers to perform CRUD operations on large files and store
files larger than the BSON document size limit?

- A) Replication

- B) GridFS

- C) Sharding

- D) Aggregation

40. How does MongoDB ensure consistency in multi-document ACID transactions?

- A) By enforcing strict schema

- B) Through replica sets

- C) By supporting ACID transactions at the document level

- D) By limiting operations to single documents only

41. What command is used to create a new database in MongoDB?

- A) db.createDatabase("database_name")

- B) use database_name

- C) create database database_name

- D) db.newDatabase("database_name")

42. In MongoDB, how is a new collection created?

- A) Automatically when a document is inserted

- B) Using the create collection command

- C) By initializing with db.collectionName.create()

- D) By manually defining the schema

43. Which command explicitly creates a collection with specific options in MongoDB?

- A) db.createCollection("collection_name", options)

- B) db.collection.create("collection_name", options)

- C) create collection collection_name options


- D) db.newCollection("collection_name", options)

44. What command is used to display all collections in a MongoDB database?

- A) db.showCollections()

- B) db.listCollections()

- C) show collections

- D) list all collections

45. What happens if you attempt to use a database in MongoDB that doesn’t yet exist?

- A) MongoDB throws an error.

- B) The database is created only if a collection or document is added.

- C) MongoDB creates the database immediately.

- D) The database remains inactive until restarted.

46. Which of the following options can be specified when creating a collection with
db.createCollection()?

- A) Maximum storage size and number of documents

- B) Encryption type

- C) Indexing options only

- D) File format

47. How do you delete a database in MongoDB?

- A) db.deleteDatabase()

- B) delete database dbname

- C) db.dropDatabase()

- D) remove database dbname

48. To delete a collection in MongoDB, which command should be used?

- A) drop collection_name
- B) db.dropCollection("collection_name")

- C) db.collection_name.drop()

- D) delete collection_name

49. Which command in MongoDB switches the context to an existing or new database?

- A) use

- B) switch

- C) select

- D) load

50. How can you check the name of the currently selected database in MongoDB?

- A) db.getCurrentDatabase()

- B) db

- C) show db

- D) db.database()

51. Which command is used to insert a single document into a MongoDB collection?

- A) db.collection.addOne()

- B) db.collection.insertOne()

- C) db.collection.save()

- D) db.collection.insertMany()

52. Which method is used to insert multiple documents at once in MongoDB?

- A) db.collection.insertMany()

- B) db.collection.insertMultiple()

- C) db.collection.saveAll()

- D) db.collection.addMany()

53. What MongoDB method retrieves all documents in a collection?


- A) db.collection.findAll()

- B) db.collection.show()

- C) db.collection.find()

- D) db.collection.getAll()

54. To read a single document matching a specific criterion from a collection, which method would you
use?

- A) db.collection.findOne()

- B) db.collection.findSingle()

- C) db.collection.searchOne()

- D) db.collection.getOne()

55. Which operator is used to update specific fields in a document without replacing the entire
document?

- A) $replace

- B) $modify

- C) $set

- D) $update

56. What method is used to update one document that matches a specific query in MongoDB?

- A) db.collection.updateOne()

- B) db.collection.updateSingle()

- C) db.collection.modifyOne()

- D) db.collection.replaceOne()

57. If you want to update multiple documents matching a specific condition, which method would you
use?

- A) db.collection.modifyMany()

- B) db.collection.updateAll()

- C) db.collection.updateMany()
- D) db.collection.update()

58. Which MongoDB method is used to delete a single document matching a query?

- A) db.collection.deleteOne()

- B) db.collection.removeOne()

- C) db.collection.dropOne()

- D) db.collection.eraseOne()

59. To delete all documents in a collection that match a specified condition, which method is used?

- A) db.collection.drop()

- B) db.collection.deleteMany()

- C) db.collection.remove()

- D) db.collection.eraseAll()

60. What will happen if you use the db.collection.updateOne() method without any update operator like
$set?

- A) MongoDB will throw an error.

- B) MongoDB will ignore the update operation.

- C) MongoDB will replace the entire document.

- D) MongoDB will update only the first field found.

61. Which method is used in MongoDB to retrieve documents from a collection that match specific
criteria?

- A) db.collection.get()

- B) db.collection.search()

- C) db.collection.find()

- D) db.collection.retrieve()

62. What operator is used in MongoDB to match documents where a field is equal to a specific value?

- A) $eq
- B) $equals

- C) $match

- D) $find

63. How would you write a query to find documents in a collection where the field "age" is greater than
18?

- A) { age: { $gt: 18 } }

- B) { age: { $gte: 18 } }

- C) { age: { $lt: 18 } }

- D) { age: { $gt 18 } }

64. Which operator is used in MongoDB to check if a field’s value exists in an array of specified values?

- A) $in

- B) $exists

- C) $match

- D) $array

65. To retrieve only specific fields from a document, which part of the find() method is used?

- A) Sorting

- B) Projection

- C) Filtering

- D) Indexing

66. What does the MongoDB query { status: { $ne: "complete" } } do?

- A) Finds documents where "status" is exactly "complete"

- B) Finds documents where "status" is not equal to "complete"

- C) Deletes documents where "status" is "complete"

- D) Updates documents to set "status" to "incomplete"


67. Which operator would you use to combine multiple conditions in a MongoDB query where all
conditions must be met?

- A) $in

- B) $or

- C) $and

- D) $match

68. What does the query { "score": { $gte: 70, $lte: 90 } } find?

- A) Documents where "score" is less than 70

- B) Documents where "score" is greater than 90

- C) Documents where "score" is between 70 and 90, inclusive

- D) Documents where "score" equals 70 or 90

69. Which query would find all documents where the "tags" field contains both "science" and
"technology"?

- A) { tags: { $in: ["science", "technology"] } }

- B) { tags: { $all: ["science", "technology"] } }

- C) { tags: { $contains: ["science", "technology"] } }

- D) { tags: { $eq: ["science", "technology"] } }

70. What is the purpose of the $regex operator in MongoDB?

- A) To create indexes for efficient querying

- B) To allow for pattern matching in strings

- C) To enforce a specific schema

- D) To add new fields to a document

71. What is Node.js primarily used for?

- A) Front-end development

- B) Game development
- C) Back-end server-side development

- D) Database management

72. Which language is Node.js built on?

- A) Python

- B) JavaScript

- C) Java

- D) Ruby

73. What engine does Node.js use to execute JavaScript code?

- A) Chakra

- B) SpiderMonkey

- C) V8

- D) Rhino

74. Node.js is known for which type of architecture?

- A) Synchronous and blocking

- B) Asynchronous and non-blocking

- C) Multi-threaded

- D) Procedural

75. Which module in Node.js allows for managing HTTP requests and responses?

- A) fs

- B) events

- C) http

- D) path

76. What is the purpose of npm (Node Package Manager) in Node.js?

- A) To manage system processes


- B) To compile JavaScript code

- C) To manage packages and dependencies

- D) To handle database connections

77. Which of the following is a key feature of Node.js that makes it suitable for data-intensive real-time
applications?

- A) Multi-threading

- B) Event-driven architecture

- C) Synchronous code execution

- D) Strict typing

78. How does Node.js handle multiple connections at the same time?

- A) By using multiple threads

- B) By blocking I/O operations

- C) Through single-threaded, non-blocking I/O

- D) By spawning new processes for each connection

79. Which of the following commands is used to initialize a new Node.js project and create a
package.json file?

- A) node init

- B) npm start

- C) npm init

- D) node start

80. Which of the following features allows Node.js to handle high concurrency without high memory
consumption?

- A) Multi-threading

- B) Non-blocking I/O

- C) Synchronous processing

- D) Strongly typed variables


81. Which of the following is the correct way to check if Node.js is installed on your system?

- A) node --version

- B) npm --install

- C) node install

- D) npm check

82. What is npm primarily used for in Node.js?

- A) Managing Node.js versions

- B) Managing packages and dependencies

- C) Compiling JavaScript code

- D) Creating databases

83. Which command would you use to install a package globally in Node.js?

- A) npm install package

- B) npm install -g package

- C) npm global install package

- D) npm add package

84. What file is created to manage project dependencies when you initialize a Node.js project with npm
init?

- A) node_modules.json

- B) npm.json

- C) package.json

- D) project.json

85. Which command is used to install all dependencies listed in a package.json file?

- A) npm install

- B) npm start
- C) npm init

- D) node install

86. To remove an installed package from a project, which npm command would you use?

- A) npm delete package

- B) npm uninstall package

- C) npm remove --all

- D) npm clean package

87. What command is used to create a package.json file with default settings in Node.js?

- A) npm init

- B) npm init -y

- C) npm create package

- D) npm new project

88. Where are globally installed npm packages stored by default?

- A) Inside the node_modules directory of each project

- B) In the global_modules folder

- C) In a global node_modules directory specific to npm

- D) In the npm_packages folder in each project

89. What does the caret (^) symbol mean in the version number of a dependency in package.json?

- A) Install the exact version specified

- B) Update to the latest version, regardless of compatibility

- C) Update to the latest minor or patch version, but not a major version

- D) Install only the beta version

90. Which npm command would you use to update all project dependencies to their latest versions?

- A) npm update
- B) npm upgrade --all

- C) npm install --latest

- D) npm update all

91. What kind of process model does Node.js use?

- A) Multi-threaded

- B) Single-threaded

- C) Dual-threaded

- D) Threadless

92. In Node.js, how is concurrency achieved despite using a single-threaded model?

- A) Using asynchronous, non-blocking I/O operations

- B) By using multiple threads internally

- C) Through synchronous processing

- D) Using only one connection at a time

93. Which of the following allows Node.js to handle I/O operations without blocking the main thread?

- A) Event loop

- B) Synchronous calls

- C) Call stack

- D) Data stream

94. What is the purpose of the event loop in Node.js?

- A) To execute synchronous code

- B) To handle blocking I/O only

- C) To manage and process asynchronous events

- D) To allocate memory for objects

95. Which module provides the functionality to work with child processes in Node.js?

- A) fs
- B) child_process

- C) events

- D) process

96. What method in the child_process module allows the creation of a new Node.js process?

- A) spawn()

- B) fork()

- C) exec()

- D) All of the above

97. Which Node.js function is used to end the process and exit?

- A) exit()

- B) process.exit()

- C) quit()

- D) endProcess()

98. What value does process.exit(0) represent?

- A) Successful termination

- B) Unsuccessful termination

- C) Unknown status

- D) Termination with error code

99. How does Node.js handle CPU-bound tasks effectively, given its single-threaded nature?

- A) By utilizing the cluster module to spawn multiple processes

- B) By running CPU-bound tasks on the main thread

- C) Through synchronous I/O calls

- D) By blocking the event loop

100. What does process.on('exit', callback) do in Node.js?


- A) Restarts the process upon exit

- B) Runs a callback function before the process exits

- C) Halts the process immediately

- D) Sets the exit code for the process

101. What is a module in Node.js?

- A) A built-in database

- B) A reusable piece of code, either built-in or custom

- C) A collection of HTML files

- D) A global variable available across all scripts

102. Which method is used to include a module in Node.js?

- A) import()

- B) include()

- C) require()

- D) use()

103. Which module in Node.js is used for handling file operations?

- A) path

- B) fs

- C) os

- D) http

104. What does the exports object do in a Node.js module?

- A) Imports external modules

- B) Exports functions or variables from a module to be used in other files

- C) Deletes a module from memory

- D) Encodes data for transfer


105. Which of the following is a core module in Node.js?

- A) express

- B) mongodb

- C) http

- D) lodash

106. How do you install a third-party module in Node.js?

- A) node install module_name

- B) npm install module_name

- C) install module_name

- D) module install module_name

107. What command is used to export a function in a module so that it can be used in other files?

- A) module.include = functionName

- B) module.import = functionName

- C) module.exports = functionName

- D) export functionName

108. What is the purpose of the path module in Node.js?

- A) To create server connections

- B) To work with file and directory paths

- C) To interact with databases

- D) To manage environment variables

109. Which of the following is true about the require function in Node.js?

- A) It loads modules synchronously.

- B) It is only used for built-in modules.

- C) It cannot load local files.

- D) It is a method of the exports object.


110. How can you load a local module in Node.js?

- A) require('./module_name')

- B) require('module_name')

- C) import module_name

- D) include module_name

111. What is asynchronous programming?

- A) A method of executing code line-by-line in order

- B) A technique that allows code to be executed without blocking other operations

- C) A way to make code run slower

- D) A type of debugging tool

112. Which of the following is a common benefit of asynchronous programming?

- A) It makes code harder to read

- B) It improves application responsiveness

- C) It increases memory usage

- D) It stops functions from running in parallel

113. In JavaScript, which feature enables asynchronous behavior by executing code after a specified
delay?

- A) setInterval

- B) setTimeout

- C) clearTimeout

- D) executeLater

114. Which of the following is NOT a method for handling asynchronous operations in JavaScript?

- A) Callbacks

- B) Promises
- C) Threads

- D) Async/await

115. What is a callback function in asynchronous programming?

- A) A function that is immediately executed

- B) A function passed as an argument to another function, to be executed later

- C) A function that blocks other code from running

- D) A synchronous function that delays execution

116. What is the purpose of a Promise in JavaScript?

- A) To handle synchronous operations

- B) To represent the eventual completion (or failure) of an asynchronous operation

- C) To delay code execution indefinitely

- D) To create multiple threads

117. What does the .then() method do in a Promise?

- A) It cancels the Promise

- B) It executes a callback function when the Promise is resolved

- C) It runs the Promise synchronously

- D) It re-throws any error in the Promise

118. What keyword is used to pause the execution of a function until a Promise is resolved in JavaScript?

- A) await

- B) defer

- C) stop

- D) async

119. When using async and await, what type of function must the await keyword be used within?

- A) A standard function
- B) An async function

- C) An IIFE (Immediately Invoked Function Expression)

- D) A constructor function

120. Which statement about asynchronous programming is correct?

- A) Asynchronous code blocks further code execution.

- B) Asynchronous programming always makes code run faster.

- C) Asynchronous programming allows multiple tasks to be initiated without waiting for other tasks to
finish.

- D) Asynchronous programming does not allow callback functions.

You might also like