WorksheetsPre-Assessment | DBMS | FT Batch 3 | Prof. Kiran Kumar K V
Total questions: 50
Worksheet time: 33mins
A Database Management System (DBMS) is
Collection of interrelated data
Collection of programs to access data
Collection of data describing one particular enterprise
All of the above
Which of the following is a Data Model?
Entity-Relationship model
Relational data model
Object-Based data model
All of the above
Which of the following is not involved in DBMS?
End Users
Data
Application Request
HTML
Consider attributes ID, CITY and NAME. which one of these can be considered as a primary key?
NAME
ID
CITY
ID, NAME
This is an example of ________________
Data inconsistency
Data redundancy
Data security
Data consistency
A field of one table which is also a the primary key of another table
Primary Key
Relational database
Data normalisation
Foreign Key
Select the DBMS software
Here which of the following displays the unique values of the column?
SELECT ________ dept_name FROM instructor;
All
From
Distinct
Name
SELECT * FROM employee WHERE salary>10000 AND dept_id=101;
Which of the following fields are displayed as output?
Salary, dept_id
Employee
Salary
All the field of employee relation
Drop table statement
deletes the table structure only
deletes the table structure along with the table data
works whether or not referential integrity constraints would be violated
is not an SQL statement
In a relational schema, what is a foreign key?
A key that uniquely identifies a record in a table
A key that is used for encryption
A reference to a primary key in another table
A key that allows null values
What is the purpose of the SELECT operation in relational algebra?
Combine rows from different tables
Filter rows based on a condition
Add new records to a table
Sort the table in ascending order
What is a database schema?
A visual representation of database tables
A set of rules for database normalization
A collection of database objects, including tables and relationships
A database backup file
What is the significance of primary keys in the relational model?
They uniquely identify a record in a table
They allow null values in a table
They are used for encryption
They define the physical storage structure of the database
Which of the following is NOT a type of database relationship?
One-to-One
One-to-Many
Many-to-Many
One-to-None
The following are the functions of a DBMS except
Creating database
Processing data
Creating and processing forms
Administrating database
The term _____ is used to refer a row
Record
Primary key
Foreign key
Field
If you were collecting and storing information about your music collection, an album would be considered a/an _______
Relation
Instance
Entity
Attribute
A SELECT command without a WHERE clause returns ?
All records from a table that match the previous WHERE clause
All the records from a table , or information about all the records.
SELECT is invalid without a Where clause
Nothing
The USE command ?
Is used to load code from another file
Has been deprecated and should be avoided for security reasons.
Is a pseudo name for the SELECT command
Should be used to choose the database you want to use once you've connected to MySQL.
Which one will delete the table data as well as table structure?
DELETE
DROP
MySQL runs on which operating systems ?
Linux and Mac OS-X only
Any operating system at all
Unix , Linux , Windows and others
Unix and Linux only
What SQL clause is used to restrict the rows returned by a query ?
WHEN
HAVING
FROM
WHERE
4.The …… systems were known as predecessor of database system.
a) Folder
b) File
c) Application
d) memory
10. Communication is established with MySQL using
a) SQL
b) Network calls
c) Java
d) API’s
9. Which command is used to permanently save into database?
a) SAVE POINT
b) COMMIT
c) ROLLBACK
d) SET
Full form of API
Application Process Interchange
Application Programs Interchange
Application Process Interface
Application Programming Interface
import mysql.connector as mys
mydb = mys.connect( host="localhost", user="root",
password="root"
)
mycursor = mydb.cursor()
mycursor.execute("CREATE DATABASE KVSEC3")
AFTER EXECUTING THE ABOVE CODE. What will be done
(a)
To display all the databases of MySQL with the help of cursor mycursor , command will be
mycursor.execute("SHOW DATABASES")
mycursor.execute("DESC DATABASES")
mycursor.executes("SHOW DATABASES")
mycursor.execute("SHOW ALL DATABASES")
What will be returned by the given query?
SELECT round(153.669, 2);
153.6
153.66
153.67
153.7
What will be returned by the given query?
SELECT INSTR("INDIA", "DI");
2
3
-2
-3
Which of the following is not a date function?
Month
Year
Now
Pow
What will be printed by the given query?
SELECT LENGTH( " INFORMATICS PRACTICES");
21
22
23
24
What will be returned by the given query?
SELECT month('2020-05-11');
5
11
May
November
Fill in the blank:
(a) this clause is used with GROUP BY to filter the group of records.
Choose the correct query
SELECT * FROM EMP WHERE NAME=NULL
SELECT * FROM EMP WHERE NAME IS NULL;
SELECT FROM EMP WHERE NAME IS NULL;
SELECT *FROM EMP WHERE NAME IS 'NULL';
Which of the following SELECT query returns the department number with maximum salary compensated to an employee? (Consider the table structure as given)
SELECT department_id , max(salary ) FROM employees ;
SELECT department_id , max(salary ) FROM employees GROUP BY department_id ;
SELECT max(salary ) FROM employees GROUP BY department_id ;
SELECT max(salary ) FROM employees ;
A table T_COUNT has 12 number values as 1, 2, 3, 32, 1, 1, null, 24, 12, null, 32, null. Predict the output of the below query.
SELECT COUNT (*) FROM t_count;
12
6
9
Throws exception because COUNT function doesn't works with NULL values
What is true of using group functions on columns that contain NULL values?
Group functions on columns ignore NULL values.
Group functions on columns returning dates include NULL values.
Group functions on columns returning numbers include NULL values.
Group functions on columns cannot be accurately used on columns that contain NULL values.
Predict the outcome of the below query
SELECT department_id , COUNT(first_name ) FROM employees WHERE job IN ('SALESMAN','CLERK','MANAGER','ANALYST') GROUP BY department_id HAVING AVG(salary ) BETWEEN 2000 AND 3000;
It returns an error because the BETWEEN operator cannot be used in the HAVING clause.
It returns an error because WHERE and HAVING clauses cannot be used in the same SELECT statement.
It returns an error because WHERE and HAVING clauses cannot be used to apply conditions on the same column.
It executes successfully.
Find the name of those cities with temperature and condition whose condition is either sunny or cloudy but temperature must be greater than 70.
SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ OR temperature > 70
SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ OR temperature > 70
SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70
SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ AND temperature > 70
SQL query to find all the cities whose humidity is 95.
SELECT city WHERE humidity = 95
SELECT city FROM weather WHERE humidity = 95
SELECT humidity = 89 FROM weather
SELECT city FROM weather
With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” ends with an “a”?
SELECT * FROM Persons WHERE FirstName=’a’
SELECT * FROM Persons WHERE FirstName LIKE ‘a%’
SELECT * FROM Persons WHERE FirstName LIKE ‘%a’
SELECT * FROM Persons WHERE FirstName=’%a%’
Which SQL statement would add a record to the database?
INSERT INTO Designer VALUES ('SMI01', 'M Smith', 'mail@msmith.com', '01224123456')
INSERT VALUES ('SMI01', 'M Smith', 'mail@msmith.com', 01224123456') INTO Designer
INSERT ('SMI01', 'M Smith', 'mail@msmith.com', '01224123456') INTO Designer
INSERT Designer INTO VALUES (''SMI01', 'M Smith', 'mail@msmith.com', '01224123456')
Where does the CREATE Command belong?
DML
DDL
DCL
It is a DML command that is used to display record.
DISPLAY
STRUCTURE
WHERE
SELECT
______________ constraint prevents NULL values
UNIQUE
NOT NULL
NULL
FOREIGN KEY
Which clause is used when we want to use aggregate functions in conditions?
Where
Group By
Having
Both 2 and 3
basierend auf folgender Tabelle
was ist das Ergebnis für folgendes SQL statement?
SELECT * FROM game WHERE Name LIKE '%g';
The Last of Us Part 2,Halo Invinite
Resident Evil 3,Animal Crossing
Animal Crossing
Watchdogs 3
