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

DBMS MCQ

Uploaded by

rakshaamin02
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)
15 views

DBMS MCQ

Uploaded by

rakshaamin02
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/ 32

DBMS MCQ

This section of interview questions and answers focuses on "Database


Management System". One shall practice these interview questions to
improve their concepts for various interviews such as campus interviews,
walk-in interviews, company interviews, placements, entrance exams and
other competitive exams.
1) Which of the following is generally used for performing tasks like creating
the structure of the relations, deleting relation?
1. DML(Data Manipulation Language)
2. Query
3. Relational Schema
4. DDL(Data Definition Language)
Hide Answer Workspace
Answer: D
Explanation: The term "DDL" stands for Data Definition Language, used to
perform all other essential tasks such as deleting relation and related
schemas in defining the structure relation.

2) Which of the following provides the ability to query information from the
database and insert tuples into, delete tuples from, and modify tuples in the
database?
1. DML(Data Manipulation Language)
2. DDL(Data Definition Language)
3. Query
4. Relational Schema
Hide Answer Workspace
Answer: A
Explanation: The term "DML" stands for the Data Manipulation Language
used to perform the required changes in the relation's values.

3) The given Query can also be replaced with_______:


1. SELECT name, course_id
2. FROM instructor, teaches
3. WHERE instructor_ID= teaches_ID;
1. Select name,course_id from teaches,instructor where
instructor_id=course_id;
2. Select name, course_id from instructor natural join teaches;
3. Select name, course_id from instructor;
4. Select course_id from instructor join teaches;
Hide Answer Workspace
Answer: B
Explanation: Join clause joins two tables by matching the common column

4) Which one of the following given statements possibly contains the error?
1. select * from emp where empid = 10003;
2. select empid from emp where empid = 10006;
3. select empid from emp;
4. select empid where empid = 1009 and Lastname = 'GELLER';
Hide Answer Workspace
Answer: D
Explanation: The Query given in option D does not contain the "from"
clause, which specifies the relation from which the values have to be selected
or fetched. Therefore the correct answer is D.

5) Ready the Query carefully:


1. SELECT emp_name
2. FROM department
3. WHERE dept_name LIKE ' _____ Computer Science';
In the above-given Query, which of the following can be placed in the Query's
blank portion to select the "dept_name" that also contains Computer Science
as its ending string?
1. &
2. _
3. %
4. $
Hide Answer Workspace
Answer: C
Explanation: In the above-given Query, the "%" (like) operator will be used,
which is generally used while searching for a certain pattern in the strings. It
represents the single and multiple characters. In this case, it used with
"Where "louse to select the "dept_name" that contains the Computer Since as
its ending string. To understand it more clearly, consider the following
syntax:
Syntax

SELECT column1, column2, ...


FROM table_name
WHERE columnN LIKE pattern;

6) What do you mean by one to many relationships?


1. One class may have many teachers
2. One teacher can have many classes
3. Many classes may have many teachers
4. Many teachers may have many classes
Hide Answer Workspace
Answer: B
Explanation: We can understand the "one to many" relationship as a
teacher who may have more than one class to attend.

7) In the following Query, which of the following can be placed in the Query's
blank portion to display the salary from highest to lowest amount, and sorting
the employs name alphabetically?
1. SELECT *
2. FROM instructor
3. ORDER BY salary ____, name ___;
1. Ascending, Descending
2. Asc, Desc
3. Desc, Asc
4. All of the above
Hide Answer Workspace
Answer: C
Explanation: To sort the salary from highest to lowest amount and display
the employee's name alphabetically, one can use the "Desc and Asc" in the
above-given Query.

8) The given Query can be replaced with ____________:


1. SELECT name
2. FROM instructor1
3. WHERE salary <= 100000 AND salary >= 90000;
a.
1. SELECT name
2. FROM instructor1
3. WHERE salary BETWEEN 100000 AND 90000
b.
1. SELECT name
2. FROM instructor|
3. WHERE salary BETWEEN 90000 AND 100000;
c.
1. SELECT name
2. FROM instructor1
3. WHERE salary BETWEEN 90000 AND 100000;
d.
1. SELECT name
2. FROM instructor!
3. WHERE salary <= 90000 AND salary>=100000;

Hide Answer Workspace


Answer: C
Explanation: The "SQL" contains a comparison known as the "BETWEEN,"
which is also used in one of the given queries, as you can see. The
"BETWEEN" operator is generally used to simplify the "WHERE" clause that is
used to specify that the value is greater than one value or greater than some
values, less than one or more values.

9) A Database Management System is a type of _________software.


1. It is a type of system software
2. It is a kind of application software
3. It is a kind of general software
4. Both A and C
Hide Answer Workspace
Answer: A
Explanation: The DBMS (or Database Management System) is a kind of
system software used for several operations such as creating
tables/databases, storing data, managing databases. It also allows modifying
the data stored in the database as well.

10) The term "FAT" is stands for_____


1. File Allocation Tree
2. File Allocation Table
3. File Allocation Graph
4. All of the above
Hide Answer Workspace
Answer: B
Explanation: The term "FAT" can be described as a file structure (or file
architecture). In which all the information about the files where they are
stored and where all these files need to be stored or in which directory, all
that information generally stored in the file structure. Therefore the
Operating system creates a table in which all the files and clusters are stored,
known as the file allocation table.

11) Which of the following can be considered as the maximum size that is
supported by FAT?
1. 8GB
2. 4GB
3. 4TB
4. None of the above
Hide Answer Workspace
Answer: B
Explanation: The files with a size of less than 4 GB or equal to 4GB are
easily supported by the FAT. All files with a size greater than the maximum
size (or is 4Gb) are not supported by the FAT.

12) The term "NTFS" refers to which one of the following?


