Chapter 6 Database
Chapter 6 Database
13. A candidate key that is not the primary key is called Understanding
(A)Composite Key
(B)Foreign Key
(C)Alternate Key
(D)None of these
14. In relational model, tables are called Understanding
(A) Domains
(B) Relations
(C) Tuples
(D) None of these
15 ___________ can take NULL values in it Knowledge
(A)Primary Key
(B)Foreign Key
(C)Both Primary Key and Foreign Key
(D)None of these
Answers
Multiple Choice question
Q.No.1 (A) Constraint
Q.No.2 (C) Query
Q.No.3 (A)Relational Database Management System
Q.No.4 (A) A primary key
Q.No.5 (A)Composite Primary Key
Q.No.6 (B) tuple
Q.No.7 (A) attributes
Q.No.8 (C) Domain
Q.No.9 (A)Degree
Q.No.10 (B) Cardinality
Q.No.11 (B)Foreign Key
Q.No.12 (C)Candidate Key
Q.No.13 (C)Alternate Key
Q.No.14 (B) Relations
Q.No.15 (B)Foreign Key
MCQ QUESTIONS
Sl. Question: Learning
No Objective
1 A relational database consists of a collection of Knowledge
(A) Tables
(B) Fields
(C) Records
(D) Keys
2 A/An ____________ in a table represents a logical relationship among a set of Knowledge
values.
(A) Attribute
(B) Key
(C) Tuple
(D) Entry
3 The term _________ is used to refer to a record in a table. Knowledge
(A) Attribute
(B) Tuple
(C) Field
(D) Instance
4 The term _________ is used to refer to a record in a table. Knowledge
(A) Attribute
(B) Tuple
(C) Field
(D) Instance
5 Which of the following attributes cannot be considered as a choice for primary Understanding
key?
(A) Id
(B) License Number
(C) Dept_Id
(D) Street
6 An attribute in a relation is a foreign key if it is the ___________ key in any other Knowledge
relation.
(A) Candidate
(B) Primary
(C) Super
(D) Sub
7 Consider the table with structure as : Understanding
Student (ID, name, dept_name, tot_cred)
In the above table, which attribute will form the primary key?
(A) Name
(B) Dept
(C) Total_credits
(D) ID
8 Which one of the following is commonly used to define the overall design of the Knowledge
database?
(A) Application program
(B) Data definition language
(C) Schema
(D) Source code
9 Which of the following keys is generally used to represents the relationships Understanding
between the tables?
(A) Primary key
(B) Foreign key
(C) Secondary key
(D) None of the above
10 For what purpose the DML is provided? Understanding
(A) Addition of new structure in the database
(B) Manipulation & processing of the database
(C) Definition of the physical structure of the database system
(D) All of the above
11 The term "SQL" stands for Knowledge
(A) Standard query language
(B) Sequential query language
(C) Structured query language
(D) Server-side query language
12 Which of the following data type will be suitable for storing the name of students? Understanding
(A) int
(B) varchar(n)
(C) char
(D) None of the above
13 What is the format used for storing date using date datatype? Knowledge
(A) dd-mm-yy
(B) dd-mm-yyyy
(C) mm-dd-yyyy
(D) yyyy-mm-dd
14 Which of the following constraints can be used if we don’t want user to leave the Understanding
field blank while inserting data?
(A) “NULL”
(B) not null
(C) “Unassigned”
(D) unique key
15 Which of the following data type will be the best choice for storing price of any Understanding
item?
(A) string
(B) int
(C) date
(D) float
3. Identify the correct command SQL query which is expected to delete Knowledge
all rows of a table TEMP without deleting its structure ?
(A) Unique
(B) Distinct
(C) Primary key
(D) d. Check
5. For each attribute of a relation, there is a set of permitted values, called the Knowledge
………. of that attribute.
(A) Dictionaries
(B) Domain
(C) Directory
(D) d. Relation
6. _____key is used to join two relations in RDBMS? Knowledge
(A) Primary Key
(B) Candidate Key
(C) Foreign Key
(D) Unique Key
7. What is the degree and cardinality of a SQL table? Knowledge
(A) Use
(B) Show
(C) Fetch
(D) Select
9. A .................. is a text that is not executed. Knowledge
(A) Statement
(B) Query
(C) Comment
(D) Clause
10. .................. command helps to open the database for use. Knowledge
(A) Use
(B) Open
(C) Distinct
(D) Select
11. If you want to add a new column in an existing table, which command is Creation
used. For example, to add a column bonus in a table emp, the statement
will be given as:
(A) ALTER table emp ADD (bonus Integer);
(B) CHANGE table emp ADD bonus int;
(C) ALTER table emp ADD bonus int;
(D) UPDATE table emp ADD bonus int;
12. What is the full form of SQL? Knowledge
(A) Where
(B) from
(C) having
(D) like
14. Which is the subset of SQL commands used to manipulate database Knowledge
structure including tables?
(A) Attribute
(B) Tuple
(C) Row
(D) Instance
5 Which of the following sublanguages of SQL is used to define the structure of the Understandi
relation, deleting relations and relating schemas ? ng
a) Data Definition Language (DDL)
b) Data Manipulation Language (DML)
c) Query
d) Relational Databases
6 Consider the following SQL statement. What type of statement is this? Understandi
ng
SELECT * FROM Employee ;
a) DML
b) DDL
c) DCL
d) Integrity Constraint
7 Consider the following SQL statement. What type is this ? Understandi
ng
DROP TABLE items;
a) DML
b) DDL
c) DCL
d) TCL
8 The data types CHAR (n) and VARCHAR (n) are used to create ___________ Knowledge
and __________ length types of string/text fields in a database.
a) Fixed, Equal
b) Equal, Variable
c) Fixed, Variable
d) Variable, Equal
9 Which of the following is/are the DDL statements ? Knowledge
a) Create
b) Drop
c) Alter
d) All of these
10 ___________ defines rules regarding the values allowed in columns and is the Knowledge
standard mechanism for enforcing database integrity.
a) Column
b) Constraint
c) Index
d) Trigger
11 To define a column as a primary key, ____________ _____________ constraint is Knowledge
used in CREATE TABLE.
a) primary word
b) primary keynote
c) candidate key
d) primary key
2. Sonia wants to see all the databases are available in her MySQL software. Understanding
Which command is useful for her?
a) Show databases;
b) Show database;
c) Show tables
d) Show database_name;
3. Goni wants to do some work with her database. She is confused about how to Application
write commands to use the required database. Choose correct option
a) Required database;
b) Use database;
c) Use <databasename>;
d) Required <databasename>
4. To delete a database _________________command is used Application
a) Delete database database_name
b) Delete database_name
c) Drop database database_name
d) Drop database_name
5 To show all the tables of a given database what will be the command? Analysis
a) Use database_name; shows tables;
b) Use database_name; show tables;
c) Required database; show tables;
d) Required database; shows tables;
6. Consider the following SQL statement. What type of statement is this? Analysis
CREATE TABLE employee (name VARCHAR, id INTEGER)
(a) DML
(b) DDL
(c) DCL
(d) Integrity constraint
7. Which among the following is the correct syntax for creating tables? Analysis
a) CREATE TABLE name;
b) CREATE name;
c) CREATE TABLE
d) All of the mentioned
8. Which command shows the table structure of table emp? Understanding
a) Select * from emp;
b) Show all from emp;
c) Desc emp;
d) Drop emp;
9. Which of the following functions are not performed by the “ALTER” clause? Understanding
a) Change the name of the table
b) Change the name of the column
c) Drop a column
d) All of the mentioned
10. The __________clause of SELECT query allows us to select only those rows Application
in the results that satisfy a specified condition.
(a) Where
(b) from
(c) having
(d) like
11. Which command is used to change the definition of a table in SQL? Understanding
a) create
b) update
c) alter
d) delete
12. Which command to use in order to delete the data inside the table, and not the Understanding
table itself
A) DELETE
B) TRUNCATE
C) Both TRUNCATE & DELETE
D) DROP
13 In the given query which keyword has to be inserted? Application
INSERT INTO employee______(1002, “Kausar”, 2000);
(a) Table
(b) Values
(c) Relation
(d) Field
14. Which SQL statement is used to delete specific data FROM a database? Understanding
a) Drop
b) Remove
c) Alter
d) delete
15. Consider the following SQL statement. What type of statement is this? Knowledge
SELECT * FROM employee
(a) DML
(b) DDL
(c) DCL
(d) Integrity constraint
2 a) Show databases;
3 (c ) Use <databasename>;
6 (b) DDL
7 (a) CREATE TABLE name;
8 a) Desc emp;
9 (d) All of the mentioned
10 (a) Where
11 ( c) alter
12 (D) DROP
13 (b) Values
14 (d) delete
15 (a) DML
MCQ QUESTIONS
Sl. No. Question: Learning
Objective
1. Which operator is used to compare a value to a specified list of values? Rememb
A. Between ering &
B. All Understa
C. In ding
D. None of the above
2. You can change/modify value for one or more columns of a table using SQL with Rememb
which of the following? ering &
A. Change Understa
B. Modify ding
C. Alter
D. Update
3. Which operator checks column for non existence of data in that column Rememb
A. NOT Operator ering &
B. Exists Operator Understa
C. IS NULL Operator ding
D. None of the above
4. Using a WHERE clause in a SQL query is used to specify SQL reserved words and Rememb
characters, known as ____? ering &
A. Operators Understa
B. Data Types ding
C. Numbers
D. Syntax
5. Using which SQL Comparison Operator can we find the data that matches our Rememb
query? ering &
A. SQL Not Equal Operator (!=) Understa
B. SQL Equal Operator (=) ding
C. SQL Greater Than Operator (>)
D. SQL Less Than Operator (<)
6. Which of the following is not a SQL Logical Operator? Rememb
A. SQL Equal Operator ering &
B. SQL ANY Operator Understa
C. SQL BETWEEN Operator ding
D. SQL IN Operator
7. The SQL Modulus Operator returns the, Rememb
A. Quotient ering &
B. Percentage Understa
C. Sum ding
D. Reminder
8. SQL Division operator divides the operand on the ____ side by the operand on the Applying
____ side.
A. Left, Left
B. Right, Left
C. Left, Right
D. Right, Right
9. If we have not specified ASC or DESC after a SQL ORDER BY clause, the Analysin
following is used by default g,
A. DESC Evaluatin
B. ASC g and
C. There is no default value Creating
D. None of the mentioned
10. Which of the following is true about the SQL AS clause? Rememb
A. The AS clause in SQL is used to change the column name in the output or ering &
assign a name to a derived column. Understa
B. The SQL AS clause can only be used with the JOIN clause. ding
C. The AS clause in SQL is used to defines a search condition.
D. All of the mentioned
11. When the wildcard in a WHERE clause is useful? Rememb
A. When an exact match is required in a SELECT statement. ering &
B. When an exact match is not possible in a SELECT statement. Understa
C. When an exact match is required in a CREATE statement. ding
D. When an exact match is not possible in a CREATE statement.
12. Select the correct order of precedence among the following? Rememb
1. OR > NOT > + > ** ering &
2. NOT > OR > ** > + Understa
3. ** > + > OR > NOT ding
4. ** > + > NOT > OR
13. The SQL keyword(s) ________ is used with wildcards. Rememb
A. LIKE only ering &
B. IN only Understa
C. NOT IN only ding
D. IN and NOT IN
14. The numerical values of two ___ of the ___ table can be easily subtracted using Rememb
SQL Subtraction Operator.
ering &
A. Rows, same
Understa
B. Columns, same
ding
C. Rows, different
D. Columns, different
15. Which of these is not correct set of Logical operators? Rememb
A. And, Or, Not, Like, Any, Between, All
ering &
B. And, Or, Not, Like, Any, Between,Where
Understa
C. And, Or, Not, Like, With, Between, Where
ding
D. And, Or, Null, Like, Any, Between, Distinct
MultpleChice question
Q.No. Answer
1. C
2. D
3. C
4. A
5. B
6. A
7. D
8. C
9. B
10. A
11. B
12. D
13. A
14. B
15. A
MCQ
QUESTION ANSW
ER
1 Which of the following function is used to FIND the largest value from the given data in MYSQL? (a)
(a) MAX() (b) MAXIMUM() (c) LARGEST() (c) BIG()
2 Aggregate functions can be used in the select list or the _____ clause of a select statement. They cannot be (b)
used in a ______ clause.
(a) Where, having(b) Having, where(c) Group by, having (d) Group by, where
3 Which of the following is a SQL aggregate function? (b)
(a) LEFT(b) AVG (c) JOIN (d) LEN
4 An attribute in a relation is foreign key if it is the _________key in any other relation. (b)
(a) Candidate (b) Primary (c) Super (d) Sub
5 The HAVING clause does which of the following? (c)
(a) Acts EXACTLY like WHERE clause
(b) Acts like a WHERE clause but is used for columns rather than groups.
(c) Acts like a WHERE clause but is used form groups rather than rows.
(d) Acts like a WHERE clause but is used for rows rather than columns.
6 Which SQL function is used to count the number of rows in a SQL query? (d)
(a) COUNT () (b) NUMBER () (c) SUM () (d) COUNT (*)
7 With SQL, how can you return the number of not null record in the Project field of “Students” table? (a)
(a) SELECT COUNT (Project) FROM Students
(b) SELECT COLUMNS (Project) FROM Students
(c) SELECT COLUMNS (*) FROM Students
(d) SELECT COUNT (*) FROM Students
8 Which of the following is not an aggregate function? (c)
(a) Avg (b) Sum (c) Sub (d) Min
9 If column “Salary” contains the data set {1000, 15000, 25000, 10000, 15000}, what will be the (d)
output after the execution of the given query?
SELECT SUM(DISTINCT SALARY) FROM EMPLOYEE;
(a)75000 (b) 25000 (c) 10000 (d) 50000
10 Which of the following group functions ignore NULL values? (d)
(a) MAX (b) COUNT (c) SUM (d) All of the above
11 Where and Having clauses can be used interchangeably in SELECT queries? (b)
(a) True (b) False (c) Only in views (d) With order by
12 The operation whose result contains all pairs of tuples from the two relations, regardless of whether their (b)
attribute values match.
(a) Join (b) Cartesian product (c) Intersection (d) Set difference
13 To specify filtering condition for groups, the _____________ clause is used in MYSQL. (b)
(a) where (b) having (c) order by (d) both a and b
14 _________ clause is used to collect those rows that have the same value in a specified column. (d)
(a) order by (b) like (c) having (d) group by
15 The SQL built-in function __________ computes the number of rows in a table. (a)
(a) count(*) (b) count(Column name) (c) sum(column) (d) both a and b
clause. and
a) group by understanding
b) group
c) group set
d) group attribute
2 Choose the correct option regarding the query Applying
a) The having clause checks whether the query result is true or not
b) The having clause does not check for any condition
c) The having clause allows only those tuples that have average balance 10000
d) None of the mentioned
3 The _____ aggregation operation adds up all the values of the attribute Remembering
and
a) add understanding
b) avg
c) max
d) sum
b) Null values
c) Characters
d) Integers
c) CROSS JOIN
d) NATURAL JOIN
6 How many tables may be included with a join? Applying
a) One
b) Two
c) Three
d) All of the Mentioned
7 Analysing,
Evaluating and
Creating
a) avg and
b) sum understanding
c) With
d) min
b) Acts like a WHERE clause but is used for columns rather than groups. understanding
c) Acts like a WHERE clause but is used for group rather than rows.
d) Acts like a WHERE clause but is used for rows rather than columns.
a) GROUP BY and
b) SELECT understanding
c) WHERE
d) Both (a) & (b)
14 SQL applies conditions on the groups through _____________ clause after groups Remembering
a) Group by understanding
b) With
c) Where
d) Having
5 A session between the application program and the database is also termed as Understandin
____ g
(A) bridge
(B) connection
(C) gap
(D) none of the above
6 The -------------------- constructor creates a connection to the MySQL server and Knowledge,
returns a MySQL Connection object.
(A) connect()
(B) connection()
(C) mysqlconnect()
(D) None of the above
7 Choose the correct statement to connect database from Python code, is host is Understandin
“localhost”, user= “root” the database is “School” with no password . g
(A) connect(host= “localhost”,user= “root”, database = “School”)
(B) connect(host= “localhost”,user= “sql”,password=NAN, database = “root”)
(C) connect(host= “host”,user= “root”,password=np.nan, database = “School”)
(D) connect(host= “loca”,user= “School”,password=“ ”, database = “root”)
8 It acts as middleware between MYDSQL database connection and SQL query. Application
(A) cursor
(B) Table
(C) Query
(D) row
9 Suresh is trying to fetch only one record from result set at a time. Which method Application
should be used by him?
(A) fetchmany
(B) fetchno
(C) fetchone
(D) fetchall
10 SQL command is passed to which function to run after establishment of the Knowledge,
connection between python and database
(A) cursor()
(B) execute()
(C) connection()
(D) fetchall()
11 Which of the following function is used to close the connection between python Knowledge,
and database?
(A) cursor.close()
(B) is.close()
(C) connection.close()
(D) execute.close()
12 Read the following code and assume that all necessary files are already Application
imported
Mycon = sql.connect(host= “localhost”,user= “root”,password=“india”,
database = “company”)
Cursor = mycon.cursor()
Query = “Select * from empl”
Which will be the next statement to execute query?
(A) Cursor.query.excute()
(B) Cursor.execute(Query)
(C) Query.execute()
(D) execute(Query)
13 When we run <connection>.__________ method, it reflect the changes made in Analysis
the database permanently.
(A) done()
(B) commit()
(C) reflect()
(D) final()
14 Which function retrieve all (remaining ) rows of a query result an return them Application
in a list of tuples
(A) fetchone()
(B) fetchall()
(C) fetchmany ()
(D) All the above
15 Which is the correct statement about fetchone() Analysis
(A) Fetch the next row of a query result set, returning a single tuple, or None
when no more data is available
(B) Fetch the First row of a query result set, returning a single tuple, or None
when no more data is available
(C) Fetch the current row of a query result set, returning a single tuple, or None
when no more data is available
(D) None of the above
Multiple-choice question
Q.No.1 (A) mysql-connector
Q.No.2 (D) 0
Q.No.3 (A) connect()
Q.No.4 (B) import mysql.connector
Q.No.5 (A) bridge
Q.No.6 (A) connect()
Q.No.7 (A) connect(host= “localhost”,user= “root”,password=“india”, database =
“School”)
Q.No.8 (A) cursor
Q.No.9 (C) fetchone
Q.No.10 (B) execute()
Q.No.11 (C) conection.close()
Q.No.12 ( c) Cursor.execute(Query)
Q.No.13 (B) commit()
Q.No.14 (B) fetchall()
Q.No.15 (A)Fetch the next row of a query result set, returning a single tuple, or None
when no more data is available
1 What is the datatype of the row returned from a resultset using fetchone() function?
a) Tuple b) List c) String d) Dictionary Knowledge
2 What is the datatype of the row returned from a resultset using fetchall() function?
a) Tuple b) List c) String d) Dictionary
Knowledge
3 What is the datatype of the row returned from a resultset using fetchmany() function?
a) Tuple b) List c) String d) Dictionary
Knowledge
4 What is returned when we execute the function fetchone() but no rows are available to
fetch ? Knowledge
a) None b) Empty Tuple c) Empty List d) Error
5 What is returned when we execute the function fetchall() but no rows are available to
fetch ? Knowledge,
a) None b) Empty Tuple c) Empty List d) Error Understand
6 What is returned when we execute the function fetchmany() but no rows are available
to fetch ? Knowledge
a) None b) Empty Tuple c) Empty List d) Error
11 This is the Property of cursor object that returns the number of rows fetched
a) fetchall() b) resultset c) rowcount d) none of the above
Analysis
12 Whenever you run Insert, Update and Delete query using Python code, you must run
method within the connection object. Knowledge
a) fetchall() b) commit() c) executeQ d) None of the above
KEY/ANSWER SHEET
Q. No. 1 a) Tuple
Q. No. 2 b) List
Q. No. 3 b) List
Q. No. 4 a) None
Q. No. 8 c) connect
Q. No. 10 c) 4
Q. No. 11 c) rowcount
Q. No. 12 b) commit()
Q. No. 13 b)executemany
Q. No. 14 c) -1
Q. No. 15 b)3
Region-KOLKATA
Mobile No-86011655337
E-mail ID [email protected]
Name of the Chapter-DATABASE MANAGEMENT
Q.No.2 D
Q.No.3 A
Q.No.4 B
Q.No.5 B
ASSERTION BASED QUESTIONS
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
2. Assertion : Constraints are the condition define against the column of Analysis
a table.
Reason : Constraints are the checking condition which we apply on
table to ensure the correctness of data .
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
3. Assertion : Data definition language. Consists of commands used to Analysis
modify the metadata of a table. For Example- create table, alter table,
drop table.
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
4. Assertion : Primary Key is one or more attribute of a relation used to Analysis
uniquely identify each and every tuple in the relation.
Reason : For Example : In the below Table Student, RollNo can be the
Primary Key
RollNo Name Marks
1 Pratham 75
2 Srishti 80
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
5. Assertion : Suppose there are suppliers from 30 different cities. A Analysis
person wants to list only those records of supplier table who belongs
to 'Delhi', 'Mumbai','Kolkata', 'Chennai', 'Chandigarh' and
‘Ahmedabad'.
Reason : IN operator used in SQL queries to specify the list of values
for searching.
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
(A) Both Assertion and reason are true and reason is the correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.
2. Assertion: DELETE is a Data Manipulation Language (DML) Knowledge
command and used when we want to remove some or all the
tuples from a relation.
A) Both Assertion and reason are true and reason is the correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
(C) Assertion is true, reason is false.
A) Both Assertion and reason are true and reason is the correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
(C) Assertion is true, reason is false.
A) Both Assertion and reason are true and reason is the correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the correct
explanation of assertion.
(C) Assertion is true, reason is false.
2 (B) Assertion and reason both are true but reason is not the correct
explanation of assertion
3 (C) Assertion is true, reason is false.
4 (D) Assertion is false, reason is true.
5 (C) Assertion is true, reason is false.
2. A
3. C
4. A
5. B
Assertion (A):
Application
Reason (R): We can create a new database using execute function
(A) Both A and R are true and R is the correct explanation of assertion.
(B) A and R both are true but R is not the correct explanation of A .
(C) A is true, R is false.
1 (D) A is false, R is true.
Assertion (A):
(A) Both A and R are true and R is the correct explanation of assertion.
(B) A and R both are true but R is not the correct explanation of A .
(C) A is true, R is false.
(D) A is false, R is true.
Assertion (A):
data = [
('Jane', 'F'),
('Joe', 'M'),
('John', 'M'),
]
stmt = "INSERT INTO employees (first_name, hire_date) VALUES (%s, %s)"
cursor.execute(stmt, data)
3 mydb.commit() Application
(A) Both A and R are true and R is the correct explanation of assertion.
(B) A and R both are true but R is not the correct explanation of A .
(C) A is true, R is false.
(D) A is false, R is true.
Assertion (A):
(A) Both A and R are true and R is the correct explanation of assertion.
(B) A and R both are true but R is not the correct explanation of A .
(C) A is true, R is false.
(D) A is false, R is true.
Assertion (A):
Reason (R): database name has not been provided in the connect function call
5 Understand
(A) Both A and R are true and R is the correct explanation of assertion.
(B) A and R both are true but R is not the correct explanation of A .
(C) A is true, R is false.
(D) A is false, R is true.
ASSERTION REASON TYPE QUESTIONS
1 (A) Both A and R are true and R is the correct explanation of assertion
5 (B) A and R both are true but R is not the correct explanation of A .
Region-KOLKATA
Mobile No-8601155337
E-mail ID [email protected]
Name of the Chapter-DATABASE MANAGEMENT
Sl.No. Read the passage given below and answer the following questions…….. Learning Objective
1 Harekrishna Company wants to create a database to maintain following
details
Employee (Emp_id, Empname, Address, Department, Aadhar_Number)
Dependent(Emp_id, Dependent_Name, Age)
1. The attribute of Employee, which can be worked as candidate key Evaluation
(A) Emp_id
(B) Aadhar_Number
(C)Both of above
(D) None of these
ANSWER
Sl. Consider the table(s) given below and answer the following questions from (i) to Learning
No. (iv) Objective
1. Amrita wants to store following data in a table: Student but she is not well Analysis
versed with SQL. Help her in taking decisions to define the schema of the table.
TABLE: STUDENT
STUD NAME FNAME MNAME CLASS SECTION
_ID
2001 AMRITA HANS LAL MINU DEVI 6 B
2002 AMRIT HARISH KRISHNA 7 A
2003 NITIN PHUKAN HRITIKA 8 A
SINGH
2004 LOKESH GULAB ANJANA 9 C
KUMAR
2 Consider the below given tables and answer the questions (i) to (iv): Analysis
TABLE: STUDENT
STUD NAME GNAME G_ID CLASS SECTION
_ID
2001 AMRITA HANS LAL 1001 6 B
2002 AMRIT HARISH 1002 7 A
2003 NITIN PHUKAN SINGH 1003 8 A
2004 LOKESH GULAB KUMAR 1004 9 C
TABLE: GUARDIAN
G_ID GNAME PHONENUMBER ADDRESS
1001 HANS LAL 9899712716 Lekhi
1002 HARISH 9034847512 Doimukh
1003 PHUKAN SINGH 8059190191 Nirjuli
1004 GULAB KUMAR 9992230098 Karsingsa
Sl.No. Read the passage given below and answer the following Learning Objective
questions……..
1 An organization SoftSolutions is considering to maintain their Understanding
employees
records using SQL to store the data. As a database administer, Murthy
has
decided that :
• Name of the database - DATASOFT
• Name of the table - HRDATA
• The attributes of HRDATA are as follows:
ECode – Numeric
EName – character of size 30
Desig – Character of size 15
Remn – numeric
Table: HRDATA
(D) Select the statement to increase the Remn of all the employees by
10
percent.
a) update HRDATA set Remn = Remn + (0.1*Remn) ;
b) modify HRDATA set Remn = Remn + (0.1*Remn) ;
c) change HRDATA set Remn = Remn + (0.1*Remn) ;
d) update HRDATA set Remn = Remn + (10 % of Remn) ;
(A) Select the command to insert the following data into the
attributes ItemNo, ItemName, SCode and Quantity respectively
in the given table CHStore.
ItemNo = 21010, ItemName = “Trocars” , Scode = 14 and
Quantity=28
a) Insert
b) Alter
c) Create
d) Add
(C)Now Ritika wants to display the structure of the table CHStore, i.e,
name of the attributes and their respective data types that she has
used in the table. Help her to choose the correct query :
(D) Ritika wants to remove the column Quantity from the table
CHStore . Help her to select the correct command:
ANSWERS
Case Study Questions
Q.No. (A) ECode
1 (B) 4 and 5
(C) delete from HRDATA where EName = “Jeevan”;
(D) update HRDATA set Remn = Remn + (0.1*Remn) ;
Q..No. (A) insert into table CHStore values( 21010, “Trocars” , 14 , 28);
2 (B) Alter
(C) Desc CHStore;
(D) Alter table CHStore drop column Quantity;
QUESTIONS
Sl.No. Read the passage given below and answer the following questions…….. Learning Objective
Agnisudha want to write SQL statement to create a table named job_histry ……..
including columns employee_id, start _date, end _date, job_id and department_id
and make sure that the value against column end_date will be entered at the time
of insertion to the format like '--/--/----'. She inserted 10 employees details in her
tables.
1. Help Agnisudha to choose the correct data type for entering the values of Analysis
start date, end date.
a) Varchar
b) Char
c) Int
d) date
2. Agnisudha want to delete all values of the tables. Help her to choose the correct Analysis
command for her requirement.
4. She wants to start work with her database. Which command helps her to choose Application
the correct work.
a) Use database_name;
b) Use tables;
c) Required database; show tables;
d) Required database; shows tables;
5. She wants to delete every data with database details .Which command will help Analysis
her.
a) Delete database;
b) Delete from tablename;
c) Drop database databasename;
d) Drop databasename;
Soma has created cs database with five tables for her five subjects. But she has
forgotten to recall her table name.
1. Help soma to write commands to see all tables name. Analysis
a) Show databases;
b) Show database;
c) Show tables; use cs;
d) use cs; Show tables
2. She wants to see the structures of the ip table. creativity
Help her to choose a command.
a) Desc ip;
b) Show ip;
c) Select from table ip;
d) Select * from ip;
3. She wants to add a new column in ip tables. Which clause helps her to do work. Analysis
a) Alter
b) Update
c) Delete
d) select
4. Soma wants to see the details of ip tables. Help her to choose the correct query. Analysis
a) Select * from ip;
b) Desc ip;
c) Show ip;
d) Select from table ip;
5. She wants to insert one row in her table ip. Which DML command helps her. Analysis
a) Select
b) Insert
c) Update
d) Delete.
4 Use database_name;
Sl.No. Read the passage given below and answer the following questions…….. Learning
Objective
1. Consider a table EMPLOYEE with the following data: Analysin
ENO ENAME SALARY BONUS DATEOFJOIN JOBTYPE g,
A01 Piya Thakur 30000 45.23 29-10-2019 Clerk Evaluatin
a. Write a query to list the names of female teacher who teaches CS.
b. Write a query to update the salary of Chemistry teacher by 5%.
c. Write a query to display the different subjects offered in the school.
d. Write a query to delete the information of Economics teacher.
e. Write a query to list details of all teachers whose salary contain NULL.
ANSWERS
Case Study Questions
Q.No. Answer
1. a. SELECT ENAME,ROUND(BONUS,0) FROM EMPLOYEEE;
Sl.N See the following table given below and answer the following questions Learning
o. Objective
1 Table-EXAM Analysing,
2 See the following tables given below and answer the following questions
Table: ACTIVITY Analysing,
Region-KOLKATA
Mobile No-8601155337
E-mail ID [email protected]
Name of the Chapter-DATABASE MANAGEMENT
Q.No.1 True
Q.No.2 True
Q.No.3 True
Q.No.4 False
Q.No.5 False
4 Unique key can serve as Primary Key only if the Unique key attribute Understanding
also has NOT NULL constraint.
a. True
b. False
5 DROP is a DML command. Knowledge
a. True
b. False
True False Questions
Q.No.1 True
Q.No.2 False
Q.No.3 True
Q.No.4 True
Q.No.5 False
2. Delete command deletes the table structure and Drop command deletes Analysis
the data from a SQL Table . [True or False ]
3. Null (unavailable and unknown) values are entered by the following Analysis
command:
INSERT INTO TABLE_NAME VALUES (“NULL”);
[True / False]
4. Foreign key column derives its value from the primary key of the parent Analysis
table.
[Trure/ False]
5. ALTER TABLE command is used to modify the structure of the table. Analysis
[True / False]
2 The rows of the result relation produced by a SELECT statement can be understanding
sorted but only by one column.
3 knowledge
The WHERE clause is used to specify filtering conditions for groups.
4. The SQL statement: SELECT salary + Comm AS Total FROM Emp; creativity
adds two fields salary and comm from each row together and lists the
results in a column named Total.
5. Drop command delete structure of table. knowledge
QUESTIONS
Sl.No. Question Learning
Objective
1. The BETWEEN operator includes both begin and end values. Applying
2. Logical operators and Relational opertors can not ne used together. Applying
3. Update and delete statements are DDL statements. Rememberin
g&
Understading
4. When multiple opertors are used in a SQL Query, low precedence operators are Applying
evaluated in last.
5. A user may specify two or more columns as using the SELECT – DISTINCT Applying
clause
ANSWERS
True False Questions
Q.No. Answer
1 True
2 False
3 False
4 True
5 True
a) True understanding
b) False
2 We can rename the resulting attribute after the aggregation function has been Remembering
applied and
a) True understanding
b) False
3 To avoid a Cartesian product, always include a valid join condition in a WHERE Remembering
clause. and
a) True understanding
b) False
4 Understanding the primary and foreign key relationship is not important to join on Remembering
a) True understanding
b) False
5 COUNT(Fieldname) tallies only those rows that contain a value; it ignores all null Remembering
values. and
a) True understanding
b) False
When we execute a MySql insert query in python, The new row gets saved in the Knowledge,
4 database Apply
a) True
b) False
TRUE-FALSE QUESTIONS
1 (A) True
2 (A) True
3 (B) False
4 (A) False
5 (A) False
Region-KOLKATA
Mobile No-8601155337
E-mail ID [email protected]