wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Database Concepts Quiz

Total questions: 35

Worksheet time: 18mins

Name
Class
Date
1.

Which of the following best describes MongoDB?

a)

Relational database

b)

Document-oriented NoSQL database

c)

Graph database

d)

Key-value store

2.

In MongoDB, data is stored in:

a)

Tables

b)

Collections

c)

Rows

d)

Views

3.

The default _id field in MongoDB is of type:

a)

Integer

b)

String

c)

ObjectId

d)

UUID

4.

Which MongoDB command is used to display all databases?

a)

show collections

b)

db.getCollectionNames()

c)

show dbs

d)

db.showDatabases()

5.

Which method is used to insert multiple documents at once?

a)

insert()

b)

insertOne()

c)

insertMany()

d)

bulkInsert()

6.

Which query selects all documents where age is greater than 25?

a)

{age: > 25}

b)

{age: {$gt: 25}}

c)

{age: {gt: 25}}

d)

{age: => 25}

7.

The $and operator in MongoDB is used to:

a)

Combine two queries where both must be true

b)

Combine two queries where one must be true

c)

Sort data in ascending order

d)

Perform aggregation

8.

Which command removes all documents from a collection but keeps the collection?

a)

db.collection.drop()

b)

db.collection.deleteMany({})

c)

db.collection.removeAll()

d)

db.collection.truncate()

9.

Which index type supports geospatial queries?

a)

Text index

b)

2dsphere index

c)

Compound index

d)

Hashed index

10.

In MongoDB, the $set operator is used to:

a)

Replace an entire document

b)

Update specific fields in a document

c)

Delete a field

d)

Rename a collection

11.

Which aggregation stage groups documents by a specified field?

a)

$match

b)

$group

c)

$project

d)

$sort

12.

To skip the first 5 documents in a query result, you use:

a)

.limit(5)

b)

.skip(5)

c)

.offset(5)

d)

.start(5)

13.

The command to update multiple documents is:

a)

updateOne()

b)

updateMany()

c)

updateAll()

d)

bulkUpdate()

14.

What is the maximum size of a single BSON document in MongoDB?

a)

1 MB

b)

16 MB

c)

32 MB

d)

64 MB

15.

MongoDB stores data in which format internally?

a)

JSON

b)

BSON

c)

XML

d)

CSV

16.

Which of the following is NOT a valid MongoDB data type?

a)

String

b)

Double

c)

Timestamp

d)

Pointer

17.

Which command is used to rename a collection?

a)

db.renameCollection()

b)

db.collection.rename()

c)

db.collection.renameCollection()

d)

db.collection.renameTo()

18.

What does the $in operator do?

a)

Checks if a field exists

b)

Matches values in an array of possible values

c)

Checks if a field contains null

d)

Matches only numeric values

19.

PostgreSQL is an example of:

a)

NoSQL database

b)

Relational database

c)

Graph database

d)

Document database

20.

Which command lists all databases in PostgreSQL?

a)

SHOW DATABASES;

b)

\l

c)

LIST DATABASES;

d)

DISPLAY DATABASES;

21.

Which command connects to a specific database?

a)

\connect dbname

b)

USE dbname

c)

CONNECT dbname;

d)

\c dbname

22.

Which data type is used to store true/false values?

a)

BIT

b)

BOOLEAN

c)

LOGICAL

d)

BOOL

23.

The SERIAL keyword in PostgreSQL is used for:

a)

String concatenation

b)

Auto-increment integer values

c)

Setting default values

d)

Creating foreign keys

24.

Which clause filters rows before aggregation?

a)

WHERE

b)

HAVING

c)

FILTER

d)

GROUP BY

25.

Which clause filters rows after aggregation?

a)

WHERE

b)

HAVING

c)

FILTER

d)

GROUP BY

26.

Which join returns all rows from both tables, with NULL where no match exists?

a)

INNER JOIN

b)

LEFT JOIN

c)

FULL JOIN

d)

CROSS JOIN

27.

What does the DISTINCT keyword do?

a)

Sorts the data

b)

Removes duplicate rows

c)

Counts rows

d)

Filters null values

28.

Which function returns the number of rows?

a)

COUNT()

b)

SUM()

c)

TOTAL()

d)

SIZE()

29.

Which operator is used for pattern matching in PostgreSQL?

a)

LIKE

b)

MATCHES

c)

PATTERN

d)

CONTAINS

30.

Which symbol is used as a wildcard for multiple characters in LIKE?

a)

%

b)

_

c)

*

d)

?

31.

To change the structure of a table, you use:

a)

MODIFY TABLE

b)

ALTER TABLE

c)

UPDATE TABLE

d)

CHANGE TABLE

32.

What is the default port number for PostgreSQL?

a)

1433

b)

3306

c)

5432

d)

1521

33.

Which keyword is used to delete all rows from a table but keep its structure?

a)

DELETE

b)

TRUNCATE

c)

DROP

d)

REMOVE

34.

Which PostgreSQL constraint ensures that a column cannot have NULL values?

a)

NOT NULL

b)

UNIQUE

c)

PRIMARY KEY

d)

FOREIGN KEY

35.

Which clause combines the result of two SELECT statements, removing duplicates?

a)

UNION

b)

UNION ALL

c)

INTERSECT

d)

EXCEPT