[go: up one dir, main page]

0% found this document useful (0 votes)
2 views7 pages

Qiuz 4

The document contains a series of multiple-choice questions related to SQL and database concepts, covering topics such as table creation, data types, constraints, and database architecture. Each question provides four options with the correct answers indicated. The content serves as a quiz or study guide for individuals learning about SQL and databases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views7 pages

Qiuz 4

The document contains a series of multiple-choice questions related to SQL and database concepts, covering topics such as table creation, data types, constraints, and database architecture. Each question provides four options with the correct answers indicated. The content serves as a quiz or study guide for individuals learning about SQL and databases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

1.

What is the correct SQL syntax for creating a table with a primary key
and auto-increment?

A) CREATE TABLE table_name (id INT PRIMARY KEY AUTO_INCREMENT);


B) CREATE TABLE table_name (id INT PRIMARY KEY, AUTO_INCREMENT);
C) CREATE TABLE table_name (id PRIMARY KEY AUTO_INCREMENT INT);
D) CREATE TABLE table_name (id INT NOT NULL PRIMARY KEY
AUTO_INCREMENT);

2. Which of the following constraints ensures the integrity of the relationship


between two tables?

A) UNIQUE
B) FOREIGN KEY
C) NOT NULL
D) DEFAULT

3.Which of the following data types is used for representing currency values in
SQL?

A) NUMERIC
B) MONEY
C) DATE
D) DECIMAL

4.Which data type would be best for storing scientific measurements with
large precision in SQL?

A) DECIMAL
B) DOUBLE
C) NUMERIC
D) FLOAT

5.Which of the following SQL constraints is used to prevent duplicate entries


in a table while allowing NULL values?

A) UNIQUE
B) PRIMARY KEY
C) NOT NULL
D) CHECK

6.Which of the following is used to guarantee that a value in a column is within


a given range?

A) CHECK
B) UNIQUE
C) FOREIGN KEY
D) NOT NULL

7.What is the purpose of the DEFAULT constraint in SQL?

A) Automatically ensures data is unique.


B) Automatically assigns a value to the column if no value is specified.
C) Ensures a column cannot contain NULL values.
D) Automatically increments values in a column.

8.What type of data is typically stored in the CHAR data type?

A) Large text data


B) Fixed-length strings
C) Date values
D) Numeric data

9.What is the default value of an integer column with the AUTO_INCREMENT


attribute?

A) 1
B) NULL
C) 0
D) 10
Correct answer
A) 1

10.What does CRUD stand for in the context of databases?

A) Create, Read, Update, Delete


B) Create, Remove, Update, Delete
C) Change, Retrieve, Update, Delete
D) Copy, Read, Update, Delete

11.Which of the following is an example of a relational database?

A) MongoDB
B) MySQL
C) Cassandra
D) Firebase
12.What does a relational database use to establish relationships between
tables?

A) Primary key
B) Index
C) Foreign key
D) Constraints

13.What does the ACID property in databases stand for?

A) Atomicity, Consistency, Isolation, Durability


B) Accuracy, Consistency, Isolation, Durability
C) Atomicity, Consistency, Information, Durability
D) Atomicity, Conversion, Isolation, Durability

14.Which of the following best describes a NoSQL document store database?

A) Stores data in rows and columns


B) Stores data in key-value pairs
C) Stores data in documents (e.g., JSON)
D) Stores data in tabular format

Correct answer
C) Stores data in documents (e.g., JSON)

15.Which of the following SQL statements is used to remove a table from a


database?

A) DELETE
B) REMOVE
C) DROP TABLE
D) ALTER TABLE

16.In a database system, the term "database instance" refers to which of the
following?

A) The actual database structure, including all tables and relationships


B) The system that manages and monitors the database
C) The data stored in the database at a particular moment in time

D) The backup copy of the database

17.What does the term 'schema' refer to in a database context?


A) The actual data stored in the database
B) The blueprint or structure of the database, including tables, columns, and
relationships

C) The index or search optimization of the database


D) The program used to manage the database

18.What is a primary key in a relational database?*

A) A column that uniquely identifies each row in a table

B) A column that stores large text data


C) A type of foreign key
D) A key used for encryption

19.Which of the following is the correct way to insert a new record into a table
named students?*

A) INSERT INTO students VALUES ('John', 'Doe', 20);

B) INSERT students INTO ('John', 'Doe', 20);


C) ADD INTO students ('John', 'Doe', 20);
D) INSERT ('John', 'Doe', 20) INTO students;

20.How do you add a comment in SQL for multiple lines?*

A) /* comment */
B) -- comment --
C) /* comment
D) // comment

Correct answer
A) /* comment */

21.Which of the following is NOT a valid SQL data type?*

A) VARCHAR
B) INT
C) DECIMAL
D) IMAGE
22.Which of the following SQL functions is used to calculate the total sum of a
column in a table?*

A) COUNT()
B) MAX()
C) SUM()

D) AVG()

23.Which of the following SQL clauses is used to remove duplicates from the
results of a query?*

A) REMOVE
B) UNIQUE
C) DISTINCT

D) UNIQUE RECORD

24.Which of the following commands is used to remove all records from a


table in MySQL without deleting the table?*

A) DELETE
B) TRUNCATE

C) REMOVE
D) DROP

25.What is a document database?*

A) A database that stores data in tables and rows


B) A database that stores data in a format similar to XML or JSON

C) A database that stores data in key-value pairs


D) A database that uses a relational structure to store data

26.Which of the following is an example of a popular document-based NoSQL


database?*
A) MySQL
B) MongoDB

C) PostgreSQL
D) SQLite

27.What does BSON stand for in MongoDB?*

A) Binary Structured Object Notation


B) Binary String Object Notation
C) Binary JSON (JavaScript Object Notation)

D) Binary SQL Object Notation

28.Which of the following is a correct method to insert multiple documents in


MongoDB?*

A) db.collection.insert()
B) db.collection.insertMany()

C) db.collection.insertDocuments()
D) db.collection.addDocuments()

29.What are the three levels of DBMS architecture?*

A) Physical, Logical, and View

B) Conceptual, External, and Internal


C) Physical, External, and Conceptual
D) Logical, View, and Internal

Correct answer
B) Conceptual, External, and Internal

30.Which of the following is responsible for controlling access to data in a


database system?*

A) Database Administrator (DBA)

B) End User
C) Data Analyst
D) Database Query Processor

You might also like