Font size
WorksheetsExam Practice CS2203 - Databases 1
Total questions: 171
Worksheet time: 1hrs 26mins
The address of a student can be defined using street, city, state, and zip code. What type of attribute should be used to represent the address of a student?
a) Single valued attribute
b) Multi-valued attribute
c) Derived attribute
d) Composite attribute
For the relationship represented in the figure below, which of the following is true
a) An instructor can teach more than one course but does not have to teach any course
b) An instructor must teach at least one course
c) A course has to be taught by more than one instructor
d) A course can be taught by more than one instructor but doesn’t have to be taught by any instructor
In an Entity-Relationship model, which concept is generally used to represent a student?
a) Entity
b) attribute
c) constraint
d) Relationship set
For the relationship represented in the figure below, which of the following is true?
a) Each instructor teaches one or more courses
b) Each instructor has one and only one course
c) Each course is taught by zero and one instructor
d) Each course is taught by many instructors
The E-R model is used to build a conceptual model.
a) True
b) False
Given only the following part of an E-R diagram, what does the hash mark across the relationship line near the entity in the figure below indicate?
a) A minimum cardinality of zero
b) A minimum cardinality of one
c) A maximum cardinality of one
d) Both b & c
For the relationship represented in the figure below, which of the following is true?
a) Each instructor teaches one or more courses
b) Each instructor has one and only one course
c) Each course is taught by zero and one instructor
d) Each course is taught by many instructors
“A student can attend six courses, each with a different instructor. Each instructor has 30 students.”
What is the type of relationship between students and instructors?
a) weak
b) one-to-one
b) one-to-many
d) many-to-many
All instances of a given entity set have the same attributes in the E-R Model.
a) True
b) False
Given only the following part of an E-R diagram, what does the circle across the relationship line near the entity in the figure below indicate?
a) A minimum cardinality of zero
b) A minimum cardinality of one
c) A maximum cardinality of one
d) A maximum cardinality of many
Which of the following is not a component of a database model?
a) Structural component
b) Manipulation component
c) Physical component
d) Data Integrity component
A student's name, birthday, and student number are all examples of:
a) Attributes
b) Relationships
c) Entities
d) Extensions
The degree of a relationship is described as the relationship's maximum cardinality.
a) True
b) False
How can a multivalued attribute be represented in an E-R model?
a) Create a new dependent entity with a 1:N relationship
b) Create a new entity with an M:N relationship
c) Create a new entity with a 1:1 relationship
d) None of the above
Which of the following is WRONG for the E-R diagram below?
a) A librarian can supervise one librarian
b) A librarian can supervise many librarian
c) A librarian can supervise no librarian
d) A librarian can work more than one department
You should resolve an M:M relationship set. The new relationship sets are always
a) Optional on the many side
b) Mandatory on the one side
c) Mandatory on the many side
d) Redundant on the many side
Which of the following is not a problem associated with storing data in a file?
a) Inconsistency occurs when a data item is used multiple times
b) Inability to store partial data
c) Duplication of data items
d) A large amount of disk space is required
In the evolution of database management systems, what does optimization refer to?
a) High Availability
b) Security
c) Performance
d) Scalability
Data modeling includes several models. Which model of data modeling includes the lowest level of abstractions?
a) Internal model
b) External model
c) Conceptual model
d) Physical model
Database systems are used by users, however, users are not considered as a part of a database system.
a) True
b) False
OpenOffice Base is an example of a database.
a) True
b) False
“The maximum number of courses a student can take in one term is 6.”
Which constraint should be used to enforce this statement?
a) Referential integrity constraint
b) Entity integrity constraint
c) Tuple constraint
d) Semantic Integrity Constraint
A relational database stores data in the form of relations.
a) True
b) False
A unique constraint specifies that attribute values must be different.
a) True
b) False
A rule that each foreign key value must match a primary key
value in the other relation is called as?
a) Referential integrity constraint
b) Entity integrity constraint
c) Tuple constraint
d) Semantic integrity constraint
Most of the commercial databases are based on the hierarchical model.
a) True
b) False
Both the primary key and a candidate key can uniquely identify the tuples in a relation.
a) True
b) False
If B is a subset of attributes in set A, then which of the following is wrong?
a) B → A
b) AC → BC
c) AB → B
d) A → B
A deletion anomaly occurs when deleting data about one entity results in the loss of data about another entity.
a) True
b) False
Given a relation R with five attributes A,B,C,D,E with the following dependencies:
AB → C
CD → E
DE → B
What is the candidate key for R?
a) ABD
b) ABC
c) CDE
d) ACE
Given a relation R with three attributes A, B, C with the following dependencies:
ABC → C
C → A
What is the candidate key for R?
a) Candidate key is ABC
b) Candidate key is C
c) Candidate key is A
d) Candidate key is AB
Consider a relation, R (A, B, C, D, E) with the given functional dependencies; A → B, B → DE and D → C. What is the closure (A)?
a) A+ = ABDEC
b) A+ = ADEC
c) A+ = ABEC
d) A+ = ABDC
Consider a relation, R (A, B, C, D, E) with the given functional dependencies; A → B, B → DE and D → C. What is the closure (C)?
a) C+ = C
b) C+ = DC
c) C+ = BC
d) C+ = DEC
Relations should always be normalized to the highest normal form possible.
a) True
b) False
Which of the following is not a goal of normalization?
a) Maximizing data storage space
b) Minimizing data redundancy
c) Simplifying the enforcement of referential integrity
d) Maintaining data effectively
Which of the following is wrong?
a) A relation includes a foreign key matching the primary key of other relation is called an insertion anomaly
b) If the removal of data in one entity results in the unintentional loss of data in another entity is deletion anomaly
c) A relation is in 2NF if and only if it is in 1NF and all non-key attributes are determined by the entire primary key
d) The condition that a non-key attribute determines another non-key attribute is known as transitive dependency
Consider the following table that shows the Movie relation. In the relation, {Movie_Title, Year} form a candidate key. Which of the following is correct about this Movie relation?
a) It is 1NF
b) It is 2NF
c) It is 3NF
d) None of the above
A relation is in BCNF if, and only if, every determinant is a candidate key.
a) True
b) False
Consider a relation that doesn’t include multivalued attributes and non-key attributes in this relation dependent on the primary key. However, this relation contains transitive dependencies. What is the best normal form that R satisfies (1NF, 2NF, 3NF, or BCNF)?
a) 1NF
b) 2NF
c) 3NF
d) BCNF
Which one is not an anomaly type which results from redundancy?
a) Cancelation Anomalies
b) Deletion Anomalies
c) Insertion Anomalies
d) Update Anomalies
Which of the following sentences is incorrect?a)
a) Dependency preserving implies lossless join and vice-versa.
b) Lossless join decomposition must be achieved at all times.
c) Functional Dependencies are a kind of integrity constraints.
d) BCNF is not always achievable.
Which of the following would motivate to de-normalize a relation?
a) Improve performance
b) Relax security
c) Reduce design time
d) End user preference
A relation is in the first normal form if it has no more than one multivalued attribute.
a) True
b) False
Which of the following is not a Numeric Type?
a) BOOLEAN
b) TINYINT
c) SMALLINT
d) BIGINT
Which of the following SQL command is used to define a logical table from one or more tables or views?
a) create a table
b) define a table
c) create view
d) create database
When using SQL create table command, defining constraints is optional.
a) True
b) False
Which of the following SQL command is used for creating a database?
a) create schema
b) create table
c) create view
d) create file
Given the table Instructor (InstructorID, Name, Course), which of the following SQL statements would be used to add new instructor data to the Instructor table?
a) INSERT INTO Instructor SET InstructorID =1111, Name=David, Course =CS 2204
b) INSERT INTO Instructor VALUES (1111, ‘David’, ' CS 2204')
d) INSERT INTO New Instructor VALUES (1111, ‘David’, ' CS 2204')
d) INSERT INTO Instructor VALUES (‘David’, 1111, ' CS 2204')
CREATE TABLE BOOK ( BookID CHAR(20) NOT NULL, Title VARCHAR(30) NOT NULL, PublisherName VARCHAR(20), PRIMARY KEY (BookID) );
Considering SQL statement above, which of the following is wrong?
a) PublisherName can’t be null
b) The name of the created table is BOOK
c) There are three columns in this table
d) Primary key of this table is BookID
Structured Query Language (SQL) is not a complete programming language.
a) True
b) False
Which of the following includes a set of commands used to control access to the data within the database, including security?
a) DCL
b) DML
c) DDL
d) DAL
Create Table EXAMS (
SUB_NO integer Not Null,
STUDENT_NO integer Not Null,
MARK decimal (3),
DATE_TAKEN date,
Primary Key (SUB_NO, STUDENT_NO)
);
The above SQL statement is used to create the EXAMS table. Considering the EXAMS table; which of the following table contents can’t be inserted to the EXAMS table (assume date format is correct)?
a)
b)
c)
The UPDATE command in SQL is used to change the existing values of the columns.
a) True
b) False
Which of the following SQL statements that are used to create tables gives an error?
Create Table EXAMS (
SUB_NO integer Not Null,
STUDENT_NO integer Not Null,
MARK decimal (3) Not Null,
DATE_TAKEN date Not Null,
Primary Key (SUB_NO, STUDENT_NO, DATE_TAKEN));
The above SQL statement is used to create the EXAMS table. Considering the EXAMS table; which of the following table contents can’t be inserted to the EXAMS table (assume date format is correct)?
b)
c)
d)
A NULL value is treated as a blank or 0.
a) True
b) False
Which SQL statement is used to insert new data in a database?
a) Insert Into
b) Insert new
c) Add new
d) Add record
Create Table EXAMS (
SUB_NO integer Not Null,
STUDENT_NO integer Not Null,
MARK decimal (3),
DATE_TAKEN date Not Null,
Primary Key (SUB_NO, STUDENT_NO, DATE_TAKEN));
The above SQL statement is used to create the EXAMS table. Considering the EXAMS table; which of the following table contents can’t be inserted to the EXAMS table (assume date format is correct)?
a)
b)
c)
d)
The CREATE TABLE command creates an empty table-one with no records.
a) True
b) False
Which of the following is an incorrect statement?
a) Host variables are programming language variables that should only be used for static SQL processing.
b) The SQLCODE is one such variable in the data structure which is set to 0 (zero) after every successful SQL execution.
c) SQLSTATE provides a more specific message that is standardized across different database vendor products.
d) Dynamic SQL statements include parameters whose values are not known until runtime when they are supplied as input to the application.
ODBC requires manual installation of the ODBC driver manager and driver on all client machines. JDBC drivers are written in Java and JDBC code is automatically installable, secure, and portable on all platforms.
a) True
b) False
In JDBC, what represents a single instance of a particular database session?
a) a thread
b) an opened connection
c) a closed connection
d) a pipe
The JDBC API is a Java API that can access any kind of tabular data, especially data stored in a relational database.
a) True
b) False
JDBC API is a natural Java interface and is built on ODBC. JDBC retains some of the basic features of ODBC.
a) True
b) False
Which of the following is an incorrect statement?
a) Embedded SQL has the capability of executing SQL statements dynamically.
b) Database APIs are totally dynamic.
c) Database API is used to develop applications independently of target databases.
d) The intermediate layer between the application and programming language is the database connectivity driver.
Which of the following is a definition of Embedded SQL?
a) Hard-coded SQL statements in a programming language such as Java.
b) The process of making an application capable of generating specific SQL code on the fly.
c) Hard-coded SQL statements in a procedure.
d) Hard-coded SQL statements in a procedure.
Which of the following supports both static and dynamic modes of execution?
a) JDBC
b) SQLJ
d) DB2 CLI
e) ODBC
If we write a program in a programming language and switch to SQL when we require to use the database, then the SQL environment in use is known as _______ SQL.
a) Real-time
b) Dynamic
c) PL
d) Embedded
ODBC stands for:
a) Open Database Community
b) Open Database Connectivity
c) Open Source Database Community
d) Open Database Connection
Implementation in the Waterfall model means the construction of a computer system according to a given implementation document.
a) True
b) False
Using the tblProducts Table shown above, which of the following SQL statements returns just the ProductID and ProductName of all the products of which the ProductName includes the string “Cha”?
a) Select ProductID, ProductName from tblProducts;
b) Select ProductID, ProductName from tblProducts Where ProductName like 'Cha%';
c) Select ProductID, ProductName from tblProducts Where ProductName like '%Cha%';
d) Select ProductID, ProductName from tblProducts Where ProductName like '%Cha';
Using the tblProducts Table shown above, which of the following SQL statements returns the total number of products in the tblProducts table?
a) Select From tblProducts Count();
b) Select Count(*) from tblProducts;
c) Select Count(*) from tblProducts Where SupplierID=1;
d) Count(*) tblProducts;
Using the tblProducts Table shown above, which of the following SQL statements returns just the ProductID, CategoryID and ProductName of all the products whose ProductID is NOT 2?
a) Select ProductID, CategoryID, ProductName from tblProducts;
b) Select ProductID =1, ProductID=3, ProductID=4 from tblProducts;
c) Select ProductID, CategoryID, ProductName from tblProducts Where ProductID <>2;
d) Select ProductID, CategoryID, ProductName from tblProducts Where ProductID = 2;
Assume that there is a table called “Shippers”. Return all the fields from the “Shippers” table.
a) Select * from Shippers;
b) Alter * from Shippers;
c) Insert * from Shippers;
d) Bring * from Shippers;
Using the tblProducts Table shown above, which of the following SQL statements returns just the ProductID, CategoryID, and ProductName of all the products with SupplierID of 1 and CategoryID of 1?
a) Select ProductID, CategoryID, ProductName from tblProducts Where SupplierID =1 and CategoryID=1;
b) Select ProductID, CategoryID, ProductName from tblProducts;
c) Select ProductID, CategoryID, ProductName from tblProducts Where CategoryID =1;
d) Select SupplierID =1, CategoryID=1, ProductName from tblProducts;
Using the tblProducts Table shown above, which of the following SQL statements returns the total number of products that come from SupplierID=1 in the tblProducts table?
a) Select From tblProducts Count();
b) Select Count(*) from tblProducts;
c) Select Count(*) from tblProducts Where SupplierID=1;
d) Count(*) tblProducts;
For a given conceptual data model, it is not necessary that all the user requirements it represents be satisfied by a single database.
a) True
b) False
Which of the following data types used in SQL could be used to define a fixed-length text field of 20 characters?
a) char(20)
b) varchar(20)
c) fixed(20)
d) bit(20)
When an accounting application creates new orders in the orders table, which SQL statements of the following should be used?
a) DCL
b) DML
c) DDL
d) DAL
What does “a named column of a relation” refer to?
a) Attribute
b) Domain
c) Tuple
d) Relation
SELECT LECTURERS.SURNAME, LECTURERS.SURNAME FROM LECTURERS, LECTURERS WHERE DEPT_NO = DEPT_NO ;
The above query is syntactically correct.
a) True
b) False
Which SQL statement is used to return only different values?
a) SELECT UNIQUE
b) SELECT IDENTITY
c) SELECT DIFFERENT
d) SELECT DISTINCT
You should resolve an M:M relationship set. The new relationship sets are always:
a) Optional on the many side
b) Mandatory on the one side
c) Mandatory on the many side
d) Redundant on the many side
Which of the following statements is wrong?
a) Aggregate functions are mostly used in the WHERE clause of a SELECT statement.
b) When using the equivalence operator (=) in the predicate, you must make sure that the subquery retrieves exactly one value.
c) SQL's concept of joining two or more tables also applies to joining two copies of the same table.
c) Output of the COUNT() function is the number of rows or column values that would be selected by the query.
With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?
a) SELECT * FROM Persons SORT BY 'FirstName' DESC
b) SELECT * FROM Persons ORDER BY FirstName DESC
c) SELECT * FROM Persons ORDER FirstName DESC
d) SELECT * FROM Persons SORT 'FirstName' DESC
CREATE TABLE tblOrderDetails (
OrderID int NULL,
ProductID int NULL,
UnitPrice float NOT NULL,
Quantity smallint NOT NULL,
Discount real NOT NULL
);
Which of the following SQL statements gives an error while defining Primary Key for the above table?
a) CREATE TABLE tblOrderDetails (
OrderID int NULL,
ProductID int NULL,
UnitPrice float NOT NULL,
Quantity smallint NOT NULL,
Discount real NOT NULL
Primary Key (OrderID)
);
a) CREATE TABLE tblOrderDetails (
OrderID int NULL,
ProductID int NULL,
UnitPrice float NOT NULL,
Quantity smallint NOT NULL,
Discount real NOT NULL
CONSTRAINT Primary Key (ProductID)
);
c) CREATE TABLE tblOrderDetails (
OrderID int NULL,
ProductID int NULL,
UnitPrice float NOT NULL,
Quantity smallint NOT NULL,
Discount real NOT NULL
);
Alter Table tblOrderDetails Add Primary Key (OrderID)
d) CREATE TABLE tblOrderDetails (
OrderID int NULL,
ProductID int NULL,
UnitPrice float NOT NULL,
Quantity smallint NOT NULL,
Discount real NOT NULL
Primary Key (OrderID, ProductID)
);
Which of the following is a UNION query?
a) Combines the output from no more than two queries and must include the same number of columns.
b) Combines the output from no more than two queries and does not include the same number of columns.
c) Combines the output from multiple queries and must include the same number of columns.
d) Combines the output from multiple queries and does not include the same number of columns.
Create Table EXAMS (
SUB_NO integer Not Null,
STUDENT_NO integer Not Null,
MARK decimal (3),
DATE_TAKEN date);
The above SQL statement is used to create the EXAMS table. Considering the EXAMS table; which of the following table contents can’t be inserted to the EXAMS table (assume date format is correct)?
a)
b)
c)
d)
Create Table EXAMS (
SUB_NO integer Not Null,
STUDENT_NO integer Not Null,
MARK decimal (3),
DATE_TAKEN date Not Null,
Primary Key (SUB_NO, STUDENT_NO, DATE_TAKEN));
The above SQL statement is used to create the EXAMS table. Considering the EXAMS table; which of the following table contents can’t be inserted to the EXAMS table (assume date format is correct)?
a)
b)
c)
d)
Considering the above E-R diagram; which of the following statements is WRONG when this E-R diagram is implemented in a SQL database?
a) If there is a SaleID with S1 value in SALE_ITEM table, S1 also has to be in SALE table.
b) If there is a SaleID with S1 value in SALE table, there can be more than one tuple that include S1 value at the SaleID column.
c) If there is an ItemID with I1 value in ITEM table, I1 also has to be in SALE_ITEM table.
d) If there is an ItemID with I1 value in SALE_ITEM table, I1 also has to be in ITEM table.
INSERT INTO SUBJECTS VALUES (1, 'Mathematics', 1, NULL, 65 ); This SQL statement always causes an error.
a) True
b) False
What are the basic categories of the SQL language based on functionality?
a) Data definition
b) Data modification
c) Data control
d) All of the above
Which of the following SQL statements that are used to create tables gives an error?
a) Create Table Students( Name char(10)
Not Null, SureName char (40));
b) Create Table StudentsFriends( Name char(20) Not Null, SureName varchar (50));
c) Create Table StudentsFriendsandFamily( Name char(30) Not Null, Name varchar (40));
d) Create Table StudentsFriendsandInstructors( Name char(30) Not Null, SureName varchar (30));
Which of the following SQL statements that are used to create tables gives an error?
a) Create Table Instructor(
ID char(10) Not Null, Name varchar (40),
SureName varchar (40));
b) Create Table Instructor(
ID integer Not Null, Name varchar (40), SureName varchar (40),
CONSTRAINT pk Primary Key (ID));
c) Create Table Instructor(
ID integer Not Null, Name varchar (40), SureName varchar (40),CONSTRAINT pk Unique (ID));
d) Create Table Instructor(
ID integer Not Null, Name varchar (40), SureName varchar (40),
CONSTRAINT pk Primary Key (ID),
CONSTRAINT pk Unique (ID));
A rule that each foreign key value must match a primary key value in the other relation is called as?
a) Referential integrity constraint
b) Entity integrity constraint
c) Tuple constraint
d) Semantic integrity constraint
CREATE VIEW Freshman
AS Select * From Students Where Year = 2;
Considering the above Students table and Freshman view, what will be the result of the following SQL query:
Select * From Freshman Where Dept_No=2;
a)
b)
c)
d)
Identify the result of the following SQL statement:
SELECT eid FROM Competes, Competitor WHERE Competes.cid=Competitor.cid AND nationality = 'Swedish'
a) 01
b) 02
c) 03
d) 04
e)
A user is setting up a join operation between tables EMP and DEPT. There are some employees in the EMP table that the user wants returned by the query, but the employees are not assigned to departments yet. Which SELECT statement is most appropriate for this user?
a) Select e.empid, d.head from emp e, dept d;
b) Select e.empid, d.head from emp e, dept d where e.dept# = d.dept#;
c) Select e.empid, d.head from emp e, dept d where e.dept# (+) = d.dept#;
d) Select e.empid, d.head from emp e right outer join dept d on e.dept# = d.dept#;
The following SQL is which type of join: SELECT CUSTOMER_T. CUSTOMER_ID, ORDER_T. CUSTOMER_ID, NAME, ORDER_ID FROM CUSTOMER_T,ORDER_T WHERE CUSTOMER_T. CUSTOMER_ID = ORDER_T. CUSTOMER_ID MC
a) Equi-join
b) Natural join
c) Outer Join
d) Cartesian Join
A primary key of a relation should be part of every other relation to provide referential integrity.
a) True
b) False
Using the tblProducts Table shown above, which of the following SQL statements returns ProductID and ProductName columns?
a) Select * from tblProducts;
b) Select * from tblProducts Where ProductID=1;
c) Select * from tblProducts Where ProductID=1 and ProductName ='Chai';
d) Select ProductID, ProductName from tblProducts;
The Database Administrator is responsible for developing the logical data model.
a) True
b) False
A relational database can be defined as a self-describing collection of related tables.
a) True
b False
a result of select stament can contain duplicate rows
a) True
b) False
using insert into statement several rows can be added at a time
a) True
b) False
SQL can only be used as Data manipulation Language
a) True
b) False
Create Table EXAMS (
SUB_NO integer Not Null,
STUDENT_NO integer Not Null,
MARK decimal (3),
DATE_TAKEN date,
Primary Key (SUB_NO));
a)
b)
c)
d)
Which of the following is an incorrect statement? Select one:...
a) Access plans for dynamic SQL statements are generated only at runtime.
b) Dynamic SQL applications are slower than static SQL applications.
c) The access plan generated for a static SQL statement is stored in advance.
d) If the static SQL part of the application is modified, then the regeneration of access plans is not needed.
Which of the following is an incorrect statement?
a) Access plans for dynamic SQL statements are generated only at runtime.
b) Dynamic SQL applications are slower than static SQL applications.
c) The access plan generated for a static SQL statement is stored in advance.
d) If the static SQL part of the application is modied, then the regeneration
of access plans is not needed.
Which of the following is an incorrect statement?
a) A precompiler is required to translate embedded SQL.
b) A precompiler is required to translate SQLJ.
c) Embedded SQL uses variables in the host language to pass parameters to SQL queries.
d) JDBC uses variables in the host language to pass parameters to SQL queries.
Create Table EXAMS (
SUB_NO integer Not Null,
STUDENT_NO integer Not Null,
MARK decimal (3),
DATE_TAKEN date);
The above SQL statement is used to create the EXAMS table. Considering the EXAMS table; which of the following SQL statements
can be used to DROP the DATE_TAKEN column of the EXAMS table?
a) Alter Table EXAMS Drop DATE_TAKEN;
b) Alter EXAMS Drop DATE_TAKEN;
c) Alter Table DATE_TAKEN Drop EXAMS;
d) Alter Table Drop DATE_TAKEN;
What is wrong about a surrogate key?
a) A surrogate is an attribute or set of attributes that uniquely identifies a record in a relation
b) A surrogate key does not exist in the real world as a real attribute of an entity set
c) A surrogate key is usually a generated unique number
d) It is not a good practice to use a surrogate key
The SQL ALTER statement can be used to:
a) change the table data.
b) change the table structure.
c) delete rows from the table.
d) add rows to the table.
A relational database query normally returns many rows of data. But an application program usually deals with one row at a time. Which of the following is used to bridge this gap allowing the program to deal with on row at a time.
a) cursor
b) Trigger
c) PL/SQL
using the tblProducts table shown above, which columns could be a PRIMARY KEY OF ANOTHER table
a) SupplierID
b) CategoryID
c) ProductName
d) All of the above
To be in the third normal form, the relation deosnt need to be in the second normal form
a) True
b) False
Using the tblProducts Table shown above, which of the following SQL statements returns ProductID and ProductName of all the products whose CategoryID is either 2 or 3?
a) Select ProductiD, ProductName from tblProducts:
b) Select ProductiD, ProductName from tblProducts Where CategoryID=-2 and CategorylD=3:
c) Select ProductID, ProductName from tblProducts Where CategoryID e>1
d) select ProductID,ProductName from tblProducts where CategoryID=2 or CategoryID=3;
Data analysis begins with the statement of data design.
a) True
b) False
Which of the following is wrong?
a) If A → BC, then A → B and B → C
b) If A → B and B → C, then A → C
c) If A → B and A → C, then A → BC
d) If A → B and C is another attribute, then AC → BC
Which of the following SQL data types should not be used to define the numeric data:111.11?
a) integer(3,2)
b) numeric(3,2)
c) numeric(4,2)
d) numeric(5,2)
Which of the following is wrong about domains of a
relation?
a) Two or more attributes can be defined on the same
domain
b) A tuple can draw values from different domains
c) Two attributes that include values from different
domains can easily be compared
d) A pool of atomic values constitutes a domain
Using the tblProducts Table shown above, which of the columns could be a Primary Key of another table
a) SupplierID
b) CategoryID
c) ProductName
d) All of the above
Database application development is the process of obtaining real-world requirements,
analyzing requirements, designing the data and functions of the system, and then
implementing the operations in the system
a) True
b) False
The result of a SELECT statement can contain duplicate rows.
a) True
b) False
ODBC can be directly used with Java because it uses a C interface.
a) True
b) False
Which of the following is NOT true about the functional dependency A → (B, C)?
a) B is functionally dependent on A
b)A determines C
c) B and C together determine A
d) B and C are functionally dependent on A
Considering all the other tables exist in the database, which of the following SQL
statements that are used to create tables gives an error?
a) Create Table Instructor(
ID integer Not Null,
Name varchar (40),
SureName varchar (40),
Primary Key (ID),
Unique (ID)
);
b) Create Table Instructor(
ID integer Not Null,
Name varchar (40),
SureName varchar (40),
CONSTRAINT pk Primary Key (ID)
);
c) Create Table Instructor(
ID integer Not Null,
Name varchar (40),
SureName varchar (40),
Primary Key (ID),
Foreign Key (Name)
);
d) Create Table Instructor(
ID integer Not Null,
Name varchar (40),
SureName varchar (40),
Primary Key (ID),
Foreign Key (Name) References Departments
)
Referential integrity constraints are concerned with checking INSERT and UPDATE
operations that affect the parent child relationships.
a) True
b) False
Which of the following SQL command is used for adding one or more new columns to a table?
a) create schema
b) create table
c) alter table
d) alter file
The standards for SQL has been maintained by The American National Standards Institute (ANSI).
a) True
b) False
Consider the following database:
MOVIE(id,title,yr) ACTOR(id,name) CASTING(movieid,actorid)
Identify the SQL command which will return the titles of all 1959 Marilyn Monroe films.
a) option 1
Option 1. The following SQL...
SELECT title FROM movie,casting,actor WHERE movieid = movie.id<> AND name = 'Marilyn Monroe' ;
b) Option 2
The following SQL...
SELECT title FROM movie,actor WHERE name = 'Marilyn Monroe' AND yr = 1959 ;
c) Option 3
The following SQL...
SELECT title FROM movie,casting,actor WHERE movieid = movie.id AND actor.id = actorid AND name = 'Marilyn Monroe' AND yr = 1959 ;
d)
The following SQL...
SELECT title FROM movie,casting,actor WHERE movieid = movie.id AND actor.id = actorid AND movie.yr = casting.yr AND name = 'Marilyn Monroe' AND yr = 1959 ;
Data integrity is concerned with ensuring that any new data that is added to the tables is compatible with the existing inter-table relationships.
a) True
b) False
Which SQL keyword is used to sort the result-set?
a) SORT
b) ORDER
c) ORDER BY
d) SORT
Which of the following statements is wrong?
a) The CREATE TABLE command is a part of SQL's DDL
b) The ALTER TABLE command is a part of SQL's DDL
c) The DROP TABLE command is a part of SQL's DDL
d) The SELECT TABLE command is a part of SQL's DDL
Assume that you are dealing with money and you do a lot of calculations that you want them to be exact. Which of the following data types is the best option to store this in a relation?
a) integer
b) decimal(10,2)
c) varchar(12)
d) char(12)
Which of the following statements is true concerning subqueries?
a) Involves the use of an inner and outer query
b) Cannot return the same result as a query that is not a subquery.
c) Does not start with the word SELECT.
d) All of the above.
Using the tblProducts Table shown above, which of the following SQL statements returns just the ProductID, CategoryID and ProductName of all the products and order the results by CategoryID?
a) Select ProductID, ProductName from tblProducts Order By CategoryID;
b) Select ProductID, CategoryID, ProductName from tblProducts Order By CategoryID;
c) Select ProductID, CategoryID, ProductName from tblProducts Where CategoryID=1 Order By CategoryID;
d) Select ProductID, CategoryID, ProductName Order By CategoryID;
Which of the following is not a property of a data model?
a) The blueprint of any database system
b) Defines relationships between managed objects
c) Includes many details
d) Intended for software developers
Create Table EXAMS (
SUB_NO integer Not Null,
STUDENT_NO integer Not Null,
MARK decimal (3),
DATE_TAKEN date);
a)
b)
c)
d)
e)
NONE
Which of the following SQL command can’t be used to create the Student relation below:
a) CREATE TABLE Student(
Student_ID int,
Student_Name varchar(100),
Dept_Name varchar(100),);
b) CREATE TABLE Student(
Student_ID int,
Student_Name char(100),
Dept_Name char(100),);
c) CREATE TABLE Student(
Student_ID int,
Student_Name char(50),
Dept_Name char(50),);
d) CREATE TABLE Student(
Student_ID boolean,
Student_Name char(100),
Dept_Name char(100),);
CREATE VIEW Freshman
AS Select * From Students Where Year = 1;
Considering the above Students table and Freshman view, what will be the result of the following SQL query:
Select * From Freshman Where Dept_No=4;
a)
b)
c)
d) None of the above
Create Table EXAMS (
SUB_NO integer Not Null,
STUDENT_NO integer Not Null,
MARK decimal (3),
DATE_TAKEN date);
The above SQL statement is used to create the EXAMS table. Considering the EXAMS table; which of the following table contents can’t be inserted to the EXAMS table (assume date format is correct)?
a)
b)
c)
d)
Create Table EXAMS (
SUB_NO integer Not Null,
STUDENT_NO integer Not Null,
MARK decimal (3),
DATE_TAKEN date);
The above SQL statement is used to create the EXAMS table. Considering the EXAMS table; which of the following SQL statements is used to define the primary key of the EXAMS table?
a) Alter Table EXAMS Primary Key (SUB_NO);
b) Alter Table EXAMS Add Primary Key (SUB_NO);
c) Alter Table Add SUB_NO Primary Key (EXAMS);
d) Alter Table SUB_NO Add Primary Key (EXAMS);
Create Table EXAMS (
SUB_NO integer Not Null,
STUDENT_NO integer Not Null,
MARK decimal (3),
DATE_TAKEN date,
Primary Key (SUB_NO, STUDENT_NO));
This SQL statement is used to create the EXAMS table. Considering the EXAMS table; which of the following table contents cannot be inserted to the EXAMS table (assume date format is correct)?
a)
b)
c)
d)
Which SQL command cannot be used to create the Student relation below?
a)
CREATE TABLE Student( Student_ID int, Student_Name char(100), Dept_Name char(100),);
b)
CREATE TABLE Student( Student_ID char(20), Student_Name char(100), Dept_Name char(100),);
c)
CREATE TABLE Student( Student_ID int, Student_Name varchar(100), Dept_Name varchar(100),);
d)
CREATE TABLE Student( Student_ID int, Student_Name char(20), Dept_Name char(20),);
Students (StudentID, Name, Grade)
A Students table is shown above.
Which of the following partial SQL query phrases to retrieve data for Students with a grade greater than 60?
a) Where Grade=60
b) Where Grade>60
c) Where Grade<60
d) Having Grade>60
Considering the below dependency diagram. Which of the following statements is wrong?
a) Candidate key: ISBN, CopyNr and Author
b) Primary key: BookID, CopyNr and Author
c) AuthorBornYear was dependent on Author
d) Title and PublYear were dependent on BookID
Consider a relation, R (A, B, C, D, E) with the given
functional dependencies; A → B, B → E and D → C.
What is the closure (A)?
a) A+ = ABE
b) A+ = ABDEC
c) A+ = ADEC
d) A+ = ABDC
What is the Primary Key of this table?
a) ProjectID
b) EmpID, ProjectID
c) EmpID
d) ProjectID, Budget
A pool of atomic values constitutes a domain.
a) True
b) False
Which of the following is wrong about domains of a relation?
a) Two attributes that include values from different domains can easily be compared
b) Two or more attributes can be defined on the same domain
c) A tuple can draw values from different domains
d) A pool of atomic values constitutes a domain
Considering the below E-R diagram. Which of the following statements is wrong?
a) The store has to provide its phone number.
b) For each sale, tax has to be calculated.
c) Each item has to have a description.
d) A customer has to give his/her phone number.
Which of the following is wrong about the
functional dependency A → (B, C, D)?
a) B, C, and D together determine A
b) C is functionally dependent on A.
c) A determines D.
d) B, C, and D are functionally dependent on A
Two attributes that include values from different domains can easily be compared.
a) True
b) False
A Database Administrator is responsible for developing logical data model.
a) True
b) False
Create Table EXAMS (
SUB_NO integer Not Null,
STUDENT_NO integer Not Null,
MARK decimal (3),
DATE_TAKEN date,
Primary Key (SUB_NO));
Considering the EXAMS table; which of the following SQL statements could be used to define the foreign key of the EXAMS table?
a) Alter Table EXAMS Foreign Key (SUB_NO);
b) Alter Table SUB_NO Add Foreign Key (EXAMS);
c) Alter Table EXAMS Add STUDENT_NO as Foreign Key (EXAMS);
d) Alter Table EXAMS Add Foreign Key (STUDENT_NO) References STUDENTS;
The DROP TABLE command is a part of SQL's DDL.
a) True
b) False
Which of the following SQL keywords can be used to select partial values?
a) SEARCH
b) SUBSTRING
c) FIND
d) LIKE
Create Table SALE(
SaleID integer,
SaleDate date,
Tax decimal,
Total decimal );
Create Table ITEM(
ItemID integer,
Name char(30),
Cost decimal,
Price decimal );
Create Table SALE_ITEM(
SaleID integer,
SaleItemID integer );
Considering the SQL create statements;
assume that SALE, SALE_ITEM and ITEM tables were created without Primary Keys and Foreign Keys.
Which of the following SQL statements gives an error?
a)
b)
c)
d)
Which of the following statements is incorrect?
a) SQL was developed by IBM in the late 1970s.
b) A surrogate key does not exist in the real world as a real attribute of an entity set.
c) SQL can only be used as a Data Manipulation Language (DML).
d) The standards for SQL has been maintained by The American National Standards Institute (ANSI).
The output of the COUNT() function is the number of rows or column values that would be selected by the query.
a) True
b) False
Which of the following keywords is not one of the SQL built-in functions?
a) MAX
b) AVG
c) MODE
d) COUNT
Considering all the other tables exist in the database, which of the following SQL statements that if used to create tables would give an error?
a)
b)
c)
d)
Which of the following SQL statements that if used to create tables would give an error?
a)
b)
c)
d)
You want to determine the cardinality of a database that matches persons with (official) ID cards. From a government perspective, what would be the ideal cardinality for a relation Person – ID card?
a) many to any
b) many to many
c) one to many
d) one to one
e) any to any
What is the meaning of DDL?
a) Double Data Logic
b) Delta Dynamic List
c) Data Dynamic Language
d) Data Definition Language
e) Data Dynamic Logic
Which of the following is NOT a type of access or manipulation for data queries?
a) Retrieval of Information stored in the database
b) Insertion of new information into the database
c) Interpretation of information stored in the database
d) Deletion of information from the database
e) Modification of information stored in the database
Which of the following is NOT a well-known database system?
a) Microsoft SQL
b) MySQL
c) Oracle
d) PostgreSQL
e) Adobe Application Manager
What is the difference between an instance and a schema?
a) The collection of information stored in the database at a particular moment is called a schema of the database. The overall design of the database is called the database instance.
b) The collection of information stored in the database at any time is called an instance of the database. The overall design of the database is called the database schema.
c) The relations and entities stored in the database that have a one-to-many cardinality are called an instance of the database. The overall collection of data in the database is called the database schema.
d) The collection of particular moments in the database are called an instance of the database. The overall duration of the database is called the database schema.
e) The collection of information stored in the database at a particular moment is called an instance of the database. The overall design of the database is called the database schema.
What would a basic SQL query look like?
a) SELECT * FROM DATA
b) SELECT * OF DATA
c) CHOOSE * FROM DATA
d) PRINT * OF DATA
e) LIST * FROM DATA
What are the two main architectures for DBMS’s?
a) The Last-in-first-out (LIFO) architecture and the First-in-first-out (FIFO) architecture
The Last-in-first-out (LIFO) architecture and the First-in-first-out (FIFO) architecture
b) The Fast Output and the Ultra Fast Output (UFO) architecture
c) The two-tier and the three-tier architecture
d) The FBI and the CIA security architecture
e) The normalized and the hypernormalized architecture
