presudo 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__init__.py +0 -0
- package/index.js +29 -0
- package/main.py +2 -0
- package/package.json +18 -0
- package/pods/DSA/all.txt +914 -0
- package/pods/DSA/lasttime.txt +66 -0
- package/pods/DSA/tg.txt +99 -0
- package/pods/backend/inventory_management_system.txt +71 -0
- package/pods/backend/simple_inventory_management_system_for_bookstore_using_tuples.txt +59 -0
- package/pods/db/mongo.txt +842 -0
- package/pods/db/mongo_MCQ.txt +216 -0
- package/pods/db/sql.txt +728 -0
- package/pods/react/book_list.txt +51 -0
- package/pods/sudo/Product Management System-ts.txt +274 -0
- package/pods/sudo/backend/managing a delivery service.txt +130 -0
- package/pods/sudo/backend/online shopping cart system.txt +200 -0
- package/pods/sudo/backend/restaurant ordering system.txt +104 -0
- package/pods/sudo/das.txt +635 -0
- package/pods/sudo/react/TravelMap Application.txt +212 -0
- package/pods/sudo/sq.txt +217 -0
- package/pods/ts/Product Management System.txt +135 -0
- package/pods/ts/RetailStore.txt +113 -0
- package/pods/ts/Transaction Entity.txt +41 -0
- package/pods/ts/books_in_library.txt +39 -0
- package/pods/ts/find avg marks.txt +7 -0
- package/pods/ts/managing product inventory.txt +12 -0
- package/pods/ts/ts_examples/examples.txt +341 -0
- package/test.js +3 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
Q1. Which of the following is NOT a type of NoSQL database?
|
|
2
|
+
A) Document-oriented
|
|
3
|
+
B) Key-Value
|
|
4
|
+
C) Column-family
|
|
5
|
+
D) Relational
|
|
6
|
+
Answer: D
|
|
7
|
+
Explanation: Relational is SQL/RDBMS; NoSQL types include document, key-value, column-family, and graph.
|
|
8
|
+
Q2. Which statement about NoSQL databases is TRUE?
|
|
9
|
+
A) They enforce strict schemas
|
|
10
|
+
B) They are designed for horizontal scalability
|
|
11
|
+
C) They do not support replication
|
|
12
|
+
D) They cannot store semi-structured data
|
|
13
|
+
Answer: B
|
|
14
|
+
Explanation: NoSQL is typically schema-flexible and optimized for scale-out with replication/sharding.
|
|
15
|
+
Q3. The CAP theorem states you can guarantee at most two of the following in a distributed system:
|
|
16
|
+
A) Consistency, Availability, Partition Tolerance
|
|
17
|
+
B) Consistency, Atomicity, Partition Tolerance
|
|
18
|
+
C) Availability, Durability, Partition Tolerance
|
|
19
|
+
D) Consistency, Isolation, Partition Tolerance
|
|
20
|
+
Answer: A
|
|
21
|
+
Explanation: CAP: only two of Consistency (C), Availability (A), Partition tolerance (P) can be guaranteed simultaneously.
|
|
22
|
+
Q4. Which NoSQL type is optimal for social network relationships (friends, followers)?
|
|
23
|
+
A) Key-Value
|
|
24
|
+
B) Document
|
|
25
|
+
C) Graph
|
|
26
|
+
D) Column-family
|
|
27
|
+
Answer: C
|
|
28
|
+
Explanation: Graph DBs like Neo4j excel at relationship traversal (nodes/edges).
|
|
29
|
+
Q5. A key advantage of NoSQL over SQL for certain workloads is:
|
|
30
|
+
A) Strict joins across multiple tables
|
|
31
|
+
B) Strong typing of columns
|
|
32
|
+
C) Flexible schema and horizontal scaling
|
|
33
|
+
D) Mandatory ACID across all operations
|
|
34
|
+
Answer: C
|
|
35
|
+
Explanation: NoSQL favors schema flexibility and distributed scaling; joins/ACID may be limited or optional.
|
|
36
|
+
Q6. “Schema-less” generally means:
|
|
37
|
+
A) There is no structure at all
|
|
38
|
+
B) Structure can vary per record/document
|
|
39
|
+
C) Structure is auto-generated by the database only
|
|
40
|
+
D) Structure must be defined strictly before insertion
|
|
41
|
+
Answer: B
|
|
42
|
+
Explanation: Documents can have different sets of fields; validation can be optional or enforced via rules.
|
|
43
|
+
Q7. Which workload fits a key-value store best?
|
|
44
|
+
A) Ad-hoc analytics with complex joins
|
|
45
|
+
B) Session storage and caching
|
|
46
|
+
C) Hierarchical data with deep relationships
|
|
47
|
+
D) Time-series with wide partitions
|
|
48
|
+
Answer: B
|
|
49
|
+
Explanation: Key-value stores (e.g., Redis) are ideal for cache/session due to fast lookup by key.
|
|
50
|
+
Q8. Column-family databases (e.g., Cassandra) are best suited for:
|
|
51
|
+
A) Graph traversals
|
|
52
|
+
B) OLTP transactions with strict ACID
|
|
53
|
+
C) High write throughput and large-scale time-series
|
|
54
|
+
D) Document validation with nested JSON
|
|
55
|
+
Answer: C
|
|
56
|
+
Explanation: Column-family stores optimize for wide-row, high-volume writes and scale-out.
|
|
57
|
+
Section B: MongoDB Basics & CRUD (9–15)
|
|
58
|
+
Q9. MongoDB stores data internally as:
|
|
59
|
+
A) JSON
|
|
60
|
+
B) BSON
|
|
61
|
+
C) CSV
|
|
62
|
+
D) XML
|
|
63
|
+
Answer: B
|
|
64
|
+
Explanation: BSON (binary JSON) supports additional types (e.g., ObjectId, Date) and is efficient.
|
|
65
|
+
Q10. Which command lists all databases in the Mongo shell?
|
|
66
|
+
A) db.show()
|
|
67
|
+
B) show databases
|
|
68
|
+
C) list dbs
|
|
69
|
+
D) show dbs
|
|
70
|
+
Answer: D
|
|
71
|
+
Explanation: show dbs prints database names and sizes.
|
|
72
|
+
Q11. Insert multiple documents into a collection:
|
|
73
|
+
A) db.users.insertMany([...])
|
|
74
|
+
B) db.users.insertAll([...])
|
|
75
|
+
C) db.users.add([...])
|
|
76
|
+
D) db.users.bulkInsert([...])
|
|
77
|
+
Answer: A
|
|
78
|
+
Explanation: insertMany is the correct bulk insert API.
|
|
79
|
+
Q12. Update multiple documents matching a filter:
|
|
80
|
+
A) update()
|
|
81
|
+
B) updateOne()
|
|
82
|
+
C) updateMany()
|
|
83
|
+
D) save()
|
|
84
|
+
Answer: C
|
|
85
|
+
Explanation: updateMany() applies updates to all matching documents.
|
|
86
|
+
Q13. Upsert behavior means:
|
|
87
|
+
A) Update only existing documents
|
|
88
|
+
B) Insert only when the collection is empty
|
|
89
|
+
C) Insert if no document matches the filter, otherwise update
|
|
90
|
+
D) Always insert and ignore duplicates
|
|
91
|
+
Answer: C
|
|
92
|
+
Explanation: upsert: true creates a new document if none matches.
|
|
93
|
+
Q14. Which operator adds an element to an array only if it doesn’t already exist?
|
|
94
|
+
A) $push
|
|
95
|
+
B) $addToSet
|
|
96
|
+
C) $set
|
|
97
|
+
D) $each
|
|
98
|
+
Answer: B
|
|
99
|
+
Explanation: $addToSet ensures uniqueness in array additions.
|
|
100
|
+
Q15. The default _id field type in MongoDB is typically:
|
|
101
|
+
A) UUID (string)
|
|
102
|
+
B) Integer auto-increment
|
|
103
|
+
C) ObjectId
|
|
104
|
+
D) Binary blob without structure
|
|
105
|
+
Answer: C
|
|
106
|
+
Explanation: ObjectId is a 12-byte unique identifier used by default unless overridden.
|
|
107
|
+
Section C: Querying, Indexes & Aggregation (16–22)
|
|
108
|
+
Q16. Which command creates an ascending index on age?
|
|
109
|
+
A) db.users.addIndex({ age: 1 })
|
|
110
|
+
B) db.users.createIndex({ age: 1 })
|
|
111
|
+
C) db.users.index({ age: 1 })
|
|
112
|
+
D) db.users.ensureIndex({ age: 1 })
|
|
113
|
+
Answer: B
|
|
114
|
+
Explanation: createIndex is the correct method (modern API).
|
|
115
|
+
Q17. Compound index ordering matters because:
|
|
116
|
+
A) It only affects storage layout, not performance
|
|
117
|
+
B) The prefix fields influence which queries can use the index
|
|
118
|
+
C) MongoDB ignores the order entirely
|
|
119
|
+
D) It’s only relevant for text indexes
|
|
120
|
+
Answer: B
|
|
121
|
+
Explanation: Index prefix rule: queries must include leading fields to fully leverage the compound index.
|
|
122
|
+
Q18. Which operator checks for existence of a field?
|
|
123
|
+
A) $match
|
|
124
|
+
B) $exists
|
|
125
|
+
C) $in
|
|
126
|
+
D) $type
|
|
127
|
+
Answer: B
|
|
128
|
+
Explanation: $exists: true/false matches presence/absence of a field.
|
|
129
|
+
Q19. Choose the correct aggregation pipeline stage to group by a field and compute counts:
|
|
130
|
+
A) $project
|
|
131
|
+
B) $group
|
|
132
|
+
C) $sort
|
|
133
|
+
D) $lookup
|
|
134
|
+
Answer: B
|
|
135
|
+
Explanation: $group aggregates documents by keys to compute accumulators ($sum, $avg, etc.).
|
|
136
|
+
Q20. The difference between find() and aggregate() is:
|
|
137
|
+
A) find() is only for insert; aggregate() is only for delete
|
|
138
|
+
B) find() handles simple queries; aggregate() enables complex transformations
|
|
139
|
+
C) Both are identical
|
|
140
|
+
D) aggregate() is deprecated
|
|
141
|
+
Answer: B
|
|
142
|
+
Explanation: find() retrieves documents based on filter; aggregate() performs pipeline-based transformations.
|
|
143
|
+
Q21. A text index in MongoDB enables:
|
|
144
|
+
A) Geospatial queries
|
|
145
|
+
B) Fast prefix-only match on numeric fields
|
|
146
|
+
C) Full-text search across string content
|
|
147
|
+
D) Automatic stemming for all fields by default
|
|
148
|
+
Answer: C
|
|
149
|
+
Explanation: Text indexes support language-aware search; must be created explicitly on string fields.
|
|
150
|
+
Q22. To avoid scanning many documents for a sort, you should:
|
|
151
|
+
A) Use $project
|
|
152
|
+
B) Use $unwind
|
|
153
|
+
C) Create a matching index on the sort fields
|
|
154
|
+
D) Disable sorting
|
|
155
|
+
Answer: C
|
|
156
|
+
Explanation: Sorting is efficient when the query can use an index that matches the sort order.
|
|
157
|
+
Section D: Replication, Transactions & Sharding (23–26)
|
|
158
|
+
Q23. Replication in MongoDB provides:
|
|
159
|
+
A) Horizontal partitioning of data
|
|
160
|
+
B) High availability via multiple copies (primary/secondaries)
|
|
161
|
+
C) Only performance improvements on writes
|
|
162
|
+
D) Encryption at rest
|
|
163
|
+
Answer: B
|
|
164
|
+
Explanation: Replica sets maintain multiple copies; failover promotes a secondary to primary.
|
|
165
|
+
Q24. Which consistency model is typical for reads from secondaries in MongoDB?
|
|
166
|
+
A) Linearizable by default
|
|
167
|
+
B) Strong always
|
|
168
|
+
C) Eventual consistency
|
|
169
|
+
D) No consistency guarantees
|
|
170
|
+
Answer: C
|
|
171
|
+
Explanation: Secondaries replicate asynchronously; reads may be eventually consistent unless configured otherwise.
|
|
172
|
+
Q25. Sharding in MongoDB is:
|
|
173
|
+
A) Replicating identical data across nodes
|
|
174
|
+
B) Vertical scaling (more CPU/RAM)
|
|
175
|
+
C) Splitting data across shards using a shard key
|
|
176
|
+
D) Compressing documents for storage
|
|
177
|
+
Answer: C
|
|
178
|
+
Explanation: Sharding distributes data across multiple servers based on shard key ranges or hashed keys.
|
|
179
|
+
Q26. Multi-document ACID transactions in MongoDB require:
|
|
180
|
+
A) Standalone (no replica set needed)
|
|
181
|
+
B) Replica set or sharded cluster, with appropriate session/transaction APIs
|
|
182
|
+
C) Text index enabled
|
|
183
|
+
D) MapReduce enabled
|
|
184
|
+
Answer: B
|
|
185
|
+
Explanation: Transactions are supported in replica sets and sharded clusters using session.startTransaction().
|
|
186
|
+
Section E: Redis/Cassandra & Cross-Topic (27–28)
|
|
187
|
+
Q27. Redis SETEX key seconds value does:
|
|
188
|
+
A) Sets a key if it doesn’t exist
|
|
189
|
+
B) Sets a key with expiry in seconds
|
|
190
|
+
C) Returns TTL of a key
|
|
191
|
+
D) Renames a key with expiry
|
|
192
|
+
Answer: B
|
|
193
|
+
Explanation: SETEX sets value and expiration atomically (common for caching/session).
|
|
194
|
+
Q28. Cassandra partition keys are crucial because they:
|
|
195
|
+
A) Control how data is sharded across the cluster
|
|
196
|
+
B) Enable full ACID transactions across tables
|
|
197
|
+
C) Determine index order only
|
|
198
|
+
D) Are optional for writes
|
|
199
|
+
Answer: A
|
|
200
|
+
Explanation: Partition keys decide which node stores the data; modeling starts from query patterns and partition keys.
|
|
201
|
+
Section F: Scenario-Based (29–30)
|
|
202
|
+
Q29. You need to store product catalogs with flexible attributes (varying per product) and run filters by attributes. Best choice?
|
|
203
|
+
A) Relational DB with strict schema
|
|
204
|
+
B) Document DB like MongoDB
|
|
205
|
+
C) Key-Value store like Redis
|
|
206
|
+
D) Graph DB
|
|
207
|
+
Answer: B
|
|
208
|
+
Explanation: Flexible JSON documents and secondary indexes suit catalogs with variable attributes.
|
|
209
|
+
Q30. You’re building real-time analytics on high-volume event streams (append-heavy, time-series). Which approach fits best?
|
|
210
|
+
A) MongoDB capped collections or time-series collections; or column-family store like Cassandra
|
|
211
|
+
B) Graph database only
|
|
212
|
+
C) Pure key-value without TTL
|
|
213
|
+
D) Text indexes everywhere
|
|
214
|
+
Answer: A
|
|
215
|
+
Explanation: MongoDB has time-series collections optimized for metrics;
|
|
216
|
+
Cassandra excels at high-throughput time-series writes.
|