1. New Technology File System
2. New Tree File System
3. New Table type File System
4. Both A and C
Hide Answer Workspace
Answer: A
Explanation: In the old operating systems, the file structure used to store
and manage files is called the FAT 32 ( or File Allocation Table). Later, when
the technology evolves with time, a new type of file system is introduced,
known as the New Technology File System. It overcomes all the drawbacks,
issues that exist in FAT file architecture and has many other new features
such as it is fast, it can handle files whose size is even greater than 4 GB.
13) Which of the following can be considered as the maximum size that is
supported by NTFS?
1. 4GB
2. 16TB
3. 64TB
4. 8TB
Hide Answer Workspace
Answer: A
Explanation: The New Technology File System was introduced in 1993 for
the very first time as a part of new Windows operating systems (Windows NT
3.1).
You may be surprised to know that windows are still using it because of its
fast speed and can support files whose size is up to 16TB (16 terabytes),
which is much more than that file size supported by the old system.

14) A huge collection of the information or data accumulated form several


different sources is known as ________:
1. Data Management
2. Data Mining
3. Data Warehouse
4. Both B and C
Hide Answer Workspace
Answer: C
Explanation: A huge collection of different types of data/information which
collected from many different sources stored in one place is called a data
warehouse. It works just like the standard warehouse, which is generally a
type of holding area/building to store the different types of different goods in
huge quantities until they are further distributed. Therefore the correct
answer is Data Warehouse.

15) Which of the following can be used to extract or filter the data &
information from the data warehouse?
1. Data redundancy
2. Data recovery tool
3. Data mining
4. Both B and C
Hide Answer Workspace
Answer: C
Explanation: The tools used to obtain meaningful information or Data from
the large collection of data (or from the Data Warehouses) are known as the
Data mining tools. Through data mining, one can easily filter the useful
information or data from the massive collection of the data. Therefore the
correct answer is Data Mining.

16) Which one of the following refers to the copies of the same data (or
information) occupying the memory space at multiple places.
1. Data Repository
2. Data Inconsistency
3. Data Mining
4. Data Redundancy
Hide Answer Workspace
Answer: D
Explanation: The data redundancy generally occurs whenever more than
one copy of the exact same data exists in several different places.
Sometimes it may cause data inconsistency, which can result in an unreliable
source of data or information that is not good for anyone.

17) Which one of the following refers to the "data about data"?
1. Directory
2. Sub Data
3. Warehouse
4. Meta Data
Hide Answer Workspace
Answer: D
Explanation: The Mata Data refers to the type of data that describes the
other data or information.
A general file or document is nothing more than a sequence of bytes that
contains information like file name, file size, and date & time when the
document was created or modified.
To understand it in more details, consider the following example:
For a common music file, the metadata may include the singer's name, the
year it was released, and the lyrics, etc.

18) Which of the following refers to the level of data abstraction that
describes exactly how the data actually stored?
1. Conceptual Level
2. Physical Level
3. File Level
4. Logical Level
Hide Answer Workspace
Answer: B
Explanation: Data abstraction means displaying or sharing only the data
that is needed and hiding from all other data until it is necessary to share it.
However, the data abstraction level that describes how the data was actually
stored in the user's machine (or system) is known as the Physical level.
Therefore the correct answer is B.

19) To which of the following the term "DBA" referred?


1. Data Bank Administrator
2. Database Administrator
3. Data Administrator
4. None of the above
Hide Answer Workspace
Answer: B
Explanation: The term "DBA" refers to the Database Administrator that
manages the whole database and updates the database on a regular basis. In
short, the database administrator has the responsibility of the whole
database and to maintain it in an optimal & stable state.

20) In general, a file is basically a collection of all related______.


1. Rows & Columns
2. Fields
3. Database
4. Records
Hide Answer Workspace
Answer: D
Explanation: Whenever we have some related data, information or records,
we collect all those related data (or records), put them together, store them
in one place, and give that collection a name that is known as a file.

21) The term "Data" refers to:


1. The electronic representation of the information( or data)
2. Basic information
3. Row Facts and figures
4. Both A and C
Hide Answer Workspace
Answer: C
Explanation: In general, the term "data" refers to the row facts and figure,
whereas the information referred to as the data, which is really important for
someone or a particular person. Therefore the correct answer is C.

22) Rows of a relation are known as the _______.


1. Degree
2. Tuples
3. Entity
4. All of the above
Hide Answer Workspace
Answer: D
Explanation: In SQL, the relation is represented by a table, and a table is a
collection of rows and columns. Therefore the collection of rows & columns is
called the table, whereas a table is known as the relation in the SQL. So in a
relation (or we can say table), rows are called the tuples. So, the correct
answer will be tuples.

23) Which of the following refers to the number of tuples in a relation?


1. Entity
2. Column
3. Cardinality
4. None of the above
Hide Answer Workspace
Answer: C
Explanation: Cardinality refers to the number of tuples of relation because
cardinality represents the number of tuples in a relation.
To understand it in more detail, consider the following given
example:
Suppose we have a relation (or table) that contains 30 tuples (or Rows) and
four columns, so the cardinality of our relation will be 30.

24) Which one of the following is a type of Data Manipulation Command?


1. Create
2. Alter
3. Delete
4. All of the above
Hide Answer Workspace
Answer: C
Explanation: In data manipulation language, the command like select,
insert, update, and delete is used to manipulate the information (or data,
records), for example create a table, update table delete table, etc. Therefore
the correct answer is C.

25) Which of the following command is a type of Data Definition language


command?
1. Create
2. Update
3. Delete
4. Merge
Hide Answer Workspace
Answer: A
Explanation: The Data definition language is generally used to maintain or
define the structure of the database. For example, creating a table, drop
table, alter table. In short, we can say that the command of data definition
languages is used to work on the table's schemas inside the database.

26) Which of the following is a top-down approach in which the entity's higher
level can be divided into two lower sub-entities?
1. Aggregation
2. Generalization
3. Specialization
4. All of the above
Hide Answer Workspace
Answer: C
Explanation: In specialization, the top-down approach is used, and it is
apposite to the generalization.
In the specialization, the higher-level entity can be divided into sub lower
entities. It is generally used for identifying the subset of an entity set which
share the distinguishing characteristics.
To understand it more clearly, consider the following example:
Suppose you have an entity, e.g., A vehicle. So through the specialization,
you can be divided further into sub-entities like two-wheelers and four-
wheelers. Therefore the correct answer is C.
27) In which one of the following, the multiple lower entities are grouped (or
combined) together to form a single higher-level entity?
1. Specialization
2. Generalization
3. Aggregation
4. None of the above
Hide Answer Workspace
Answer: B
Explanation:
The bottom-up approach is used in the generalization. The several lower-level
sub-entities are grouped together to make an individual higher-level entity. In
short, we can say that it is totally the opposite of specialization. To
understand it more clearly, consider the following example:
Example
Suppose you have several lower entities like bus, car, motorbike etc. So, in
order to make a more generalize (or higher level ) entity, you can combine
them under a new higher-level entity such as a vehicle.

