SER322 Final
For non-disjoint and/or non-complete class hierarchy, which of the following statements are true when mapping from ER to relational model.
-primary key of the superclass table is used as the primary key of the new table. -a table is created for each subclass entity set with a -column for each of the attributes of that entity set plus one for each attribute of the primary key of the superclass entity set -a table is created for each superclass entity set according to the normal entity set translation method.
Suppose relation R(A,B) has the following tuples:A B2 a4 t2 g4 c9 tand relation S(B,C,D) has the following tuples:B C Dc 5 6a 7 8t 8 3 Compute the theta-join of R and S with the condition R.B = S.B AND R.A < S.C Which of the following tuples is in the result? Assume each tuple has schema (A, R.B, S.B, C, D).
(2, g, t, 8, 3)
Suppose R(A, B) has the following tuples: A B 3 3 6 5 2 3 and relation S(B, C) has the following tuples: B C 1 6 5 8 3 5 Compute the natural join of R and S. Which of the following tuples is in the resulting relation with schema (A, B, C).
(3 3 5)
Suppose relation R(A,B,C) has the following tuples: ABC123427456253126 Compute the projection π C,B (R). Which of the following tuples is in the result?
(7,2)
On the XML below, which XPath expression will return all of the values of title attributes? <slideshowtitle="Sample Slide Show"date="Date of publication"author="Yours Truly"><!-- TITLE SLIDE --><slide type="all"><title>Wake up to WonderWidgets!</title></slide><!-- OVERVIEW --><slide type="all"><title>Overview</title><item>Why <em>WonderWidgets</em> are great</item><item>Who <em>buys</em> WonderWidgets</item></slide></slideshow>
//@title
Assume that a relation R has the following properties. What is the normal form of R? Has no multi-valued attributes Has no partial key dependencies Has attributes with atomic domains Has transitive dependencies
1NF & 2NF
The following keyword selects records that have matching values in both tables.
INNER JOIN
The database system must take special actions to ensure that transactions operate properly without interference from concurrently executing database statements. This property is referred to as _________.
Isolation
Which of the following provides the application-to-JDBC Manager connection.
JDBC API
Which statement about JDBC is true?
JDBC stands for Java Database Connectivity
During translation of SQL queries into relational algebra queries, Anti-join is used for unnesting ________ subqueries.
NOT EXISTS, NOT IN, ALL
The division operation is applied to two relations: R(Z) divided by S(X) where __________.
X is a subset of Z
The type of XML Parsing that is parses an XML document based on expression and is used extensively in conjunction with XSLT.
XPath Parsing
Which one of the following is always a single-valued attribute?
a person's age
During mapping weak entity sets of (E)ER model to relational model, primary key of the weak entity set is
discriminator plus foreign key
For many-to-many relationships being represented in relational model, primary key of the new schema is the foreign key of relation with less cardinality.
false
Considering functional dependency, one in which removal from some attributes must affect dependency is called ________.
full functional dependency
All functional dependencies must _________.
have attributes of the same table
Well formed XML document means
must contain one or more elements and root element must contain all other elements
In relational model terminology, table is considered as
relation
The goals for mapping a (E)ER model to Relational model are:
Preserve all information Minimize null values Maintain constraints to extent possible
_____ constraint dictates that the foreign key must contain values that match the primary key in the related table, or must contain null.
Referential Integrity
Match the resource type with the best description
Represents the socket between client and server Connection Represents a query to the database Statement Corresponds to a cursor in the database server ResultSet Represents a pre-compiled and/or parameterized query Prepared Statement
With SQL, how do you select all the records from a table named "Students" where the "FirstName" is Jack and "Marks" are greater than 65?
SELECT * FROM Students WHERE FirstName='Jack' AND Marks>65;
Query Processing involves which of the following steps:
Scanning query tokens Parsing to check query syntax Validation check of all attribute and relation names Creation of a query graph Devise a Query execution strategy
Assume that a relation R has the following properties. What is the normal form of R? No multi-valued attributes No partial key dependencies
Second Normal Form
What is the purpose of select operation in Relational Algebra?
Selects all tuples that satisfy the selection condition from a relation R.
_____ is a attribute (or a set of attributes) in a database relation that has a unique value.
Super Key
Which of the following are not benefits of XML over traditional relational data modelling?
Support for Large Objects (LOBs)
For mapping one to one relationship without total participation from ER model to relational model, the following is true.
There is one column for each participating entity set's primary key.
Consider the following relations for a database that keeps track of business trips of salespersons in a sales office: SALESPERSON (SSN, Name, Start_Year, Dept_No) TRIP (TripID, SSN, From_City, To_City, Departure_Date, Return_Date) EXPENSE (TripID, Account#, Amount) Identify the foreign keys for this schema.
TripID in EXPENSE relation references TRIP relation; SSN in TRIP relation references SALESPERSON relation
Consider the following relations for a database that keeps track of business trips of salespersons in a sales office: SALESPERSON (SSN, Name, Start_Year, Dept_No) TRIP (TripID, SSN, From_City, To_City, Departure_Date, Return_Date) EXPENSE (TripID, Account#, Amount) Which one of the following is a valid super key for TRIP relation?
TripID, SSN, Return_Date
Which type of driver provides JDBC access via one or more ODBC drivers?
Type 1 driver
Which of the following operation(s) require that relations on which they are applied be union-compatible?
UNION INTERSECTION DIFFERENCE
How do you change the marks of all students in Students table with marks 65 to 70 with SQL.
UPDATE Students SET Marks=70 WHERE Marks = 65;
With the code below, indicate JDBC coding best practices that have been violated (this code does compile and run!): import java.sql.*; public class StudentData{public static void main(String[] args) {ResultSet rs = null;Statement stmt = null;Connection conn = null;try {Class.forName("org.postgresql.Driver");conn = DriverManager.getConnection(args[2], args[0], args[1]);stmt = conn.createStatement();rs = stmt.executeQuery("SELECT * FROM Student WHERE rollno='" + args[3] + "'");while (rs.next()) {System.out.print(rs.getInt(1) + "\t");System.out.print(rs.getString(2) + "\t ");System.out.print(rs.getInt(3) + "\t ");System.out.println(rs.getDate(4));}stmt.close();stmt = null;rs.close();rs = null;}catch (Exception exc) {exc.printStackTrace();}}}
Answers 1-6 all apply
Which of the following has "all-or-none" property in Transaction processing?
Atomicity
A transaction is delimited by statements (or function calls) of the form __________.
Begin transaction and End transaction
__________ states that only valid data will be written to the database.
Consistency
With SQL, how can you delete the records from "Students" table where the "LastName" is Williams .
DELETE FROM Students WHERE LastName ='Williams';
When XML is used as a DDL, we want to ensure the XML conforms to this so structural constraints may be specified:
DTD or XML Schema
During translation of SQL queries into relational algebra queries, Semi-join is used for unnesting ________ subqueries.
EXISTS, IN, ANY
For disjoint AND complete mapping class hierarchy, a table is created for the super class entity set during mapping to relational model.
False
In the __________ normal form, a composite attribute is converted to individual attributes.
First
Which SQL keyword is used to group rows with same values .
GROUP BY
Which is a bottom-up approach to database design that decomposes unsatisfactory relations by breaking up their attributes into smaller relations?
Normalization
Which SQL keyword is used to sort the result-set in descending order using the NAME column?
ORDER BY NAME DESC
Composite attribute in ER model is represented in relational model as ________________.
One column for each component attribute and NO column for the composite attribute
In JDBC, it is a good practice to use standard SQL statement and avoid using db specific query until necessary.
true
