0% found this document useful (0 votes)
9 views

SD ST2 PRACTICE QUESTIONS (3)

Uploaded by

anshika11437
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)
9 views

SD ST2 PRACTICE QUESTIONS (3)

Uploaded by

anshika11437
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/ 30

1. What does DBMS stand for?

○ a) Database Manipulation System


○ b) Database Management System
○ c) Data Backup Management Software
○ d) None of the above
Answer: b) Database Management System
Explanation: A DBMS is software designed to store, retrieve, and manage data
in databases.
2. Which of the following is a key feature of DBMS?
○ a) Data redundancy
○ b) Centralized data management
○ c) Inconsistent data
○ d) Manual data handling
Answer: b) Centralized data management
Explanation: DBMS centralizes the management of data to reduce redundancy
and ensure consistency.
3. What type of database model does RDBMS use?
○ a) Hierarchical model
○ b) Network model
○ c) Relational model
○ d) Object-oriented model
Answer: c) Relational model
Explanation: RDBMS uses the relational model where data is stored in tables
with rows and columns.
4. Which of the following is a component of a DBMS?
○ a) Data Definition Language (DDL)
○ b) Query Processor
○ c) Transaction Manager
○ d) All of the above
Answer: d) All of the above
Explanation: A DBMS comprises several components, including DDL, a query
processor, and a transaction manager.
5. Which language is used to manipulate data in a database?
○ a) HTML
○ b) SQL
○ c) Python
○ d) C++
Answer: b) SQL
Explanation: SQL (Structured Query Language) is used for querying and
managing data in a database.
6. Which of the following is not a DBMS software?
○ a) MySQL
○ b) Oracle
○ c) MS Access
○ d) Excel
Answer: d) Excel
Explanation: Excel is a spreadsheet application, not a database management
system.
7. What is the main function of the transaction manager in a DBMS?
○ a) Query optimization
○ b) Enforcing constraints
○ c) Ensuring ACID properties
○ d) Storing data
Answer: c) Ensuring ACID properties
Explanation: The transaction manager ensures atomicity, consistency, isolation,
and durability (ACID) for database transactions.
8. What does the relational model in RDBMS organize data into?
○ a) Trees
○ b) Tables
○ c) Graphs
○ d) Lists
Answer: b) Tables
Explanation: In the relational model, data is organized into tables, also called
relations.
9. What is a primary key in RDBMS?
○ a) A column that can store duplicate values
○ b) A unique identifier for each record in a table
○ c) A foreign key in a related table
○ d) None of the above
Answer: b) A unique identifier for each record in a table
Explanation: A primary key ensures each record in a table is unique and
non-null.
10. Which of the following ensures data integrity in a database?
○ a) Constraints
○ b) Indexes
○ c) Triggers
○ d) Views
Answer: a) Constraints
Explanation: Constraints like primary keys, foreign keys, and check constraints
ensure data integrity.
11. In SQL, which command is used to retrieve data?
○ a) INSERT
○ b) SELECT
○ c) DELETE
○ d) UPDATE
Answer: b) SELECT
Explanation: The SELECT command is used to query and retrieve data from a
database.
12. What does SQL stand for?
○ a) Standard Query Language
○ b) Structured Query Language
○ c) Sequential Query Language
○ d) None of the above
Answer: b) Structured Query Language
Explanation: SQL is a language designed for interacting with relational
databases.
13. Which of the following SQL commands modifies existing data in a table?
○ a) SELECT
○ b) UPDATE
○ c) DELETE
○ d) CREATE
Answer: b) UPDATE
Explanation: The UPDATE command modifies existing records in a table.
14. What is the difference between SQL and NoSQL databases?
○ a) SQL databases are non-relational; NoSQL databases are relational
○ b) SQL databases use tables; NoSQL uses various models
○ c) SQL databases handle unstructured data; NoSQL handles structured data
○ d) None of the above
Answer: b) SQL databases use tables; NoSQL uses various models
Explanation: SQL databases use a tabular structure, while NoSQL databases
support document, key-value, columnar, or graph models.
15. Which NoSQL database uses a document-oriented model?
○ a) MongoDB
○ b) Cassandra
○ c) Neo4j
○ d) Redis
Answer: a) MongoDB
Explanation: MongoDB stores data in JSON-like documents, making it a
document-oriented NoSQL database.
16. Which property of NoSQL databases makes them suitable for big data?
○ a) ACID compliance
○ b) Horizontal scalability
○ c) Relational integrity
○ d) None of the above
Answer: b) Horizontal scalability
Explanation: NoSQL databases are designed to scale horizontally, making them
ideal for handling big data.
17. What does the CAP theorem in distributed databases stand for?
○ a) Consistency, Accuracy, Partitioning
○ b) Consistency, Availability, Partition tolerance
○ c) Availability, Persistence, Clustering
○ d) Consistency, Access, Performance
Answer: b) Consistency, Availability, Partition tolerance
Explanation: The CAP theorem states that distributed systems can achieve at
most two out of three: consistency, availability, and partition tolerance.
18. What is a foreign key in a relational database?
○ a) A unique identifier for a table
○ b) A key that points to primary keys in another table
○ c) A non-unique column in a table
○ d) None of the above
Answer: b) A key that points to primary keys in another table
Explanation: A foreign key establishes relationships between tables by
referencing primary keys in another table.
19. Which of the following is a column-oriented NoSQL database?
○ a) MongoDB
○ b) Cassandra
○ c) Redis
○ d) Neo4j
Answer: b) Cassandra
Explanation: Cassandra is a column-family NoSQL database suitable for
large-scale data.
20. Which of the following is not an advantage of RDBMS?
○ a) Data consistency
○ b) High scalability
○ c) Complex relationships
○ d) ACID compliance
Answer: b) High scalability
Explanation: RDBMS systems often struggle with scalability compared to
NoSQL databases.
21. Which of the following is an example of an RDBMS?
○ a) MongoDB
○ b) PostgreSQL
○ c) Redis
○ d) Neo4j
Answer: b) PostgreSQL
Explanation: PostgreSQL is an open-source relational database management
system (RDBMS).
22. Which of the following commands is used to delete a table in SQL?
○ a) DROP
○ b) DELETE
○ c) REMOVE
○ d) ERASE
Answer: a) DROP
Explanation: The DROP command is used to delete a table, including its
structure and data.
23. What is the main purpose of the Data Definition Language (DDL) in SQL?
○ a) To define database schemas
○ b) To manipulate data
○ c) To control database access
○ d) To perform transactions
Answer: a) To define database schemas
Explanation: DDL commands like CREATE, ALTER, and DROP are used to define
or modify database structures.
24. What is a schema in a database?
○ a) A type of database model
○ b) The physical storage of data
○ c) The logical structure of a database
○ d) A database constraint
Answer: c) The logical structure of a database
Explanation: A schema represents the organization of data as a blueprint for
database structure.
25. Which SQL clause is used to filter rows in a query?
○ a) WHERE
○ b) GROUP BY
○ c) ORDER BY
○ d) HAVING
Answer: a) WHERE
Explanation: The WHERE clause is used to filter rows based on specified
conditions.
26. Which constraint ensures that all column values are unique?
○ a) PRIMARY KEY
○ b) UNIQUE
○ c) FOREIGN KEY
○ d) NOT NULL
Answer: b) UNIQUE
Explanation: The UNIQUE constraint ensures that all values in a column are
distinct.
27. Which of the following is not a type of JOIN in SQL?
○ a) INNER JOIN
○ b) LEFT JOIN
○ c) OUTER JOIN
○ d) UPPER JOIN
Answer: d) UPPER JOIN
Explanation: There is no such thing as UPPER JOIN. Common types include
INNER, LEFT, RIGHT, and FULL OUTER JOIN.
28. What is the purpose of the GROUP BY clause in SQL?
○ a) To sort query results
○ b) To group rows sharing a property
○ c) To filter grouped data
○ d) To create a new table
Answer: b) To group rows sharing a property
Explanation: GROUP BY groups rows that have the same values in specified
columns for aggregate operations.
29. Which of the following operations violates the ACID property in databases?
○ a) Reading data without locks
○ b) Partial transaction commits
○ c) Writing data to disk
○ d) Checking constraints
Answer: b) Partial transaction commits
Explanation: The Atomicity property ensures transactions are all-or-nothing.
Partial commits violate this.
30. What is a composite key?
○ a) A key consisting of a single column
○ b) A combination of multiple attributes to form a unique identifier
○ c) A key that references another table
○ d) A unique key generated by the database
Answer: b) A combination of multiple attributes to form a unique identifier
Explanation: Composite keys use two or more columns to uniquely identify a
record.
31. Which of the following is not an aggregate function in SQL?
○ a) COUNT
○ b) MAX
○ c) SUM
○ d) ADD
Answer: d) ADD
Explanation: ADD is not an aggregate function. Aggregate functions summarize
data, such as COUNT, MAX, and SUM.
32. Which SQL command is used to add a new column to an existing table?
○ a) INSERT
○ b) ADD
○ c) ALTER
○ d) UPDATE
Answer: c) ALTER
Explanation: The ALTER command modifies the structure of an existing table,
including adding new columns.
33. What does the SQL keyword NULL represent?
○ a) Zero
○ b) Blank space
○ c) Unknown or missing value
○ d) False
Answer: c) Unknown or missing value
Explanation: NULL in SQL represents a missing or undefined value.
34. Which operator is used to compare a value against a list of values in SQL?
○ a) IN
○ b) BETWEEN
○ c) LIKE
○ d) EXISTS
Answer: a) IN
Explanation: The IN operator checks if a value exists in a list of specified
values.
35. Which SQL function is used to get the current date and time?
○ a) SYSDATE()
○ b) NOW()
○ c) CURRENT_DATE()
○ d) GETDATE()
Answer: b) NOW()
Explanation: In SQL, the NOW() function retrieves the current date and time.
36. Which of the following can be used to retrieve unique records in SQL?
○ a) DISTINCT
○ b) UNIQUE
○ c) DISTINCTROW
○ d) SELECT UNIQUE
Answer: a) DISTINCT
Explanation: The DISTINCT keyword removes duplicate records from the result
set.
37. What does the SQL keyword LIKE do?
○ a) Compares equality of strings
○ b) Matches patterns in strings
○ c) Groups data
○ d) Sorts data
Answer: b) Matches patterns in strings
Explanation: The LIKE keyword is used for pattern matching with wildcards (%
and _).
38. What is the default sorting order of the ORDER BY clause in SQL?
○ a) Ascending
○ b) Descending
○ c) Random
○ d) Lexical
Answer: a) Ascending
Explanation: The default order for ORDER BY is ascending unless explicitly
specified as DESC.
39. What is the purpose of an index in a database?
○ a) To reduce storage
○ b) To improve query performance
○ c) To enforce data integrity
○ d) To create relationships
Answer: b) To improve query performance
Explanation: Indexes allow faster retrieval of records by creating a quick
reference for data lookups.
40. Which type of join returns all rows from both tables, with NULLs in unmatched
columns?
○ a) INNER JOIN
○ b) FULL OUTER JOIN
○ c) LEFT JOIN
○ d) RIGHT JOIN
Answer: b) FULL OUTER JOIN
Explanation: FULL OUTER JOIN combines results from both tables, inserting
NULL where no match exists.
41. Which of the following is a DDL command?
○ a) SELECT
○ b) INSERT
○ c) CREATE
○ d) DELETE
Answer: c) CREATE
Explanation: DDL commands define or alter the structure of a database (e.g.,
CREATE, ALTER, DROP).
42. What does the SQL CREATE command do?
○ a) Adds new data
○ b) Creates new database objects like tables
○ c) Modifies existing data
○ d) Removes data
Answer: b) Creates new database objects like tables
Explanation: The CREATE command is used to create tables, views, indexes,
and databases.
43. Which SQL command deletes the structure and data of a table permanently?
○ a) DROP
○ b) DELETE
○ c) TRUNCATE
○ d) REMOVE
Answer: a) DROP
Explanation: DROP removes the table definition and all its data from the
database permanently.
44. What is the purpose of the ALTER command in SQL?
○ a) To modify data in a table
○ b) To delete data in a table
○ c) To modify the structure of an existing table
○ d) To retrieve data from a table
Answer: c) To modify the structure of an existing table
Explanation: The ALTER command is used to add, modify, or delete columns in
a table.
45. Which of the following can the DROP command be used for?
○ a) Tables
○ b) Views
○ c) Indexes
○ d) All of the above
Answer: d) All of the above
Explanation: The DROP command can be used to delete tables, views, and other
database objects.
46. Which command is used to rename a table in SQL?
○ a) RENAME
○ b) ALTER TABLE
○ c) UPDATE TABLE
○ d) MODIFY TABLE
Answer: b) ALTER TABLE
Explanation: The ALTER TABLE command with RENAME can be used to rename
a table.
47. Which SQL command is used to remove all rows from a table without deleting the
table structure?
○ a) DELETE
○ b) DROP
○ c) TRUNCATE
○ d) CLEAR
Answer: c) TRUNCATE
Explanation: The TRUNCATE command deletes all rows but retains the table
structure for future use.
48. Which clause is used to ensure that column values are unique?
○ a) CHECK
○ b) UNIQUE
○ c) DEFAULT
○ d) NOT NULL
Answer: b) UNIQUE
Explanation: The UNIQUE constraint ensures that all values in a column are
distinct.
49. What does the SQL DEFAULT constraint do?
○ a) Enforces a unique value
○ b) Ensures a column has a default value if no value is provided
○ c) Limits the range of values
○ d) Checks for null values
Answer: b) Ensures a column has a default value if no value is provided
Explanation: The DEFAULT constraint provides a default value for a column if
none is specified.
50. Which DDL command can be used to add a new column to an existing table?
○ a) ADD COLUMN
○ b) ALTER TABLE
○ c) MODIFY COLUMN
○ d) CREATE COLUMN
Answer: b) ALTER TABLE
Explanation: The ALTER TABLE command can add new columns to a table.
51. Which of the following is a DML command?
○ a) INSERT
○ b) SELECT
○ c) UPDATE
○ d) All of the above
Answer: d) All of the above
Explanation: DML commands manipulate data in tables and include INSERT,
SELECT, UPDATE, and DELETE.
52. Which command is used to add new rows to a table?
○ a) ADD
○ b) INSERT
○ c) UPDATE
○ d) APPEND
Answer: b) INSERT
Explanation: The INSERT command adds new rows to a table.
53. What does the UPDATE command do?
○ a) Adds new data
○ b) Deletes data
○ c) Modifies existing data in a table
○ d) Retrieves data
Answer: c) Modifies existing data in a table
Explanation: The UPDATE command modifies values of existing rows in a table.
54. Which SQL statement is used to delete specific rows from a table?
○ a) REMOVE
○ b) DELETE
○ c) TRUNCATE
○ d) DROP
Answer: b) DELETE
Explanation: The DELETE command removes specific rows from a table based
on a condition.
55. Which SQL clause is commonly used with DELETE to specify rows to be deleted?
○ a) WHERE
○ b) ORDER BY
○ c) GROUP BY
○ d) HAVING
Answer: a) WHERE
Explanation: The WHERE clause specifies the condition to filter rows for deletion.
56. How do you retrieve all rows and columns from a table named employees?
○ a) SELECT * FROM employees;
○ b) SELECT ALL FROM employees;
○ c) SELECT rows FROM employees;
○ d) SELECT columns FROM employees;
Answer: a) SELECT * FROM employees;
Explanation: SELECT * retrieves all rows and columns from the specified table.
57. Which command is used to sort the result set in ascending or descending order?
○ a) SORT
○ b) ORDER BY
○ c) GROUP BY
○ d) SORT BY
Answer: b) ORDER BY
Explanation: The ORDER BY clause is used to sort data in ascending (ASC) or
descending (DESC) order.
58. Which clause in SQL is used to group rows with similar values?
○ a) GROUP BY
○ b) ORDER BY
○ c) WHERE
○ d) HAVING
Answer: a) GROUP BY
Explanation: The GROUP BY clause groups rows with similar values, often for
aggregation.
59. What does the HAVING clause do in SQL?
○ a) Filters rows before grouping
○ b) Filters groups after aggregation
○ c) Limits query results
○ d) Defines constraints
Answer: b) Filters groups after aggregation
Explanation: The HAVING clause is used to filter groups of data, typically in
combination with GROUP BY.
60. Which aggregate function returns the total number of rows in a table?
○ a) SUM()
○ b) COUNT()
○ c) AVG()
○ d) MAX()
Answer: b) COUNT()
Explanation: The COUNT() function counts the number of rows in a table.
61. Which of the following is a DCL command?
○ a) GRANT
○ b) REVOKE
○ c) COMMIT
○ d) Both a and b
Answer: d) Both a and b
Explanation: DCL commands, such as GRANT and REVOKE, control user access
and permissions.
62. What is the purpose of the GRANT command in SQL?
○ a) To give users access privileges to the database
○ b) To remove users from a database
○ c) To commit transactions
○ d) To create new tables
Answer: a) To give users access privileges to the database
Explanation: The GRANT command is used to provide specific privileges to
users.
63. Which command revokes previously granted permissions?
○ a) REMOVE
○ b) REVOKE
○ c) DELETE
○ d) DROP
Answer: b) REVOKE
Explanation: The REVOKE command removes previously granted user
permissions.
64. What is the purpose of the COMMIT command in SQL?
○ a) To rollback transactions
○ b) To save changes made during a transaction
○ c) To delete changes in a transaction
○ d) To execute queries
Answer: b) To save changes made during a transaction
Explanation: COMMIT finalizes the changes made in a transaction.
65. Which command undoes changes made by a transaction?
○ a) COMMIT
○ b) ROLLBACK
○ c) SAVEPOINT
○ d) CANCEL
Answer: b) ROLLBACK
Explanation: The ROLLBACK command reverts all changes made in the current
transaction.
66. Which SQL command is used to grant a specific privilege on a database table to a
user?
○ a) ASSIGN
○ b) GRANT
○ c) PERMIT
○ d) ENABLE
Answer: b) GRANT
Explanation: The GRANT command assigns privileges to users on specific
database objects like tables or views.
67. Which privilege allows users to retrieve data from a table?
○ a) INSERT
○ b) UPDATE
○ c) SELECT
○ d) DELETE
Answer: c) SELECT
Explanation: The SELECT privilege grants the ability to read or retrieve data
from a table.
68. Which of the following is used to undo changes to a specific point in a
transaction?
○ a) COMMIT
○ b) ROLLBACK
○ c) SAVEPOINT
○ d) TRUNCATE
Answer: c) SAVEPOINT
Explanation: The SAVEPOINT command creates a point in a transaction to
which a rollback can be performed.
69. What is the difference between ROLLBACK and SAVEPOINT?
○ a) ROLLBACK undoes all changes, while SAVEPOINT undoes only to a specific
point.
○ b) Both are identical in functionality.
○ c) SAVEPOINT commits changes, while ROLLBACK undoes them.
○ d) SAVEPOINT is for DDL, while ROLLBACK is for DML.
Answer: a) ROLLBACK undoes all changes, while SAVEPOINT undoes only to a
specific point.
Explanation: ROLLBACK reverts the entire transaction, while SAVEPOINT allows
partial rollback.
70. Which of the following is not a transaction control command in SQL?
○ a) COMMIT
○ b) ROLLBACK
○ c) GRANT
○ d) SAVEPOINT
Answer: c) GRANT
Explanation: Transaction control commands include COMMIT, ROLLBACK, and
SAVEPOINT. GRANT is a DCL command.
71. Which of the following commands is used to modify an existing column's data
type?
○ a) MODIFY COLUMN
○ b) ALTER TABLE
○ c) UPDATE COLUMN
○ d) CHANGE TYPE
Answer: b) ALTER TABLE
Explanation: The ALTER TABLE command is used to change the data type of
an existing column.
72. What happens if you try to drop a table that does not exist?
○ a) It raises an error.
○ b) It deletes all dependent objects.
○ c) It ignores the command.
○ d) It creates the table.
Answer: a) It raises an error.
Explanation: Dropping a non-existent table results in an error unless you use the
IF EXISTS clause.
73. Which command ensures that no duplicate values are inserted into a column?
○ a) NOT NULL
○ b) UNIQUE
○ c) PRIMARY KEY
○ d) FOREIGN KEY
Answer: b) UNIQUE
Explanation: The UNIQUE constraint prevents duplicate values in a column.
74. What is the difference between DROP and TRUNCATE commands?
○ a) DROP deletes the table structure, while TRUNCATE removes only the data.
○ b) TRUNCATE deletes structure, while DROP removes data.
○ c) Both delete data and structure.
○ d) Both are identical.
Answer: a) DROP deletes the table structure, while TRUNCATE removes only the
data.
Explanation: DROP permanently removes the table and its structure; TRUNCATE
clears data but retains the table.
75. Which SQL command adds a primary key constraint to an existing table?
○ a) ALTER TABLE
○ b) UPDATE TABLE
○ c) ADD PRIMARY KEY
○ d) MODIFY COLUMN
Answer: a) ALTER TABLE
Explanation: The ALTER TABLE command adds a primary key constraint to an
existing table.
76. What does the MERGE statement in SQL do?
○ a) Deletes rows from multiple tables
○ b) Combines data from multiple tables
○ c) Performs an INSERT, UPDATE, or DELETE based on conditions
○ d) None of the above
Answer: c) Performs an INSERT, UPDATE, or DELETE based on conditions
Explanation: The MERGE statement is used for conditional inserts, updates, or
deletes.
77. Which of the following is used to limit the number of rows returned by a query?
○ a) LIMIT
○ b) WHERE
○ c) GROUP BY
○ d) ORDER BY
Answer: a) LIMIT
Explanation: The LIMIT clause restricts the number of rows returned by a
query.
78. What is the purpose of the INSERT INTO SELECT statement?
○ a) To copy data from one table to another
○ b) To retrieve data from multiple tables
○ c) To insert new data into one table
○ d) To update existing data
Answer: a) To copy data from one table to another
Explanation: INSERT INTO SELECT copies rows from one table into another.
79. Which SQL keyword is used to remove duplicate rows from the result set?
○ a) DISTINCT
○ b) UNIQUE
○ c) LIMIT
○ d) DISTINCTROW
Answer: a) DISTINCT
Explanation: The DISTINCT keyword eliminates duplicate rows in a query
result.
80. What does the SQL CASE statement do?
○ a) Executes different queries based on conditions
○ b) Implements loops in SQL
○ c) Defines transactions
○ d) Creates constraints
Answer: a) Executes different queries based on conditions
Explanation: The CASE statement allows conditional logic in SQL queries.
81. Which command rolls back a transaction to a specific savepoint?
○ a) COMMIT
○ b) ROLLBACK
○ c) ROLLBACK TO SAVEPOINT
○ d) SAVEPOINT
Answer: c) ROLLBACK TO SAVEPOINT
Explanation: ROLLBACK TO SAVEPOINT undoes all changes after the specified
savepoint, restoring the state to that point.
82. What is the purpose of the SAVEPOINT command?
○ a) Permanently save changes
○ b) Undo all changes in a transaction
○ c) Create a point within a transaction to which you can rollback
○ d) None of the above
Answer: c) Create a point within a transaction to which you can rollback
Explanation: SAVEPOINT allows you to define a point in a transaction that can
be used for partial rollbacks.
83. Which command is used to undo all changes in a transaction?
○ a) COMMIT
○ b) ROLLBACK
○ c) SAVEPOINT
○ d) GRANT
Answer: b) ROLLBACK
Explanation: ROLLBACK undoes all changes made during the transaction,
reverting the database to its previous state.
84. If no COMMIT or ROLLBACK is issued, what happens when the session ends?
○ a) Changes are automatically saved
○ b) Changes are discarded
○ c) Changes are saved with warnings
○ d) Depends on the database
Answer: d) Depends on the database
Explanation: Some databases (e.g., Oracle) discard changes, while others (e.g.,
MySQL with auto-commit enabled) save them.
85. Can a transaction consist of multiple SAVEPOINTs?
○ a) Yes
○ b) No
Answer: a) Yes
Explanation: A transaction can have multiple savepoints, each marking a
specific point for partial rollbacks.
86. Which TCL command ends a transaction and begins a new one?
○ a) COMMIT
○ b) ROLLBACK
○ c) BEGIN TRANSACTION
○ d) AUTO-COMMIT
Answer: a) COMMIT
Explanation: COMMIT ends the current transaction and allows a new one to
begin.
87. What happens if ROLLBACK is used without a SAVEPOINT?
○ a) Rolls back the entire transaction
○ b) Does nothing
○ c) Creates an implicit savepoint
○ d) Saves changes permanently
Answer: a) Rolls back the entire transaction
Explanation: Without a savepoint, ROLLBACK reverts all changes in the
transaction.
88. What is the default transaction behavior in most databases?
○ a) Auto-commit enabled
○ b) Manual commit required
○ c) Transactions are disabled
○ d) Rollback is automatic
Answer: a) Auto-commit enabled
Explanation: Most databases, like MySQL, automatically commit changes
unless explicitly turned off.
89. Which of the following is the main command in DQL?
● a) SELECT
● b) INSERT
● c) DELETE
● d) UPDATE
Answer: a) SELECT
Explanation: SELECT is the primary DQL command used for retrieving data from the
database.
90. What is a functional dependency?
○ a) A constraint between two attributes
○ b) A type of primary key
○ c) A relationship between two tables
○ d) None of the above
Answer: a) A constraint between two attributes
Explanation: A functional dependency (FD) occurs when the value of one
attribute uniquely determines the value of another attribute.
91. In functional dependency notation, what does A → B mean?
○ a) A depends on B
○ b) B determines A
○ c) A determines B
○ d) A and B are independent
Answer: c) A determines B
Explanation: If A → B, then knowing the value of A is enough to determine the
value of B.
92. Which of the following is a trivial functional dependency?
○ a) A → B
○ b) B → C
○ c) A → A
○ d) None of the above
Answer: c) A → A
Explanation: A functional dependency is trivial if the dependent attribute is a
subset of the determinant.
93. What is a non-trivial functional dependency?
○ a) When A → B and B is a subset of A
○ b) When A → B and B is not a subset of A
○ c) When A and B are identical
○ d) None of the above
Answer: b) When A → B and B is not a subset of A
Explanation: A non-trivial dependency exists when the dependent attribute is not
a subset of the determinant.
94. Which dependency indicates redundancy in a table?
○ a) Multivalued dependency
○ b) Trivial dependency
○ c) Partial dependency
○ d) None of the above
Answer: c) Partial dependency
Explanation: Partial dependency can lead to data redundancy because an
attribute depends on only part of a composite primary key.
95. What is normalization in database design?
○ a) Compressing data
○ b) Removing data
○ c) Organizing data to reduce redundancy
○ d) None of the above
Answer: c) Organizing data to reduce redundancy
Explanation: Normalization is the process of structuring data to minimize
redundancy and dependency anomalies.
96. What is the main goal of normalization?
○ a) Increase query complexity
○ b) Ensure data integrity and reduce redundancy
○ c) Reduce database size
○ d) All of the above
Answer: b) Ensure data integrity and reduce redundancy
Explanation: The primary goal of normalization is to eliminate redundancy and
ensure consistency in data.
97. Which of the following is NOT a normal form?
○ a) 1NF
○ b) 3.5NF
○ c) 2NF
○ d) BCNF
Answer: b) 3.5NF
Explanation: The common normal forms are 1NF, 2NF, 3NF, BCNF, and higher
normal forms like 4NF and 5NF.
98. Which normalization form ensures the removal of multivalued attributes?
○ a) 1NF
○ b) 2NF
○ c) 3NF
○ d) 4NF
Answer: a) 1NF
Explanation: 1NF eliminates multivalued attributes and ensures that each cell
contains atomic values.
99. What is the purpose of 2NF in normalization?
○ a) Eliminate transitive dependency
○ b) Remove partial dependency
○ c) Ensure no duplicate rows
○ d) None of the above
Answer: b) Remove partial dependency
Explanation: 2NF removes partial dependencies by ensuring that non-prime
attributes depend on the whole primary key.
100. What condition must a table satisfy to be in 1NF?
○ a) No multivalued attributes
○ b) No partial dependencies
○ c) No transitive dependencies
○ d) Must have a primary key
Answer: a) No multivalued attributes
Explanation: 1NF ensures that each attribute contains atomic (indivisible)
values.
101. What is a partial dependency?
○ a) Dependency where a non-prime attribute depends on the whole primary key
○ b) Dependency where a non-prime attribute depends on part of a composite
primary key
○ c) Dependency where all attributes depend on each other
○ d) None of the above
Answer: b) Dependency where a non-prime attribute depends on part of a
composite primary key
Explanation: Partial dependency occurs when a non-prime attribute depends on
only part of a composite key.
102. What condition must a table satisfy to be in 2NF?
○ a) Be in 1NF and have no multivalued attributes
○ b) Be in 1NF and have no partial dependencies
○ c) Be in 3NF and have no transitive dependencies
○ d) None of the above
Answer: b) Be in 1NF and have no partial dependencies
Explanation: 2NF eliminates partial dependencies in addition to satisfying the
conditions of 1NF.
103. Which normal form addresses transitive dependency?
○ a) 1NF
○ b) 2NF
○ c) 3NF
○ d) 4NF
Answer: c) 3NF
Explanation: 3NF eliminates transitive dependencies, ensuring that non-prime
attributes depend only on the primary key.
104. What is Boyce-Codd Normal Form (BCNF)?
○ a) A stricter version of 1NF
○ b) A stricter version of 3NF
○ c) The highest normal form
○ d) None of the above
Answer: b) A stricter version of 3NF
Explanation: BCNF is a refinement of 3NF, ensuring that every determinant is a
candidate key.
105. Which normal form deals with multivalued dependencies?
○ a) 4NF
○ b) 2NF
○ c) BCNF
○ d) 3NF
Answer: a) 4NF
Explanation: 4NF eliminates multivalued dependencies, which occur when one
attribute determines multiple independent attributes.
106. What is a multivalued dependency?
○ a) When one attribute determines another attribute
○ b) When one attribute determines multiple independent attributes
○ c) When multiple attributes determine a single attribute
○ d) None of the above
Answer: b) When one attribute determines multiple independent attributes
Explanation: Multivalued dependency occurs when an attribute is dependent on
another attribute but is independent of other attributes.
107. Which normal form deals with join dependencies?
○ a) 5NF
○ b) 4NF
○ c) BCNF
○ d) 2NF
Answer: a) 5NF
Explanation: 5NF eliminates join dependencies to ensure lossless
decomposition.
108. What is a transitive dependency?
○ a) A → B and B → C implies A → C
○ b) A → A
○ c) A → C only
○ d) None of the above
Answer: a) A → B and B → C implies A → C
Explanation: Transitive dependency occurs when one attribute depends on
another through an intermediate attribute.
109. What does denormalization mean?
○ a) Reducing redundancy
○ b) Reintroducing redundancy for performance
○ c) Removing keys
○ d) Combining tables permanently
Answer: b) Reintroducing redundancy for performance
Explanation: Denormalization involves adding redundancy back into a
normalized database to improve performance.
110. Which of the following is NOT one of the ACID properties of a database?
○ a) Atomicity
○ b) Consistency
○ c) Isolation
○ d) Duplication
Answer: d) Duplication
Explanation: ACID properties ensure that database transactions are processed
reliably. They stand for Atomicity, Consistency, Isolation, and Durability.
111. What does the Atomicity property ensure?
○ a) The database will always remain in a valid state.
○ b) A transaction is either fully completed or not executed at all.
○ c) Transactions can be executed concurrently.
○ d) Changes to the database are permanent.
Answer: b) A transaction is either fully completed or not executed at all.
Explanation: Atomicity ensures that a transaction is indivisible; it is either fully
completed or fully rolled back.
112. Which of the following is true about the Consistency property of ACID?
○ a) Ensures the database remains in a valid state before and after the transaction.
○ b) Guarantees that the transaction is completed successfully.
○ c) Ensures that transactions can be rolled back.
○ d) None of the above.
Answer: a) Ensures the database remains in a valid state before and after the
transaction.
Explanation: The Consistency property ensures that a transaction only brings
the database from one valid state to another valid state.
113. What is the purpose of the Isolation property?
○ a) Ensures that the database is consistent.
○ b) Ensures that transactions do not interfere with each other.
○ c) Guarantees that all changes are permanent.
○ d) Enables users to see changes from all transactions simultaneously.
Answer: b) Ensures that transactions do not interfere with each other.
Explanation: Isolation ensures that transactions executed concurrently do not
result in conflicting outcomes.
114. What does the Durability property guarantee?
○ a) The transaction is executed correctly.
○ b) The database is always consistent after a transaction.
○ c) Changes to the database are permanent, even in case of a failure.
○ d) Transactions can be rolled back.
Answer: c) Changes to the database are permanent, even in case of a failure.
Explanation: Durability ensures that once a transaction has been committed, the
changes are permanent, and they survive system crashes or failures.
115. Which SQL statement is used to combine rows from two or more tables based
on a related column?
○ a) SELECT
○ b) JOIN
○ c) MERGE
○ d) UNION
Answer: b) JOIN
Explanation: The JOIN clause is used to combine rows from two or more tables
based on a related column.
116. Which type of join returns all rows from the left table and the matched rows
from the right table? If there’s no match, NULL values are returned for columns
from the right table.
○ a) INNER JOIN
○ b) LEFT JOIN
○ c) RIGHT JOIN
○ d) FULL JOIN
Answer: b) LEFT JOIN
Explanation: A LEFT JOIN returns all rows from the left table and the matched
rows from the right table. If there’s no match, NULL values are returned for the
right table columns.
117. Which type of join returns only the rows where there is a match in both tables?
○ a) LEFT JOIN
○ b) RIGHT JOIN
○ c) INNER JOIN
○ d) FULL JOIN
Answer: c) INNER JOIN
Explanation: An INNER JOIN returns only the rows where there is a match in
both tables.
118. Which of the following SQL joins would return all records when there is a
match in either left or right table?
○ a) INNER JOIN
○ b) LEFT JOIN
○ c) RIGHT JOIN
○ d) FULL JOIN
Answer: d) FULL JOIN
Explanation: A FULL JOIN returns all rows when there is a match in either the
left or right table, and NULLs are returned where there is no match.
119. Which SQL statement is used to join tables where one of the tables contains
null values for the join column?
○ a) LEFT JOIN
○ b) RIGHT JOIN
○ c) CROSS JOIN
○ d) FULL JOIN
Answer: a) LEFT JOIN
Explanation: A LEFT JOIN is used to return all records from the left table, and
matching records from the right table, even if the right table contains null values.
120. Which SQL window function returns a cumulative sum of a column in a result
set?
○ a) SUM()
○ b) ROW_NUMBER()
○ c) COUNT()
○ d) SUM() OVER()
Answer: d) SUM() OVER()
Explanation: SUM() OVER() is used to calculate the cumulative sum of a
column in a result set.
121. What does the ROW_NUMBER() window function do?
○ a) Returns the rank of a row in a partitioned result set.
○ b) Returns a unique number to each row in the result set.
○ c) Returns the total number of rows.
○ d) Returns a count of non-null values.
Answer: b) Returns a unique number to each row in the result set.
Explanation: The ROW_NUMBER() function assigns a unique sequential integer
to rows in a result set.
122. Which SQL function is used to calculate the running total of a column?
○ a) RANK()
○ b) CUME_DIST()
○ c) SUM() OVER()
○ d) COUNT() OVER()
Answer: c) SUM() OVER()
Explanation: SUM() OVER() is used to calculate the cumulative sum or running
total for a column in a result set.
123. Which SQL function is used to calculate the percentage of rows in the current
partition that are less than or equal to the current row’s value?
○ a) PERCENT_RANK()
○ b) RANK()
○ c) CUME_DIST()
○ d) NTILE()
Answer: c) CUME_DIST()
Explanation: CUME_DIST() calculates the cumulative distribution of a value in a
partition, returning the percentage of rows less than or equal to the current row.
124. What does the LEAD() window function do?
○ a) Provides the value of a column from the previous row.
○ b) Provides the value of a column from the next row.
○ c) Provides a cumulative total.
○ d) Returns the row number.
Answer: b) Provides the value of a column from the next row.
Explanation: The LEAD() function provides access to the next row's value in the
result set.
125. What does the LAG() window function do?
○ a) Provides the value of a column from the previous row.
○ b) Provides the value of a column from the next row.
○ c) Returns the rank of each row.
○ d) Provides a cumulative sum.
Answer: a) Provides the value of a column from the previous row.
Explanation: The LAG() function provides access to the previous row’s value in
the result set.
126. Which window function assigns a rank to each row within a partition of a result
set?
○ a) RANK()
○ b) DENSE_RANK()
○ c) ROW_NUMBER()
○ d) NTILE()
Answer: a) RANK()
Explanation: RANK() assigns a rank to each row, with gaps in the rank values if
there are ties.
127. Which SQL window function assigns a dense rank to each row within a
partition?
○ a) RANK()
○ b) DENSE_RANK()
○ c) ROW_NUMBER()
○ d) NTILE()
Answer: b) DENSE_RANK()
Explanation: DENSE_RANK() assigns a rank to each row, but unlike RANK(), it
does not leave gaps when there are ties.
128. Which SQL function is used to divide the result set into a specified number of
roughly equal groups?
○ a) NTILE()
○ b) RANK()
○ c) ROW_NUMBER()
○ d) CUME_DIST()
Answer: a) NTILE()
Explanation: NTILE() divides the result set into the specified number of groups
and assigns a bucket number to each row.
129. What is the purpose of the PARTITION BY clause in a window function?
○ a) To group rows based on specific columns for the window function.
○ b) To sort the rows in the result set.
○ c) To calculate the running total of a column.
○ d) None of the above.
Answer: a) To group rows based on specific columns for the window function.
Explanation: The PARTITION BY clause divides the result set into partitions to
which the window function is applied.
130. What happens when two rows have the same value in a column that is being
ranked?
○ a) Both rows are assigned the same rank and the next row gets the next rank.
○ b) Both rows are assigned the same rank, and the next row gets the next
consecutive rank.
○ c) The second row is assigned a lower rank.
○ d) The second row is assigned a higher rank.
Answer: a) Both rows are assigned the same rank and the next row gets the
next rank.
Explanation: In RANK(), if two rows have the same value, they receive the
same rank, and the next row gets the rank that skips the next number.
131. How does DENSE_RANK() differ from RANK()?
○ a) DENSE_RANK() does not leave gaps in ranking for ties.
○ b) DENSE_RANK() assigns a unique rank to each row regardless of ties.
○ c) DENSE_RANK() assigns lower ranks to rows with NULL values.
○ d) None of the above.
Answer: a) DENSE_RANK() does not leave gaps in ranking for ties.
Explanation: Unlike RANK(), DENSE_RANK() does not leave gaps when there
are ties.
132. What is the default ordering of rows in the result set of a window function?
○ a) By the first column in the SELECT statement.
○ b) In ascending order based on the primary key.
○ c) The order is not specified unless an ORDER BY clause is provided.
○ d) By the last column in the SELECT statement.
Answer: c) The order is not specified unless an ORDER BY clause is provided.
Explanation: Unless an explicit ORDER BY clause is specified, the order of rows
in a window function is not defined.
133. Can window functions be used with aggregate functions like SUM() or
COUNT()?
○ a) Yes, window functions can operate with aggregate functions.
○ b) No, window functions can’t be used with aggregate functions.
○ c) Only with COUNT() function.
○ d) Only with SUM() function.
Answer: a) Yes, window functions can operate with aggregate functions.
Explanation: Window functions can be used with aggregate functions to perform
calculations like running totals, averages, and rankings over partitions of data.
134. What is the purpose of the ROWS BETWEEN clause in a window function?
○ a) To specify which rows should be included in the window for the calculation.
○ b) To specify how many rows are included in the result set.
○ c) To partition rows based on specified conditions.
○ d) To define a sorting order.
Answer: a) To specify which rows should be included in the window for the
calculation.
Explanation: ROWS BETWEEN defines the range of rows to consider within the
window for a calculation, such as a moving average or cumulative sum.
135. What is cache memory used for in a computer system?
○ a) Storing primary data
○ b) Storing frequently accessed data to reduce latency
○ c) Increasing the CPU’s clock speed
○ d) Storing secondary data
Answer: b) Storing frequently accessed data to reduce latency
Explanation: Cache memory stores frequently accessed data to reduce the time
the CPU takes to access data from the main memory, improving performance.
136. Which of the following is NOT a common cache replacement policy?
○ a) Least Recently Used (LRU)
○ b) First In, First Out (FIFO)
○ c) Random Replacement
○ d) Most Recently Used (MRU)
Answer: d) Most Recently Used (MRU)
Explanation: MRU is not a common cache replacement policy. LRU, FIFO, and
Random are widely used strategies to manage cache memory.
137. In a direct-mapped cache, how is data stored and retrieved?
○ a) Data is stored and retrieved by hashing the memory address
○ b) Data is stored at a specific location based on part of the memory address
○ c) Data is retrieved by searching the entire cache memory
○ d) Data is stored in a round-robin fashion
Answer: b) Data is stored at a specific location based on part of the memory
address
Explanation: In direct-mapped caches, a specific block of memory is mapped to
a particular cache line based on the address, usually the index part of the
memory address.
138. What is the main disadvantage of using FIFO cache replacement policy?
○ a) It doesn’t always replace the least recently used cache block.
○ b) It requires extra hardware.
○ c) It has high computational overhead.
○ d) It is complex to implement.
Answer: a) It doesn’t always replace the least recently used cache block.
Explanation: FIFO replaces the oldest cache block, which may not necessarily
be the least recently used, leading to inefficient cache utilization in some cases.
139. Which cache replacement policy assumes that the least recently used cache
entry is the most likely to be replaced?
○ a) Random Replacement
○ b) Least Recently Used (LRU)
○ c) First In, First Out (FIFO)
○ d) Most Recently Used (MRU)
Answer: b) Least Recently Used (LRU)
Explanation: LRU replaces the cache block that hasn’t been used for the longest
time, assuming it will not be used in the near future.
140. Which of the following statements is true about cache coherence in a
multi-core system?
○ a) Cache coherence ensures that all cache copies of data are identical.
○ b) Cache coherence allows different cores to maintain independent caches.
○ c) Cache coherence ensures that memory is only updated in the main memory.
○ d) Cache coherence doesn’t impact multi-core systems.
Answer: a) Cache coherence ensures that all cache copies of data are identical.
Explanation: Cache coherence ensures that when multiple processors or cores
have copies of the same memory block in their caches, all copies are consistent.
141. Which of the following is a strategy used in a write-back cache?
○ a) Writing data to memory immediately after a cache miss.
○ b) Writing data back to memory only when the cache block is replaced.
○ c) Not writing data back to memory.
○ d) Writing data back to memory for every read operation.
Answer: b) Writing data back to memory only when the cache block is replaced.
Explanation: In a write-back cache, data is written back to the main memory only
when the cache block is evicted, improving performance by reducing memory
writes.
142. What does a fully associative cache mean?
○ a) Any memory block can be placed in any cache line.
○ b) Memory blocks are assigned to specific cache lines based on the address.
○ c) Data is accessed sequentially from cache.
○ d) Cache lines are organized in a circular fashion.
Answer: a) Any memory block can be placed in any cache line.
Explanation: In a fully associative cache, any memory block can be stored in
any cache line, and the cache controller searches the entire cache to locate the
data.
143. What is a potential disadvantage of having a larger cache?
○ a) Higher cost and increased complexity.
○ b) Slower access times.
○ c) Increased miss rates.
○ d) Inability to store more data.
Answer: a) Higher cost and increased complexity.
Explanation: While larger caches can improve performance, they are more
expensive and require more complex control logic and hardware.
144. In a set-associative cache, what is a cache line?
○ a) The entire memory block in cache.
○ b) A location that holds a part of memory data.
○ c) A single bit in memory.
○ d) A set of cache blocks that store related data.
Answer: b) A location that holds a part of memory data.
Explanation: In set-associative caches, a cache line holds a portion of memory
data, and a set consists of multiple cache lines.
145. What is the primary purpose of Access Control in an operating system?
○ a) To manage the memory of the system
○ b) To ensure authorized users and processes access system resources
○ c) To handle user authentication
○ d) To monitor system performance
Answer: b) To ensure authorized users and processes access system resources
Explanation: Access control is used to manage who can access system
resources, ensuring that only authorized users or processes are allowed access.
146. Which of the following is an example of authentication in an operating system?
○ a) User permissions
○ b) User password
○ c) System audit logs
○ d) File encryption
Answer: b) User password
Explanation: Authentication is the process of verifying the identity of a user or
process, and a password is a common method used for this purpose.
147. What is the purpose of the principle of least privilege?
○ a) Allowing all users to have the highest level of access
○ b) Limiting user access to the minimum necessary for their tasks
○ c) Allowing users to access all system resources freely
○ d) Granting users additional privileges when required
Answer: b) Limiting user access to the minimum necessary for their tasks
Explanation: The principle of least privilege ensures that users have only the
access rights they need for their tasks, reducing the risk of unauthorized access.
148. What is the purpose of access control lists (ACLs)?
○ a) To define who can access files and directories
○ b) To store user authentication data
○ c) To log system activities
○ d) To manage the system clock
Answer: a) To define who can access files and directories
Explanation: ACLs are used to specify which users or processes have access to
specific resources, like files and directories, and what operations they can
perform.
149. Which of the following is an example of multi-factor authentication?
○ a) Using only a password
○ b) Using a password and a fingerprint scan
○ c) Using a single password for multiple systems
○ d) Using a username and a password
Answer: b) Using a password and a fingerprint scan
Explanation: Multi-factor authentication requires two or more forms of
verification, such as something you know (password) and something you are
(fingerprint).
150. Which type of OS security attack involves intercepting and altering
communication between two systems?
○ a) Denial of Service (DoS)
○ b) Man-in-the-Middle (MitM)
○ c) Phishing
○ d) Buffer overflow
Answer: b) Man-in-the-Middle (MitM)
Explanation: A Man-in-the-Middle attack involves intercepting and potentially
altering the communication between two systems, compromising the integrity and
confidentiality of the data.
151. What is the role of Secure OS Design and Implementation?
○ a) To enhance system usability
○ b) To improve the performance of applications
○ c) To ensure that the operating system is designed to protect against security
vulnerabilities
○ d) To limit access to system resources
Answer: c) To ensure that the operating system is designed to protect against
security vulnerabilities
Explanation: Secure OS design involves building the operating system with
robust security features to minimize vulnerabilities that could be exploited by
attackers.
152. Which of the following is NOT a common type of malware?
○ a) Virus
○ b) Worm
○ c) Trojan horse
○ d) Firewall
Answer: d) Firewall
Explanation: A firewall is a security measure designed to protect against
malware, whereas viruses, worms, and Trojan horses are types of malware.
153. Which of the following is a common defense mechanism against malware?
○ a) Virus signature scanning
○ b) Disabling user authentication
○ c) Using weak encryption
○ d) Allowing all incoming network traffic
Answer: a) Virus signature scanning
Explanation: Virus signature scanning detects and removes malware based on
known patterns or signatures, providing a defense mechanism against malicious
software.
154. What is a buffer overflow attack?
○ a) An attack that exploits the system’s memory allocation by exceeding buffer
boundaries
○ b) An attack that overwhelms the system with traffic
○ c) An attack that modifies system logs
○ d) An attack that bypasses user authentication
Answer: a) An attack that exploits the system’s memory allocation by exceeding
buffer boundaries
Explanation: A buffer overflow occurs when more data is written to a buffer than
it can hold, potentially allowing an attacker to execute arbitrary code and gain
control over the system.
155. Which of the following access control models assigns access rights based on
the roles assigned to users?
● a) Discretionary Access Control (DAC)
● b) Role-Based Access Control (RBAC)
● c) Mandatory Access Control (MAC)
● d) Attribute-Based Access Control (ABAC)
Answer: b) Role-Based Access Control (RBAC)
Explanation: RBAC assigns access rights based on the roles assigned to users within
an organization, simplifying the management of user permissions by grouping them
based on their job functions.

You might also like