28) In a relation database, every tuples divided into the fields are known as
the______.
1. Queries
2. Domains
3. Relations
4. All of the above
Hide Answer Workspace
Answer: B
Explanation: In a database, the number of rows inside a table is known as
tuples, and if we further divide those tuples (or rows) into those fields, they
become the domains. So the correct answer will be B.

29) The term "TCL" stands for_____.


1. Ternary Control Language
2. Transmission Control Language
3. Transaction Central Language
4. Transaction Control Language
Hide Answer Workspace
Answer: D
Explanation: The term "TCL" refers to the Transaction Control Language,
which is another language just like the "DDL" and "DML". The commands like
commit, save point, rollback come under the TCL used to control the
transactions. Therefore the correct answer will be D.

30) In the relational table, which of the following can also be represented by
the term "attribute"?
1. Entity
2. Row
3. Column
4. Both B &C
Hide Answer Workspace
Answer: C
Explanation: In the database, the number of rows inside a table is called the
tuples, and the numbers of columns are known as the attributes. Therefore
the correct answer is C.

31) Which of the following refers to the number of attributes in a relation?


1. Degree
2. Row
3. Column
4. All of the above
Hide Answer Workspace
Answer: A
Explanation: The column inside the table is called the attribute, and the
total number of attributes inside the table is called the degree. So, here as
we can see, degree refers to the number of attributes in a relation. Therefore
the correct answer is C.

32) Which of the following is used in the application programs to request data
from the database management system?
1. Data Manipulation language
2. Data Definition Language
3. Data Control Language
4. All of the above
Hide Answer Workspace
Answer: A
Explanation: To fetch data from the database management system,
generally, the "select" statement is used. Therefore, the Data Manipulation
Language is used in the application programs while requesting the data from
the database management system.

33) Which one of the following command is used to delete the existing row in
a table?
1. Delete
2. Update
3. Insert
4. None of the above
Hide Answer Workspace
Answer: A
Explanation: To delete an existing row in a table the generally, the "delete"
command is used. The "delete" command is one of the commands that
belong to the Data manipulation language.

34) Which of the following commands is used to save any transaction


permanently into the database?
1. Commit
2. Rollback
3. Savepoint
4. None of the above
Hide Answer Workspace
Answer: A
Explanation: The Transaction Control Language is used while working with
the transactions. To save any transaction permanently into the database
generally, the "commit" command is used, by which any changes get
reflected permanently into the database, and they become irreversible.

35) Which one of the following commands is used for removing (or deleting) a
relation forms the SQL database?
1. Delete
2. Drop
3. Remove
4. All of the above
Hide Answer Workspace
Answer: B
Explanation: To removing( or deleting) a relation, the "drop" command is
used instead of delete because here we are working on the objects of the
database. So, to maintain the objects of a database, the Data definition
language is used. Therefore the "drop" command is used to delete a relation
form a database instead of using the "delete" command.

36) Which one of the following commands is used to restore the database to
the last committed state?
1. Savepoint
2. Rollback
3. Commit
4. Both A & B
Hide Answer Workspace
Answer: B
Explanation: As we all know that while working with the Transactions, the
Transaction Control Language is used. To restore the database to the last
committed state ( or to undo the latest changes), the "rollback" command is
used that belongs to the Transaction Control Language.

37) The database management system can be considered as the collection of


______ that enables us to create and maintain the database.
1. Translators
2. Programs
3. Keys
4. Language activity
Hide Answer Workspace
Answer: B
Explanation: The Database management system can also considered as the
set of programs that enables users to create and maintain the database.

38) The term "DFD" stands for?


1. Data file diagram
2. Data flow document
3. Data flow diagram
4. None of the above
Hide Answer Workspace
Answer: C
Explanation: The term"DFD" stands for the Data Flow Diagram, and to
represent the flow of the data( or information), the data flow diagram is used.
The data flow diagram also helps in understanding how the data is managed
in the application. Therefore the correct answer is C.

39) Which of the following refers collection of the information stored in a


database at a specific time?
1. Independence
2. Instance of the database
3. Schema
4. Data domain
Hide Answer Workspace
Answer: B
Explanation: The collection of data (or information) stored in a database at
a particular moment is known as the instance of the database. Therefore the
correct answer is B.

40) The term "SQL" stands for


1. Standard query language
2. Sequential query language
3. Structured query language
4. Server-side query language
Hide Answer Workspace
Answer: C
Explanation: The term "SQL" stands for the structured query language,
which is one of the most widely, used programming languages for relational
databases. It can also be used for managing and organizing data in all sorts
of systems in which different data relationships exist. Therefore the correct
answer is C.

41) The term "Data independence" refers to____


1. Data is defined separately and not included in the programs
2. Programs are not dependent on the logical attributes of the data
3. Programs are not dependent on the physical attributes of the data
4. Both B & C
Hide Answer Workspace
Answer:
Explanation: The term "Data independence" refers that the program should
not be dependent on either the logical attributes of data or physical
attributes of data.

42) What is the relation calculus?


1. It is a kind of procedural language
2. It is a non-procedural language
3. It is a high-level language
4. It is Data Definition language
Hide Answer Workspace
Answer: B
Explanation: In database management systems, relation calculus is a type
of non-procedural query language that describes what data needs to be
retrieved. However, it does not explain how to retrieve the data.

43) Which one of the following refers to the total view of the database
content?
1. Conceptual view
2. Physical view
3. Internal view
4. External view
Hide Answer Workspace
Answer: A
Explanation: The conceptual view refers to the total view of the content
available in the database. Therefore the correct answer is A.

