Homework1 DB programming
Homework1 DB programming
Exercise 1
Multiple-Choice Questions (MCQs)
1. What is the purpose of Data Definition Language (DDL)?
a) Retrieve data
b) Define and manage database structure
c) Control access to data
d) Insert new data
Answer:
2. Which of the following is a DDL operation?
a) SELECT
b) UPDATE
c) CREATE
d) INSERT
Answer:
3. What is the basic unit of storage in a database?
a) Table
b) Column
c) Sequence
d) Index
Answer:
1
2
2
3
d) Retrieve data
Answer:
11. Which statement removes all rows but keeps the structure of the table?
a) DELETE
b) DROP
c) TRUNCATE
d) REMOVE
Answer: c
12. Which data type is best for storing large binary data such as images?
a) VARCHAR2
b) NUMBER
c) BLOB
d) CLOB
Answer:
13. Which command adds a new column to an existing table?
a) ALTER TABLE and ADD COLUMN
b) ALTER TABLE
c) MODIFY COLUMN
d) DROP COLUMN
Answer:
14. Which command is used to delete a table from the database?
a) DROP TABLE
b) DELETE TABLE
c) REMOVE TABLE
d) CLEAR TABLE
Answer:
15. Which statement changes the structure of an existing table?
a) CREATE TABLE
b) ALTER TABLE
c) DELETE TABLE
d) TRUNCATE TABLE
Answer:
16. What is the default value used in a CREATE TABLE statement?
a) An expression or function
b) A column from another table
c) Any pseudo column
d) A random number
Answer:
3
4
Exercise 2
True/False Questions
1. DDL commands can be used to modify existing rows.
Answer:
2. A PRIMARY KEY constraint automatically enforces NOT NULL.
Answer:
3. The DROP TABLE command removes both data and the table structure.
Answer:
4. A UNIQUE constraint allows duplicate values.
Answer:
5. A column must be specified when using the DELETE statement.
Answer:
4
5
5
6
Exercise 3
Match each SQL keyword in Column B with the appropriate description number in Column A.
Write the corresponding number in the space provided in Column C.