PPSC Lecturer Computer Science Quiz No 7 A.J. Bhatti September 4, 2020 Welcome to your PPSC Lecturer Computer Science Quiz No 7 Name Email 1. SQL permits attribute names to be repeated in the same relation. (True or False) A. FALSE B. TRUE 2. Which operator is used to compare a value to a specified list of values? A.BETWEEN B.ANY C.IN D.ALL 3.The virtual table that its created by data from the result of an SQL 'Select' statement is called _________ A.View B.Synonym C.Sequence D.Transaction 4. Which of the following is a legal expression in SQL? A.SELECT NULL FROM SALES B.SELECT NAME FROM SALES C.SELECT * FROM SALES WHEN PRICE = NULL D.SELECT # FROM SALES 5. Which data type can store unstructured data in a column? A.RAW B.CHAR C.NUMERIC D.VARCHAR 6. Which of the following SQL clauses is used to DELETE tuples from a database table? a) DELETE b) REMOVE c) DROP d) CLEAR 7. ___________removes all rows from a table without logging the individual row deletions. a) DELETE b) REMOVE c) DROP d) TRUNCATE 8. If you don’t specify ASC or DESC after a SQL ORDER BY clause, the following is used by default ______________ a) ASC b) DESC c) There is no default value d) None of the mentioned 9. Which of the following statement is true? a) DELETE does not free the space containing the table and TRUNCATE free the space containing the table b) Both DELETE and TRUNCATE free the space containing the table c) Both DELETE and TRUNCATE does not free the space containing the table d) DELETE free the space containing the table and TRUNCATE does not free the space containing the table 10. What is the purpose of the SQL AS clause? a) The AS SQL clause is used to change the name of a column in the result set or to assign a name to a derived column b) The AS clause is used with the JOIN clause only c) The AS clause defines a search condition d) All of the mentioned 11. ______________ function returns current date and time. a) SET DATEFIRST b) SYSDATETIME c) Cert_ID d) GETDATE 12. Which of the following is not a mathematical function? a) ATN2 b) POWER c) PI d) CEIL 13. @@NESTLEVEL function falls under which of the following category? a) Configuration functions b) Cursor functions c) Mathematical functions d) Date and Time Data Functions 14. Exact Numeric data type is ___________ a) bigint b) int c) smallmoney d) all of the mentioned 15. ntext data type falls under which category? a) Exact numerics b) Character strings c) Unicode character strings d) None of the mentioned 16. Advantages of View are A. Security B. Query re-usability C. Abstraction – hiding data D. All 17. Syntax to create stored procedure is/are A. CREATE PROCEDURE procedureName AS SQL statements B. CREATE PROCEDURE procedureName AS BEGIN SQL statements END C. CREATE PROC procedureName AS BEGIN SQL statements END D. B & C 18. A relational database contains two tables student and department in which student table has columns (roll_no, name and dept_id )and department table has columns (dept-id and dept-name). The following insert statements were executed successfully to populate the empty tables: Insert into department values (1, 'Mathematics'); Insert into department values(1, 'Physics'); Insert into department values(1, 'Navin', 1); Insert into student values (2, 'Ravi', 2); Insert into student values (3, `Gitu', 1); How many rows and columns will be retrived by the following SQL, statement? Select * from student, department; A. 0 row and 4 columns B. 3 rows and 4 columns C. 3 rows and 5 columns D. 6 rows and 5 columns Insert into student values (3, `Gitu', 1); Both A & B Consider the above tables A, B and C. How many tuples does the result of the following SQL query contains? SELECT A.id FROM A WHERE A.age > ALL (SELECT B.age FROM B WHERE B. name = "arun") Table A Id Name Age ---------------- 12 Arun 60 15 Shreya 24 99 Rohit 11 Table B Id Name Age ---------------- 15 Shreya 24 25 Hari 40 98 Rohit 20 99 Rohit 11 Table C Id Phone Area ----------------- 10 2200 02 99 2100 01 4 3 0 1 20. Consider a database table T containing two columns X and Y each of type integer. After the creation of the table, one record (X=1, Y=1) is inserted in the table. Let MX and My denote the respective maximum values of X and Y among all records in the table at any point in time. Using MX and MY, new records are inserted in the table 128 times with X and Y values being MX+1, 2*MY+1 respectively. It may be noted that each time after the insertion, values of MX and MY change. What will be the output of the following SQL query after the steps mentioned above are carried out? SELECT Y FROM T WHERE X=7; (A) 127 (B) 255 (C) 129 (D) 257 21. Let R and S be relational schemes such that R={a,b,c} and S={c}. Now consider the following queries on the database: IV) SELECT R.a, R.b FROM R,S WHERE R.c=S.c.........Which of the above queries are equivalent? Let R and S be relational schemes such that R={a,b,c} and S={c}. Now consider the following queries on the database: IV) SELECT R.a, R.b FROM R,S WHERE R.c=S.cWhich of the above queries are equivalent? A) I and II (B) I and III (C) II and IV (D) III and IV 22.Assume that relations corresponding to the above schema are not empty. Which one of the following is the correct interpretation of the above query? Consider the following relational schema: Suppliers(sid:integer, sname:string, city:string, street:string) Parts(pid:integer, pname:string, color:string) Catalog(sid:integer, pid:integer, cost:real) Consider the following relational query on the above database: SELECT S.sname FROM Suppliers S WHERE S.sid NOT IN (SELECT C.sid FROM Catalog C WHERE C.pid NOT IN (SELECT P.pid FROM Parts P WHERE P.color<> 'blue')) (A) Find the names of all suppliers who have supplied a non-blue part. (B) Find the names of all suppliers who have not supplied a non-blue part. (C) Find the names of all suppliers who have supplied only blue parts. (D) Find the names of all suppliers who have not supplied only blue parts 23. How many vertebrae are present in coccyx ? A. 7 12 9 D. 4 Which of the following pairs of fins in a fish body are paired ? A. Dorsal and ventral. Pectoral and Pelvic. C. Tail and anal All of these 25. Which one of the following is an example of a non-elastic connective tissue ? Ligaments. Tendon Muscles. None of these Related Author: A.J. Bhatti