44) For what purpose the DML is provided?


1. Addition of new structure in the database
2. Manipulation & processing of the database
3. Definition of the physical structure of the database system
4. All of the above
Hide Answer Workspace
Answer: B
Explanation: The term "DML" refers to the data manipulation language,
which is commonly used to perform basic operations such as insert data,
delete, and update data in a database. So the correct answer will be B.

45) The term "ODBC" stands for_____


1. Oral database connectivity
2. Oracle database connectivity
3. Open database connectivity
4. Object database connectivity
Hide Answer Workspace
Answer: C
Explanation: The term "ODBC" refers to the Open Database Connectivity
that is a SQL based programming interface introduced by Microsoft.

46) The architecture of a database can be viewed as the ________


1. One level
2. Two-level
3. Three-level
4. Four level
Hide Answer Workspace
Answer: C
Explanation: A database's architecture can be viewed as the three levels of
abstraction that are named as the internal level, external level, and the
conceptual level. Therefore the correct answer is C.

47) In the relation model, the relation are generally termed as ________
1. Tuples
2. Attributes
3. Rows
4. Tables
Hide Answer Workspace
Answer: D
Explanation: In the relation model, the relations are also referred to as the
tables because the relations are considered as the technical name of the
table. So the correct answer is D.

48) The Database Management Query language is generally designed for the
_____
1. Support end-users who use English like commands
2. Specifying the structure of the database
3. Support in the development of the complex applications software
4. All of the above
Hide Answer Workspace
Answer: D
Explanation: The database management query language is generally
designed by keeping in mind that it must support the end-users who are
familiar with the English-like commands. It should also boost the process of
development of the complex applications software and helps in specifying the
structure of the database.

49) Which of the following keys is generally used to represents the


relationships between the tables?
1. Primary key
2. Foreign key
3. Secondary key
4. None of the above
Hide Answer Workspace
Answer: B
Explanation: To represent the relationships between the various tables in
the database, generally, the foreign key is used. Therefore the correct answer
is the foreign key.

50) Which of the following levels is considered as the level closed to the end-
users?
1. Internal Level
2. External Level
3. Conceptual Level
4. Physical Level
Hide Answer Workspace
Answer: B
Explanation: The database's external level is the one and only level that is
considered the closest level to the end-users. So the correct answer will be
the B.

51) A computer security protocol for logging-in can be considered as the


example of the ______ component of an information system.
1. Data
2. Software
3. Procedure
4. Hardware
Hide Answer Workspace
Answer: C
Explanation: A computer security protocol for logging-in can be considered
as the procedure component of an information system. Therefore the correct
answer is C.

52) Which one of the following keyword is used to find out the number of
values in a column?
1. TOTAL
2. COUNT
3. SUM
4. ADD
Hide Answer Workspace
Answer: B
Explanation: The "COUNT" keyword is used to find the total number of
values inside a column. So whenever a user wants to find the total values in a
column, he can use the keyword "COUNT".

53) Which one of the following is commonly used to define the overall design
of the database?
1. Application program
2. Data definition language
3. Schema
4. Source code
Hide Answer Workspace
Answer: C
Explanation: In order to define the overall design of the database, generally,
the schema is used. Therefore the correct answer is C.

54) Which one of the following commands is used to modify a column inside a
table?
1. Drop
2. Update
3. Alter
4. Set
Hide Answer Workspace
Answer: C

SQL MCQ (Multiple Choice Questions)


Here we are going to see a list of important SQL questions in MCQ style with
an explanation of the answer for competitive exams and interviews. These
frequently asked SQL questions are given with the correct choice of answer
among multiple options. You can select your choice and check it instantly to
see the answer with an explanation.
1) What is the full form of SQL?
1. Structured Query List
2. Structure Query Language
3. Sample Query Language
4. None of these.
Hide Answer Workspace
Answer: B
Explanation: SQL is a programming language used for managing data in a
relational database management system. It is pronounced as See-Qwell.

2) Which of the following is not a valid SQL type?


1. FLOAT
2. NUMERIC
3. DECIMAL
4. CHARACTER
Hide Answer Workspace
Answer: C
Explanation:
DECIMAL is not a valid SQL type because it is nothing but numeric only in
SQL.
NUMERIC has fixed precision, and scale numbers range from -10^38+1 to
10^38-1.
FLOAT has floating precision number ranges from -1.79E + 308 to 1.79E +
308.
CHARACTER is a fixed-width character string data type that can be up to
8000 characters.

3) Which of the following is not a DDL command?


Backward Skip 10sPlay VideoForward Skip 10s
1. TRUNCATE
2. ALTER
3. CREATE
4. UPDATE
Hide Answer Workspace
Answer: D
Explanation: DDL commands are used to define the structure of the
database, table, schemas, etc. It enables us to perform the operations like
CREATE, DROP, ALTER, RENAME, and TRUNCATE schema objects.
An UPDATE command is used for managing the data stored in a database. It
is an example of a DML command that also includes the INSERT and DELETE
commands.

4) Which of the following are TCL commands?


1. COMMIT and ROLLBACK
2. UPDATE and TRUNCATE
3. SELECT and INSERT
4. GRANT and REVOKE
Hide Answer Workspace
Answer: A
Explanation: TCL stands for Transaction Control Commands used for
managing the changes made by DML commands like INSERT, DELETE, and
UPDATE. The TCL commands are automatically committed in the database;
that's why we cannot use them directly while creating tables or dropping
them.

5) Which statement is used to delete all rows in a table without having the
action logged?
1. DELETE
2. REMOVE
3. DROP
4. TRUNCATE
Hide Answer Workspace
Answer: D
Explanation: TRUNCATE statement removes all rows in a table without
logging the individual row deletions. It uses fewer system and transaction log
resources, which makes its execution fast. This statement is similar to the
DELETE statement without the WHERE clause.

6) SQL Views are also known as


1. Simple tables
2. Virtual tables
3. Complex tables
4. Actual Tables
Hide Answer Workspace
Answer: B
Explanation: A view is also known as a virtual table because it contains rows
and columns similar to a real table. It shows the table interface but cannot be
stored in a database.

