Quiz
ERD & Normalisation & SQL
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (38)
1One of the disadvantage of the traditional file-based system is:
- AUnfixed queries
- BEasy to update and change structure
- CIncompatible file formats
- DAd hoc queries
2Which of the following is true in RDBMS
- AA) Data Definition Language is used to identify data types and structures
- BB) Data Definition Language is used to write query language (e.g. SQL)
- CC) Data Manipulation Language is used to write query language (e.g. SQL)
- DA & C
3Which of the following is true in RDBMS
- AA table is a tuple
- BA row is a relation
- CA column is a attribute
- DAn atomic place in a table is a cell
- EA column is an entity
4As part of the relation properties:
- AEach attribute has a distinct name
- BThe number of columns is called cardinality
- CThe number of tuples is called degree
- DAll of the above
- ENone of the above
5What is the difference between a Superkey and Candidate key
- AA candidate key is the superkey key that is selected to identify rows uniquely within the relation
- BA superkey is the candidate key that is selected to identify rows uniquely within the relation
- CA candidate is a combination of columns that uniquely identifies any row within RDBMS, while a superkey can be any column or a combination of columns that can qualify as unique key in RDBMS
- DA superkey is a combination of columns that uniquely identifies any row within RDBMS, while a candidate key can be any column or a combination of columns that can qualify as unique key in RDBMS
6Which of the following is true in RDBMS:
- AA) There can be many superkeys. Some of the superkeys are candidate keys. One of the candidate keys is the primary key
- BB) A superkey is a candidate key such that no proper subset of it is a primary key within the relation
- CC) When we introduce a new artificial key to solve a duplicate foreign key problem, this is called a surrogate key
- DA & B are true
7Which of the following is true in RDBMS
- ARelational integrity is a set of rules which ensures that the data is accurate
- BA foreign key is an attribute (or a set of attributes) that matches the candidate key of some relation
- CThe purpose of the foreign key is to ensure referential integrity of the data
- DAll of the above is true
8What is the difference between an Entity and an Entity Type
- AAn entity type is something about which information needs to be recorded, while an Entity is a concept that is identified as having an independent existence
- BAn entity is something about which information needs to be recorded, while an entity type is a concept that is identified as having an independent existence
- CBoth are true
- DBoth are false
9Which of the following examples refer to a composite attribute
- ATel_No attribute is a composite one, as one may have more than one telephone number
- BAddress attribute is a composite one, as it contains number, street, town, zip code, and other components
- CBoth are composite attributes
- DBoth are not composite attributes
10Which of the following examples refer to a multivalued attribute
- ATel_No attribute is a multivalued one, as one may have more than one telephone number
- BAddress attribute is a multivalued one, as it contains number, street, town, zip code, and other components
- CBoth are multivalued
- DBoth are not multivalued
11What does the following two shapes indicate in an ER diagram
- A"Multivalued Attribute" & "Relationship"
- B"Weak Entity" & "Relationship"
- C"Derived Attribute" & "Relationship"
- D"Derived Entity" & "Relationship"
12What does the following two shapes indicate in an ER diagram
- A"Derived Attribute" & "Composite Attribute"
- B"Multivalued Attribute" & "Total Participation"
- C"Derived Attribute" & "Multivalued Attribute"
- D"Weak Entity" & "Multivalued Attribute"
13What does the following two shapes indicate in an ER diagram
- A"Multivalued Attribute" & "Weak Entity"
- B"Weak Entity" & "Multivalued Attribute"
- C"Derived Attribute" & "Total Participation"
- D"Multivalued Attribute" & "Total Participation"
14What is the original cardinality ratio of the following relationship between Student & Module
- AOne to Many (1:M)
- BOne to One (1:1)
- CMany to Many (M:N)
- DMany to One (M:1)
15Which of the following statements is true for he below ER diagram
- ABranchNo is a primary key, and BRANCHES is a weak entity with a partial participation with BANK
- BBranchNo is a foreign key, and BANK is a derived entity with a total participation with BANK BRANCH
- CCode is a primary key, and BANK BRANCH is a weak entity with a total participation with BANK
- DBranchNo is a primary key and BANK BRANCH is a multivalued entity with a partial participation
16Which of the following languages is responsible for granting and revoking users permission on the Database
- AData Control Langauge
- BData Definition Language
- CData Manipulation Language
- DData Policy Langauge
- ENone of the above
17Which of the following is true to create a table called staff, with the following fields:
StaffNo as an Integer, Salary as a Float, Lname as a text field with 20 characters- ACREATE Staff (StaffNo, Salary, Lname, AS INTEGER, FLOAT, STRING (20));
- BCREATE Staff (StaffNo INTEGER, Salary FLOAT, Lname CHAR(20));
- CCREATE TABLE Staff (StaffNo INTEGER, Salary FLOAT, Lname CHAR(20));
- DCREATE TABLE Staff (StaffNo INTEGER, Salary FLOAT, Lname VARCHAR(20));
- ENone of the above
18Which of the following is true to insert into table called staff a row with the following fields:
StaffNo of 32, Salary of 25000.0, Last name of Smith- AINSERT INTO Staff (32, 25000.0, 'Smith');
- BINSERT INTO Staff VALUES (32, 25000.0, 'Smith');
- CINSERT INTO Staff ("32","25000.0","Smith");
- DINSERT INTO STAFF VALUES ("32, 25000.0, Smith");
- ENone of the above
19Look at the table given. Choose the correct answer which display the first name, last name, and city for everyone that's not from Payson
- AA) SELECT first, last, city FROM empinfo WHERE city != 'Payson';
- BB) SELECT first, last, city FROM empinfo WHERE city == "payson";
- CC) SELECT first, last, city FROM empinfo WHERE city <> 'Payson';
- DD) SELECT first, last, city FROM empinfo WHERE State = 'Arizona';
- EA & D
20Look at the given table. Choose the correct answer which displays the first and last names for everyone whose last name ends in an "ay", and are over 25 years of age
- ASELECT first, last FROM empinfo WHERE (last NOT LIKE "%ay") AND (age >= 25);
- BSELECT first, last FROM empinfo WHERE (last IN '%ay%') AND (age > 25);
- CSELECT first, last FROM empinfo WHERE (last IS LIKE '%ay%') OR (age > 25);
- DSELECT first, last FROM empinfo WHERE (last LIKE '%ay') AND (age > 25);
- ENone of the above
21Look at the table given. Choose the correct answer which display all columns for everyone whose first name contains "Mary" or last name equals "Jones"
- ASELECT * FROM empinfo WHERE (first LIKE '%Mary%') OR (last = 'Jones');
- BSELECT * FROM empinfo WHERE (first IS LIKE '_Mary_') OR (last = 'Jones');
- CSELECT * FROM empinfo WHERE (first IS LIKE "_Mary_") OR (last == "Jones");
- DSELECT * FROM empinfo WHERE (first LIKE '_Mary_') OR (last == "Jones");
- ESELECT * FROM empinfo WHERE (first LIKE %Mary%) OR (last = "Jones");
22Look at the tale given to use a computed field on the column Salary, which of the following SQL statements are not correct:
- AA) SELECT Fname, Lname, Salary/12 AS MonthlySalary FROM Staff;
- BB) SELECT Fname, Lname, [Salary/12] AS [MonthlySalary] FROM Staff
- CC) SELECT Salary/12 AS MSalary FROM Staff;
- DD) SELECT Fname, Salary/12 as MonthlySalary FROM Staff;
- EB & D
23Look at the given table. In order to show the first name and second name together with a space separating them, under one column called FullName, which of the following is correct;
- ASELECT conc(Fname, ,Lname) AS FullName FROM Staff;
- BSELECT concat(Fname,' ',Lname) AS FullName FROM Staff;
- CSELECT concatenate(Fname," ", Lname) AS FullName FROM Staff;
- DSELECT concat("Fname, ,Lname") AS FullName FROM Staff;
- ESELECT conc("Fname, ,Lname" AS FullName FROM Staff;
24Look at the table above, which of the following shows all the fields with the salary between 10000 - 40000, and the staff position is either CEO, Director or Cleaner, and the first name begins with H and has 3 characters following it or the last name begins with W
- ASELECT * FROM Staff WHERE (Salary IS BETWEEN 10000 AND 40000) AND (Position IN('CEO','Director','Cleaner')) AND (Fname LIKE 'H___' OR Lname LIKE 'W%');
- BSELECT * FROM Staff WHERE (Salary BETWEEN 10000 AND 40000) AND (Position IN ('CEO','Director','Cleaner') AND (Fname LIKE 'H___' or Lname LIKE 'W%');
- CSELECT * FROM Staff WHERE (Salary BETWEEN 10000 AND 40000) AND (Position IN ('CEO','Director','Cleaner') AND (Fname LIKE 'H___' OR Lname LIKE "W%"));
- DSELECT * FROM Staff WHERE (Salary IS BETWEEN 10000 AND 40000) AND (Position IN ('CEO','Director','Cleaner')) AND (Fname LIKE 'H___' OR Lname LIKE 'W%');
- ESELECT * FROM Staff WHERE (Salary BETWEEN 10000 AND 40000) AND (Position IN('CEO','Director','Cleaner')) AND (Fname LIKE 'H___' OR Lname LIKE 'W%');
25Consider the following schema:
STUDENTS(student_code, first_name, last_name, email, phone_no, date_of_birth, honours_subject, percentage_of_marks);
Which of the following would display names of all the students whose honours subject is English and percentage of marks are more than 80, or honours subject is Spanish and percentage of marks more than 80- ASELECT first name, last name FROM students WHERE (honours_subject = "English" OR honours_subject = "Spanish") AND percentage_of_marks > 80;
- BSELECT first name, last name FROM students WHERE honours_subject = "English" OR honours_subject = "Spanish" AND percentage_of_marks > 80;
- CSELECT first name, last name FROM students WHERE (honours_subject = "English" OR honours_subject = "Spanish" AND percentage_of_marks > 80);
- DSELECT first name, last name FROM students WHERE (honours_subject = "English") OR honours_subject = "Spanish" AND percentage_of_marks > 80;
- ENone of the above
26Consider the following schema:
STUDENTS(student_code, first_name, last_name, email, phone_no, date_of_birth, honours_subject, percentage_of_marks);
Which of the following would display names and percentage of marks of all students sorted by honours subject, and then order by percentage of marks- ASELECT first_name, last name FROM students WHERE honours_subject = "English" OR honours_subject = "Spanish" AND percentage_of_marks > 80;
- BSELECT first_name, last name FROM students WHERE (honours_subject = "English" OR honours_subject = "Spanish" AND percentage_of_marks > 80);
- CSELECT first_name, last name FROM students WHERE (honours_subject = "English" OR honours_subject = "Spanish") AND percentage_of_marks > 80;
- DSELECT first_name, last name FROM students WHERE (honours_subject = "English") OR honours_subject = "Spanish" AND percentage_of_marks > 80;
- ENone of the above
27With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"
- ASELECT * FROM Persons WHERE FirstName='%a%'
- BSELECT * FROM Persons WHERE FirstName LIKE 'a&'
- CSELECT * FROM Persons WHERE FirstName IS LIKE '&a'
- DSELECT * FROM Persons WHERE FirstName="&a"
- ENone of the above
28With SQL, regardless of what type of manager, or which specific manager it is, how do you find those members of staff who are not managers, yet they earn more than the other staff members who are managers
- ASELECT * FROM Staff WHERE Position <> 'Manager' AND Salary > ALL (SELECT Salary FROM Staff WHERE Position = 'Manager');
- BSELECT * FROM Staff WHERE Position IN ('Manager', 'Supervisor', 'Chief Officer') AND Salary > ANY (SELECT Salary FROM Staff WHERE Position ='Manager');
- CSELECT * FROM Staff WHERE Position <> 'Manager' AND Salary > ANY (SELECT Salary FROM Staff WHERE Position = 'Manager');
- DSELECT staffNo, fName, lName, position FROM Staff s WHERE EXISTS (SELECT * FROM Staff b WHERE s.position=b.position AND position='Manager';
29Using SQL, look at the given tables, and choose the correct answer which displays the following table given in the answers
- A
- BA)
- CB)
- DC)
- ED)
- FA & D
- A
30Using SQL, look at the given table, and choose the correct answer which displays the following table given below in the answers
- A
- B
- C
- D
- E
- F
- A
31Which of the following statements is true for Inner Join:
- AReturns all rows when there is at least one match in BOTH tables
- BReturn all rows from the left table, and the matched rows from the right table
- CReturn all rows when there is a match in ONE of the tables
- DIs structured in such a way that columns with the same name of associated tables will appear only once
- ENone of the above
32Which of the following statements is true for Natural Join:
- AReturns all rows when there is at least one match in BOTH tables
- BReturn all rows from the left table, and the matched rows from the right table
- CReturn all rows when there is a match in ONE of the tables
- DIs structured in such a way that, columns with the same name of associated tabled will appear once only
- ENone of the above
33Which of the following statements is true for Full Join:
- AReturns all rows when there is at least one match in BOTH tables
- BReturn all rows from the right table, and the matched rows from the left table
- CReturn all rows when there is a match in ONE of the tables
- DIs structured in such a way that, columns with the same name of associated tables will appear once only
- ENone of the above
34Which of the following statements is true for Left Join:
- AReturns all rows when there is at least one match in BOTH tables
- BReturn all rows from the left table, and the matched rows from the right table
- CReturn all rows from the left table, and the matched rows from the left table
- DReturn all rows when there is a match in ONE of the tables
- ENone of the above
35Which of the following statements is true for Right Join:
- AReturns all rows when there is at least one match in BOTH tables
- BReturn all rows from the right table, and the matched rows from the right table
- CReturn all rows from the right table, and the matched rows from the left table
- DReturn all rows when there is a match in ONE of the tables
- ENone of the above
36Using SQL, look at the given table, and choose the correct answer which displays the following result: {11, 12}
- ASELECT * FROM tab1 INNER JOIN tab2 WHERE tab1.numid = tab2.numid;
- BSELECT * FROM tab1 RIGHT OUTER JOIN tab2 WHERE tab1.numid = tab2.numid;
- CSELECT * FROM tab1 LEFT OUTER JOIN tab2 WHERE tab1.numid = tab2.numid
- DSELECT * FROM tab1 FULL OUTER JOIN tab2 WHERE tab1.numid = tab2.numid;
- ENone of the above
37Using SQL, look at the given tabl, and choose the correct answer which displays the following result: {11, 12, 13, 15}
- ASELECT * FROM tab1 INNER JOIN tab2 ON tab1.numid = tab2.numid;
- BSELECT * FROM tab1 RIGHT OUTER JOIN tab2 ON tab1.numid = tab2.numid;
- CSELECT * FROM tab1 LEFT OUTER JOIN tab ON tab1.numid = tab2.numid;
- DSELECT * FROM tab1 FULL OUTER JOIN tab2 ON tab1.numid = tab2.numid
- ENone of the above
38Using SQL, look at the given tables, and choose the correct answer which displays the following result: {10, 14, 11, 12}
- ASELECT * FROM tab1 INNER JOIN tab2 ON tab1.numid = tab2.numid;
- BSELECT * FROM tab1 RIGHT OUTER JOIN tab2 ON tab1.numid = tab2.numid;
- CSELECT * FROM tab1 LEFT OUTER JOIN tab2 ON tab1.numid = tab2.numid;
- DSELECT * FROM tab1 FULL OUTER JOIN tab2 ON tab1.numid = tab2.numid;
- ENone of the above
Information
- Description
- Computer Science Quiz on ERD & Normalisation & SQL , created by Edmund Yong on 12/05/2017.
- Author
- Edmund Yong
- Language
- English
- Views
- 5
- Tags
- Rating
- No ratings yet Rate this quiz