7) How many Primary keys can have in a table?


1. Only 1
2. Only 2
3. Depends on no of Columns
4. Depends on DBA
Hide Answer Workspace
Answer: A
Explanation: The primary key can consist of a single or combination of the
field that uniquely identifies each record in a table. It cannot be null or
empty. A table may have duplicate columns, but it can contain only one
primary key.

8) Which datatype can store unstructured data in a column?


1. CHAR
2. RAW
3. NUMERIC
4. VARCHAR
Hide Answer Workspace
Answer: B
Explanation:
RAW datatype stores variable-length binary data that can be queried and
inserted but not manipulated. Its maximum length is 32767 bytes.
CHAR stores character data in a fixed length.
NUMERIC stores numeric values only.
VARCHAR stores variable string data in a fixed length. Its maximum length is
4000 bytes.

9) Which of the following is not Constraint in SQL?


1. Primary Key
2. Not Null
3. Check
4. Union
Hide Answer Workspace
Answer: D
Explanation:
Constraint specifies the rule to allow or restrict what data will be stored in a
table. The PRIMARY KEY, NOT NULL, and CHECK are the constraints that
specify rules for data insertion.
UNION is an operator that combines two or more results from multiple
SELECT queries into a single result set.

10) Which of the following is not a valid aggregate function?


1. COUNT
2. COMPUTE
3. SUM
4. MAX
Hide Answer Workspace
Answer: B
Explanation: Aggregate function is used to perform calculations on multiple
values and return the output in a single value. It is mostly used with the
SELECT statement. COUNT, SUM, and MAX are all aggregate functions.
COMPUTE is not an aggregate function. It is used to generate totals as an
additional column at the end of the result set.
11) Which data manipulation command is used to combines the records from
one or more tables?
1. SELECT
2. PROJECT
3. JOIN
4. PRODUCT
Hide Answer Workspace
Answer: C
Explanation: JOIN command is used with the SELECT statement to retrieve
data from multiple tables. It must be needed whenever we want to fetch
records from two or more tables.

12) Which operator is used to compare a value to a specified list of values?


1. ANY
2. BETWEEN
3. ALL
4. IN
Hide Answer Workspace
Answer: D
Explanation: The IN operator easily tests the expression if it matches any
value in a specified list of values. It reduces the use of multiple OR
conditions.
The WHERE or HAVING clause uses the ANY and ALL operators. ANY gives the
result when any subquery value matches the specified condition. The ALL
give the result when all subquery values match the specified condition.
The BETWEEN operator selects values only in the given range.

13) What operator tests column for absence of data


1. NOT Operator
2. Exists Operator
3. IS NULL Operator
4. None of the above
Hide Answer Workspace
Answer: C
Explanation: The IS NULL operator is used to testing the empty values in the
table's column. It returns true if column values are NULL.
The NOT operator gives the result only when the specified condition is not
true.
The EXISTS operator used in combination with a subquery, and if a subquery
returns any record, this operator returns true. Otherwise, it will return false.

14) In which of the following cases a DML statement is not executed?


1. When existing rows are modified.
2. When a table is deleted.
3. When some rows are deleted.
4. All of the above
Hide Answer Workspace
Answer: B
Explanation: The DML statement is used to access and manipulate the data
in an existing table. Therefore, it cannot be used in table deletion.

15) If we have not specified ASC or DESC after a SQL ORDER BY clause, the
following is used by default
1. DESC
2. ASC
3. There is no default value
4. None of the mentioned
Hide Answer Workspace
Answer: B
Explanation: If we have not specified any sorting with the ORDER BY clause,
SQL always uses the ASC as a default sorting order. SQL treats Null as the
lowest possible values while sorting.

16) Which of the following statement is true?


1. TRUNCATE free the table space while DELETE does not.
2. Both TRUNCATE and DELETE statements free the table's space.
3. Both TRUNCATE and DELETE statement does not free the table's
space.
4. DELETE free the table space while TRUNCATE does not.
Hide Answer Workspace
Answer: A
Explanation:
The TRUNCATE statement in SQL removes all data from the table and free
the table's space.
SQL's DELETE statement removes all data from the table but does not free
the table's space.

17) What is returned by INSTR ('JAVAT POINT', 'P')?


1. 6
2. 7
3. POINT
4. JAVAT
Show Answer Workspace

18) A command that lets you change one or more field in a table is:
1. INSERT
2. MODIFY
3. LOOK-UP
4. All of the above
Hide Answer Workspace
Answer: B
Explanation: The modify command is used to change one or more columns
in the existing table. It is generally used with ALTER TABLE statement as
follows.
LTER TABLE table_name MODIFY column_name column_type;

19) Which of the following is also called an INNER JOIN?


1. SELF JOIN
2. EQUI JOIN
3. NON-EQUI JOIN
4. None of the above
Hide Answer Workspace
Answer: B
Explanation: The INNER JOIN returns data from the two or more tables that
match the specified condition and hides other records. EQUI JOIN is similar to
INNER JOIN that returns records for equality or matching column(s) values of
the relative tables.
NON-EQUI JOIN is returned those records that are not matching in the relative
tables.
SELF JOIN returns records from the tables by joining itself.

20) Which of the following is true about the HAVING clause?


1. Similar to the WHERE clause but is used for columns rather than
groups.
2. Similar to WHERE clause but is used for rows rather than columns.
3. Similar to WHERE clause but is used for groups rather than rows.
4. Acts exactly like a WHERE clause.
Hide Answer Workspace
Answer: C
Explanation: The HAVING clause is always used with the GROUP BY clause
and returns the rows where the condition is TRUE.

21) _______ clause creates temporary relation for the query on which it is
defined.
1. WITH
2. FROM
3. WHERE
4. SELECT
Hide Answer Workspace
Answer: A
Explanation: The WITH clause in SQL allows us to provide a sub-query block,
a name that can be referenced in several places within the main query. It is
used for defining a temporary relation whose definition is available by the
query in which the WITH clause is associated.

22) The SQL statement:


1. SELECT ROUND (65.726, -1) FROM DUAL;
Prints:
1. is illegal
2. garbage
3. 726
4. 70
Hide Answer Workspace
Answer: D
Explanation: Here, the ROUND() function statement will produce the
rounded result of the given number 65.726 from the left of decimal point up
to 1.

23) Which of the following is true about the SQL AS clause?


1. The AS clause in SQL is used to change the column name in the
output or assign a name to a derived column.
2. The SQL AS clause can only be used with the JOIN clause.
3. The AS clause in SQL is used to defines a search condition.
4. All of the mentioned
Hide Answer Workspace
Answer: A
Explanation: SQL AS clauses are defined for columns and tables to give an
alias name. Basically, aliases are created to increase the readability of the
query and column headings in the output.

24) _________ command makes the updates performed by the transaction


permanent in the database?
1. ROLLBACK
2. COMMIT
3. TRUNCATE
4. DELETE
Hide Answer Workspace
Answer: B
Explanation:
The COMMIT statement is a transactional command used to end the current
transaction and make all changes performed in the transaction permanent.
The ROLLBACK statement is a transactional command used to back out or
cancels the current transaction changes and restores changed data in its
previous state.
TRUNCATE and DELETE are not transactional commands.

25) How can you change "Thomas" into "Michel" in the "LastName" column in
the Users table?
1. UPDATE User SET LastName = 'Thomas' INTO LastName = 'Michel'
2. MODIFY Users SET LastName = 'Michel' WHERE LastName =
'Thomas'
3. MODIFY Users SET LastName = 'Thomas' INTO LastName = 'Michel'
4. UPDATE Users SET LastName = 'Michel' WHERE LastName =
'Thomas'
Hide Answer Workspace
Answer: D
Explanation: The UPDATE statement is used for modifying the table data by
using the SET and WHERE clause. The SET clause is used to change the
values of the column specified in the WHERE clause. See the below syntax:

UPDATE table SET column1 = expression1, column2 = expression2,... WHERE


conditions

26) Which command is used to change the definition of a table in SQL?


1. CREATE
2. UPDATE
3. ALTER
4. SELECT
Hide Answer Workspace
Answer: C
Explanation: The ALTER statement is used to change our table's definition,
such as table name, column name, column constraint, etc. It also allows us to
add or delete an existing column in a table. This statement must be used
with ADD, DROP, and MODIFY clauses according to the situation.

27) Which type of JOIN is used to returns rows that do not have matching
values?
1. Natural JOIN
2. Outer JOIN
3. EQUI JOIN
4. All of the above
Hide Answer Workspace
Answer: B
Explanation:
OUTER JOIN is the only join that returned the unmatched rows in one or both
tables. It can be classified into the following types:
o LEFT JOIN that shows only the unmatched rows from the left table.
o RIGHT JOIN that shows only the unmatched rows from the right
table.
o FULL OUTER JOIN that shows the unmatched rows from both tables.
EQUI JOIN shows records for equality or matching column(s) values of the
relative tables.
A Natural join can only be performed if at least one common attribute exists
between two relations (the attributes should be the same name and domain).

28) A CASE SQL statement is ________?


1. A way to establish a loop in SQL.
2. A way to establish an IF-THEN-ELSE in SQL
3. A way to establish a data definition in SQL
4. All of the above.
Hide Answer Workspace
Answer: B
Explanation: A CASE statement is one of the control flow function that
allows us to write an if-else or if-then-else logic in a SQL query. This
expression validates various conditions and shows the output when the first
condition is true, and stops traversing. If any condition is not true, it executes
the else block. It shows a null value if the else block is not found.

29) Which statement is true regarding routines and triggers?


1. Both run automatically.
2. Both are stored in the database.
3. Both consist of procedural code.
4. Both have to be called to operate.
Hide Answer Workspace
Answer: C
Explanation:
Routines, also known as subroutines, are the group of multiple commands
that can be called whenever required.
Triggers are a special type of stored procedure containing a set of SQL
statements that will be fired automatically whenever any database event
occurs. It always resides in the system catalog.
So option C is the correct choice.

30) Which statement is true regarding procedures?


1. They include procedural and SQL statements.
2. They work similarly to the functions.
3. It does not need unique names.
4. It cannot be created with SQL statements.
Hide Answer Workspace
Answer: A
Explanation: A procedure is a prepared SQL code that can be saved in the
system and reused whenever needed. It can return one or more values
through parameters. So option A is the correct choice.

31) Which of the following is the basic approaches for joining tables?
1. Union JOIN
2. Natural JOIN
3. Subqueries
4. All of the above
Hide Answer Workspace
Answer: D
Explanation:
We already know that Union and Natural are the approaches for joining two
or more tables.
A subquery is a query nested into another SQL query. It can be embedded
with SELECT, INSERT, UPDATE or DELETE statement. A subquery is known as
the inner query. In many cases, we can use the subquery instead of a JOIN.
Therefore, option D is the correct choice.
32) Why we need to create an index if the primary key is already present in a
table?
1. Index improves the speed of data retrieval operations on a table.
2. Indexes are special lookup tables that will be used by the database
search engine.
3. Indexes are synonyms of a column in a table.
4. All of the above
Hide Answer Workspace
Answer: A
Explanation: When we define a primary key in a table, the Database Engine
enforces the data's uniqueness by creating a unique index for those columns.
This indexing process improves data retrieval when the primary key is used
in queries. Therefore, we need to create an index if a primary key is already
present in a table.

33) Group of operations that form a single logical unit of work is known as
1. View
2. Network
3. Unit
4. Transaction
Hide Answer Workspace
Answer: D
Explanation: A transaction is a sequential group of statements such as
select, insert, update or delete to perform as one single logical unit of work
that can be committed or rolled back

34) Shared locks are applied while performing


1. Read operations
2. Write operations
3. A & B both
4. None of the above
Hide Answer Workspace
Answer: A
Explanation: A shared lock can only be applied while reading or changing in
data is performed. It is also known as the READ lock. Therefore, option A is
the right choice.

35) Sequence can generate


1. Numeric value
2. Alphanumeric value
3. A & B both
4. None of the above
Hide Answer Workspace
Answer: C
Explanation: A sequence is an arrangement of integers that generates
unique values (numeric or alphanumeric) in ascending order on specific
demand.
36) A sequence in SQL can generate a maximum number:
1. 39 digits
2. 38 digits
3. 40 digits
4. 37 digits
Hide Answer Workspace
Answer: B
Explanation: The number generated using a sequence can have a maximum
of 38 digits.

37) Which of the following is the correct order of a SQL statement?


1. SELECT, GROUP BY, WHERE, HAVING
2. SELECT, WHERE, GROUP BY, HAVING
3. SELECT, HAVING, WHERE, GROUP BY
4. SELECT, WHERE, HAVING, GROUP BY
Hide Answer Workspace
Answer: B
Explanation: In SQL statements, the WHERE clause always comes before
GROUP BY, and the HAVING clause always comes after GROUP BY. Therefore,
option B is the correct choice.

38) What is the difference between a PRIMARY KEY and a UNIQUE KEY?
1. Primary key can store null value, whereas a unique key cannot store
null value.
2. We can have only one primary key in a table while we can have
multiple unique keys
3. Primary key cannot be a date variable whereas unique key can be
4. None of these
Hide Answer Workspace
Answer: B
Explanation:
The primary key is a single or combination of the field that identifies each
record in a table uniquely. It cannot take a NULL value. A table can have only
one primary key. Also, we can create a date variable as a primary key in a
table.
Unique key also determines each row of the table uniquely, but it can take
null value into. A table can have more than one unique key. We cannot create
a date variable as a unique key in a table.

39) Which of the following are the synonyms for Column and ROW of a table?
1. Row = [Tuple, Record]
2. Column = [Field, Attribute]
3. Row = [Tuple, Attribute]
4. Columns = [Field, Record]
1. 1 and 2
2. 3 and 4
3. Only 1
4. Only 2
Hide Answer Workspace
Answer: A
Explanation: In Database Management System (DBMS), we can say that
each record is also called a tuple and rows. And each column is called fields
and attributes.

40) Which operator is used to compare the NULL values in SQL?


1. Equal
2. IN
3. IS
4. None of Above
Hide Answer Workspace
Answer: C
Explanation:
In SQL, we can use the IS operator to compare a NULL. This operator can be
used with select, insert, update, and delete commands.
The IN is a conditional operator used to reduce the use of multiple OR
conditions in select, insert, update, and delete commands.
The EQUAL operator is used to check whether the given expressions are
equal or not. The condition becomes true if the expressions are equal and
then return matched records.

41) Which of the following statement is correct regarding the difference


between TRUNCATE, DELETE and DROP command?
I. DELETE operation can be rolled back but TRUNCATE and DROP operations
cannot be rolled back.
II. TRUNCATE and DROP operations can be rolled back but DELETE operations
cannot be rolled back.
III. DELETE is an example of DML, but TRUNCATE and DROP are examples of
DDL.
IV. All are an example of DDL.
1. I and III
2. II and III
3. II and IV
4. II and IV
Hide Answer Workspace
Answer: A
Explanation:
DELETE is used to remove existing records from the database. DELETE
command is a DML statement so that it can be rolled back.
DROP is used to delete the whole table, including its structure. DROP is a DDL
command that lost the data permanently, and it cannot be rolled back.
TRUNCATE is used to delete the whole records, but it preserves the table's
schema or structure. TRUNCATE is a DDL command, so it cannot be rolled
back.
Hence, option A is the correct answer.
42) Which of the following options are correct regarding these three keys
(Primary Key, Super Key, and Candidate Key) in a database?
I. Minimal super key is a candidate key
II. Only one candidate key can be a primary key
III. All super keys can be a candidate key
IV. We cannot find a primary key from the candidate key
1. I and II
2. II and III
3. I and III
4. II and IV
Hide Answer Workspace
Answer: A
Explanation: Candidate key in SQL is a set of fields that identify each record
in a table uniquely. It is a super key with no repeated fields that means the
minimal super key is a candidate key. A table can contain multiple candidate
keys, but it can have only a single primary key. Therefore option A is the
correct choice.

43) When the wildcard in a WHERE clause is useful?


1. When an exact match is required in a SELECT statement.
2. When an exact match is not possible in a SELECT statement.
3. When an exact match is required in a CREATE statement.
4. When an exact match is not possible in a CREATE statement.
Hide Answer Workspace
Answer: B
Explanation: The wildcard is a character used to search complex data from
the database quickly. We can use it in conjunction with the LIKE or NOT LIKE
comparison operators and the WHERE clause to find the result for a specified
pattern. Hence, the wildcard is very useful when the exact match is not
possible in the SELECT statement.

44) ______ is NOT a type of constraint in SQL language?


1. FOREIGN KEY
2. PRIMARY KEY
3. UNIQUE
4. ALTERNATE KEY
Hide Answer Workspace
Answer: D
Explanation: ALTERNATE KEY is a key associated with one or more columns
to identify each row in a table uniquely. If a table with one or more candidate
keys, then the keys other than the primary key is an alternate key. Since the
alternate key is a part of the candidate key, it is not a constraint in SQL.
Hence, option D is the correct choice.

45) Find the cities name with the condition and temperature from table
'whether' where condition = sunny or cloudy but temperature >= 60.
1. SELECT city, temperature, condition FROM weather WHERE
condition = 'cloudy' AND condition = 'sunny' OR temperature >= 60
2. SELECT city, temperature, condition FROM weather WHERE
condition = 'cloudy' OR condition = 'sunny' OR temperature >= 60
3. SELECT city, temperature, condition FROM weather WHERE
condition = 'sunny' OR condition = 'cloudy' AND temperature >= 60
4. SELECT city, temperature, condition FROM weather WHERE
condition = 'sunny' AND condition = 'cloudy' AND temperature >=
60
Hide Answer Workspace
Answer: C
Explanation: We know that the AND operator gives the output only when
both the first conditions are true. In contrast, the OR operator gives the
output when either the first condition OR the second condition is true. Hence
the option C is the correct choice.

46) Which of the following statement is correct to display all the cities with
the condition, temperature, and humidity whose humidity is in the range of
60 to 75 from the 'whether' table?
1. SELECT * FROM weather WHERE humidity IN (60 to 75)
2. SELECT * FROM weather WHERE humidity BETWEEN 60 AND 75
3. SELECT * FROM weather WHERE humidity NOT IN (60 AND 75)
4. SELECT * FROM weather WHERE humidity NOT BETWEEN 60 AND 75
Hide Answer Workspace
Answer: B
Explanation:
The BETWEEN is a conditional operator that is used to retrieve values from an
expression within a range. It can be used with the SELECT, INSERT, UPDATE
and DELETE statement.
The IN is a conditional operator used to reduce the use of multiple OR
conditions in the SELECT, INSERT, UPDATE and DELETE statement.
Hence the option B is the correct choice.

47) ________ is a program that performs some common action on database


data and also stored in the database.
1. Stored Procedure
2. Trigger
3. Stored Function
4. None of the above
Hide Answer Workspace
Answer: A
Explanation: A stored procedure is a precompiled set of SQL commands that
we can save in our database. It can be reused over and over again whenever
we need to perform some common tasks.
A trigger is also the set of SQL commands that reside in a system catalog, but
it will be invoked automatically in response to an event. It is a special kind of
stored procedure.
A stored function is one of the types of stored programs used to encapsulate
the common business rules or formulas reusable in stored programs. It
returns a single value or sometimes does not produce any result.
Hence the option A is the correct choice.

48) Which statement is used to get all data from the student table whose
name starts with p?
1. SELECT * FROM student WHERE name LIKE '%p%';
2. SELECT * FROM student WHERE name LIKE 'p%';
3. SELECT * FROM student WHERE name LIKE '_p%';
4. SELECT * FROM student WHERE name LIKE '%p';
Hide Answer Workspace
Answer: B
Explanation: The '%' symbol indicates zero or more characters next to
where it will be used. And the _ symbol is used to match exactly one
character. Therefore option B is the correct choice.

49) What is the advantage of the clustered index?


1. It is fast to update the records.
2. It does not need extra work for SQL queries.
3. It minimizes the page transfer and maximizes the cache hits.
4. None of the above is correct.
Hide Answer Workspace
Answer: C
Explanation: A clustered index is actually a table where the data is stored in
rows. It stores data in only one way based on the key values. It helps us to
store data and indexes simultaneously but takes a long time to update the
records. They are scan and index seek that minimizes the page transfer and
maximizes the cache hits. Hence option C is the correct choice.

50) Evaluate the SQL statement:


1. SELECT a.emp_name, a.sal, a.dept_id, b.maxsal FROM employees a,
2. (SELECT dept_id, MAX(sal) maxsal FROM employees GROUP BY dept
_id) b
3. WHERE a.dept_id = b.dept_id AND a.sal < b.maxsal;
Which of the following statement is correct?
1. The statement gives an error at line 1.
2. The statement gives an error at line 6.
3. The statement produces the employee name, salary, department ID,
and maximum salary earned in the employee department for all
departments that pay less salary than the maximum salary paid in
the company.
4. The statement produces the employee name, salary, department ID,
and maximum salary earned in the employee department for all
employees who earn less than the maximum salary in their
department.
Hide Answer Workspace
Answer: D
Explanation: Option D is the correct choice because it is the example of an
inline view, which is the subquery in the FROM clause of the main query.
51) Which of the following are the DATETIME data types that can be used in
column definitions?
1. TIMESTAMP
2. INTERVAL MONTH TO DAY
3. INTERVAL YEAR TO MONTH
4. TIMESTAMP WITH DATABASE TIMEZONE
Hide Answer Workspace
Answer: A, C
Explanation:
Options A and C are correct. It is because they are the DATETIME data types
that can be used to specify column definitions.
Option B cannot be used to specify the column definitions because there are
only INTERVAL DAY TO SECOND and INTERVAL YEAR TO MONTH data types.
Option D cannot be used to specify the column definitions because there are
only TIMESTAMP WITH TIME ZONE and TIMESTAMP WITH LOCAL TIME ZONE
data types.

52) Which data dictionary table can be used to show the object privileges
granted to the user on specific columns?
1. USER_TAB_PRIVS_MADE
2. USER_COL_PRIVS_MADE
3. USER_TAB_PRIVS
4. USER_COL_PRIVS
Hide Answer Workspace
Answer: D
Explanation: The USER_COL_PRIVS data dictionary table will display the
object privileges granted to the user on specific columns. The
USER_TAB_PRIVS data dictionary table will display the object privileges
granted to the user on the tables. Options A and B are not data dictionary.

53) Evaluate the SQL statement:


1. SELECT ROUND (TRUNCATE (MOD (1600, 10), -1), 2) FROM dual;
What will be displayed?
1. 0
2. 1
3. 00
4. An error statement
Hide Answer Workspace
Answer: A
Explanation: This statement will give the result 0. A function MOD(1600, 10)
returns 0 by calculating the modulus of 1600 when 1600 is divided by 10
until no further whole number can be produced. TRUNCATE(x, y) function
truncates x to the decimal precision of y. Finally, the ROUND(x, y) function
rounds x to the decimal precision of y. Hence option A is the correct choice.
54) What is the need for our query to execute successfully on an existing
view?
1. The specified table must contain data.
2. We must have a SELECT privilege on the view.
3. We should have a SELECT privilege only on the specified table.
4. The specified table must be in the same database or schema.
Hide Answer Workspace
Answer: B
Explanation: It is required to have a SELECT privilege to query on the
existing view. Hence option B is the right choice.

55) Which of the following operator can be used with a multiple-row


subquery?
1. =
2. BETWEEN
3. NOT IN
4. <>
Hide Answer Workspace
Answer: C
Explanation: The multiple-row subqueries produces multiple rows of results.
We can only use the NOT IN operator in SQL can only be used with multiple-
row subqueries. And all other operators must be used with single row
subquery only. Therefore, BETWEEN, '=', and '<>' operators work with single
row subquery. Hence option C is the correct choice.

56) _______ is a constraint that can be defined only at the column level?
1. UNIQUE
2. NOT NULL
3. CHECK
4. PRIMARY KEY
Hide Answer Workspace
Answer: B

You might also like