You are on page 1of 95

Cau 001 You want to send invitations for the annual day to parents of all the students.

For this purpose, you want to generate a report detailing student id, student name and student address. You can retrieve these records from the student master table named Student_details. The fields of the student master table are: st_id, st_name, st_ph, st_add, st_course. For easy readability you want the column heading of the report to be: Student ID, Student Name, and Student Address. Identify the correct piece of code that you will use in the given scenario. A: SELECT Student Identity=st_Id, Student Name=st_name FROM Student_details B: SELECT 'Student Identity'=st_Id, 'Student Name'=st_name, Student Address=st_add FROM Student_details C: SELECT st_id 'Student ID', st_name 'Student Name', st_add Student Address FROM Student_details D: SELECT st_id 'Student Identity', st_name 'Student Name', st_add Student Address FROM Student_details Dap An: C

Cau 002 Identify the correct piece of code that returns all student names from the Students table in which the type of the course starts with bus. A: SELECT st_name FROM Students WHERE course LIKE 'bus%' B: SELECT st_name FROM Students WHERE course STRING '%bus' C: SELECT st_name FROM Students WHERE '-bus%' LIKE course D: SELECT st_name FROM Students WHERE course STRING 'bus%' Dap An: B

Cau 003 In the annual day function of the college, excellence awards are to be given to the 3 students who have scored highest marks in the completive exam that was conducted in March 2002. Identify the correct piece of code that you will execute in the given scenario to find all the details of these 3 students. A: SELECT TOP 3 * FROM Students WHERE dTestDate >= '3/1/02' AND dTestDate <= '3/31/02' ORDER BY siTestScore ASC B: SELECT TOP 3 st_names FROM Students WHERE dTestDate <= '3/1/02' AND dTestDate >= '3/31/02' ORDER BY siTestScore ASC C: SELECT TOP 3 * FROM Students WHERE dTestDate >= '3/1/02' AND dTestDate <= '3/31/02'ORDER BY siTestScore DESC D: SELECT TOP 3 st_names FROM Students WHERE dTestDate <= '3/1/02' AND dTestDate >= '3/31/02' ORDER BY siTestScore DESC Dap An: C

Cau 004 You are creating an algorithm for generating unique product IDs for the products sold at your store. You want the product ID to be dependant upon the price, product name, and product description. For this purpose, you want to find out the number of unique price values of the products sold at your store. Identify the correct piece of code that you will execute to find out the number of unique price values in the Products table with a user-defined heading Unique Price. A: SELECT Unique Price = COUNT (DISTINCT Price) FROM Products B: SELECT Unique Price = COUNT (Price DISTINCT) FROM Products C: SELECT Unique Price= COUNT (DISTINCT Price) FROM Products D: SELECT Unique Price = DISTINCT (COUNT Price) FROM Products Dap An: A

Cau 005 Identify the piece of code that returns the minimum and maximum values of different types of products, which have price greater than $10. A: SELECT Type, Maximum = MIN(Price), Minimum = MAX(Price) FROM Products WHERE Price < 10 GROUP BY pr_type B: SELECT Type, Maximum = MIN(Price), Minimum = MAX(Price) FROM Products WHERE Price > 10 GROUP BY pr_type C: SELECT Type, Minimum = MIN(Price), Maximum = MAX(Price) FROM Products WHERE Price > 10 GROUP BY pr_name D: SELECT Type, Minimum = MIN(Price), Maximum = MAX(Price) FROM Products WHERE Price > 10 GROUP BY pr_type Dap An: D

Cau 006 Identify the function that calculates the number of date parts between two dates. A: DATEDIFF() B: DATENAME() C: GETDATE() D: DATEPART() Dap An: A Cau 007 What will be the output of following function? ROUND(1234.567,2) A: 1234.570 B: 1234.600 C: 1235.000 D: 1200.000 Dap An: A

Cau 008 What will be the output of following function? SELECT STUFF('mybook',1,3,b) A: book B: myook C: ybook D: myoook Dap An: A Cau 009 What will be the output of following function? SELECT DIFFERENCE('MYMATCH', 'match') A: 4 B: 3 C: 0 D: 1 Dap An: B Cau 010 What will be the output of following function? PATINDEX('%NE%','NANCY JONES') A: 9 B: 2 C: 1 D: 3 Dap An: A Cau 011 Identify the INCORRECT statement about indexes. A: Indexes improve the speed of the execution of queries. B: Indexes enforce uniqueness of data. C: Indexes speed up joins between tables. D: Indexes are not updated each time the data is modified. Dap An: D Cau 012 How many unique non-clustered indexes can be created on a single table? A: 1 B: 249

C: 200 D: 2 Dap An: B Cau 013 Identify the clause that SQL Server provides to improve performance by minimizing the amount of page splitting that occurs each time an index page becomes full. A: FILL FACTOR B: PAD_INDEX C: DBCC SHOWCONTIG D: SHOW PLAN Dap An: A Cau 014 Identify the option that specifies the space to leave open on each page in the intermediate levels of an index. A: FILL FACTOR B: PAD_INDEX C: DBCC SHOWCONTIG D: DBCC INDEXDEFRAG Dap An: B Cau 015 Identify the coand that is used to find out whether the table or index is heavily fragmented. A: FILL FACTOR B: PAD_INDEX C: DBCC SHOWCONTIG D: DBCC INDEXDEFRAG Dap An: C Cau 016 Resource Solutions is HR consultancy firm. Jim and Nancy work with Resource Solutions. Resource Solutions conducted a test for short-listing candidates for the post of Finance manager. Jim is updating the database with the marks scored by a student with the test score and the test date after a candidate with cCandidateCode 000002 has taken the test. He executes the following transaction. BEGIN TRANSACTION UPDATE ExternalCandidate

SET siTestScore = 90 WHERE cCandidateCode='000002' UPDATE ExternalCandidate SET dTestDate = getdate() WHERE cCandidateCode = '000002' While the above transaction is being executed, Nancy wants to schedule an interview for candidates, but is unable to view the details of candidates who have scored more than 80 marks. Nancy uses the following statements to view the details and schedule an interview: BEGIN TRANSACTION SELECT * from ExternalCandidate WHERE siTestScore > 80 UPDATE ExternalCandidate SET dInterviewDate = getdate()+ 2 WHERE siTestScore > 80 Identify why Nancy is unable to execute the transaction. A: A dirty read transaction is coitted. B: The SQL server has restarted. C: SQL Server uses the concept of locking. D: A phantom read is coitted. Dap An: C Cau 017 Identify the output of the following transaction. BEGIN TRANSACTION USE Pubs UPDATE Titles SET Royalty = Royalty + 20 WHERE type LIKE 'busin%' IF (SELECT MAX(Royalty) FROM Titles WHERE Type LIKE 'busin%') > $25 BEGIN ROLLBACK TRANSACTION PRINT 'Transaction Rolled back' END ELSE BEGIN COMMIT TRANSACTION

PRINT 'Transaction Coitted' END A: The value of royalty on business books is increased by 20 and then the transaction is rolled back. B: The value of royalty on all books is increased by 25. C: The value of royalty on business books is increased by 20. In case the royalty for any of the business books is increased to more than 25, the transaction is rolled back. D: The authors and title tables are locked while the transaction of increasing royalty by 20 is coitted. Dap An: C Cau 018 You are documenting a new sales incentive policy for your organization. While changes are being made, a sales executive takes a copy of the document, which includes all changes made so far, and shares the document with his team. You undo some of the changes that you made and saved the document. Now, the sales team has a copy of sales incentive policy that does longer exists. The above situation is a case of: A: Lost updates B: Uncoitted dependency C: Inconsistent analyses D: Phantom reads Dap An: B Cau 019 Identify the output of the following code: CREATE TRIGGER update_st ON Student FOR UPDATE AS IF UPDATE (st_Id) BEGIN PRINT 'Student ID cannot be modified' ROLLBACK TRAN END A: The code creates the update_st trigger on the Student table, which modifies the St_Id column.

B: The code creates the update_st trigger on the Student table, which modifies the St_Id column. Thereby prevents modifying the content of St_Id and rolls back the entire transaction. C: The code creates the update_st trigger on the Student table. Thereby prevents a user from modifying any column of the Students table. D: The code creates the update_st trigger on the st_ID table, which modifies the St_Id column of the table. Dap An: B Cau 020 A trigger emp_update was created on employee_details table of the employee database. The trigger did not allow updation of emp_ID. You have deleted the employee_details table by using the DROP TABLE statement. Identify the effect of the statement. A: Only the employee_details table is deleted. An entry of the delete is made in the sysobjects and syscoents tables. B: Both the employee_details table and the emp_update trigger are deleted. An entry of the delete is made in the sysobjects and syscoents tables. C: The employee_details table is deleted and the trigger emp_update is not deleted. However, an entry of the delete is made in the sysobjects and syscoents tables. D: Both the employee_details table and the emp_update trigger are deleted. Information about the trigger removal is made in both the sysobjects and syscoents tables. Dap An: D Cau 021 Identify the statement that marks the end point of an explicit transaction and is used to end a transaction for which no errors were encountered during the transaction. A: COMMIT WORK B: BEGIN TRANSACTION C: EXPLICIT TRANSACTION D: ROLLBACK WORK Dap An: A Cau 022 Identify the property of a transaction that states a transaction either accesses data in the state in which it was before a concurrent transaction modified it, or accesses the data after the second transaction has been completed. There is no scope for the transaction to see an intermediate state.

A: Atomicity B: Consistency C: Isolation D: Durability Dap An: C Cau 023 Consider the following trigger: Create trigger st_update on student FOR UPDATE AS IF UPDATE (st_Id) BEGIN PRINT 'student ID cannot be modified' ROLLBACK TRAN END Predict the output if the following coand is given. UPDATE students SET st_id = s0001 WHERE st_id ='0001' A: All the rows will be updated. B: None of the rows will be updated. C: All the rows for which st_id is s0001 will be updated. D: All the rows from the student and marks table will be updated. Dap An: B Cau 024 Which of the following methods can be used to ensure that the deletion of a record from the student table is not allowed if the marks of the student are present in the marks table? A: Cascade method B: Restrict method C: Nullify method D: Domain method Dap An: B Cau 025 Which of the following statements is correct about triggers?

A: INSTEAD OF triggers can be used to perform another action such as a DML operation on another table or view. B: A delete trigger is fired before the delete operation takes place on the table. C: A trigger can be executed explicitly By calling the trigger in a transaction. D: Only dropping the trigger and then recreating it can modify the contents of a trigger. Dap An: A Cau 026 Identify the output of the following SQL statements. DECLARE @StName char(25) DECLARE @St_course char(25) DECLARE curst_course cursor for SELECT stu_name,stu_course FROM Student OPEN curst_course FETCH curst_course into @stName, @St_course While (@@fetch_status = 0) BEGIN Print Student Name = + @StName Print 'Student Course = ' + @St_course FETCH curst_course into @StName, @St_course END CLOSE curst_course DEALLOCATE curst_course A: Student Name = Jim Student Course = Masters in Science Student Name = Nancy Student Course = Masters in History Student Name = Marry Student Course = Masters in Physics B: Student Name = Jim Student Name = Nancy Student Name = Marry C: Student Name = Jim Student Name = Nancy Student Name = Marry Student Course = Masters in Science Student Course = Masters in History

Student Course = Masters in Physics D: Student Name = Jim, Student Course = Masters in Science Student Name = Nancy, Student Course = Masters in History Student Name = Marry, Student Course = Masters in Physics Dap An: A Cau 027 How can the following code optimized in terms of resource allocation. DECLARE @StName char(25) DECLARE @St_course char(25) DECLARE curst_course cursor for SELECT stu_name,stu_course FROM Student OPEN curst_course FETCH curst_course into @stName, @St_course While (@@fetch_status = 0) BEGIN Print Student Name = + @StName Print 'Student Course = ' + @St_course FETCH curst_course into @StName, @St_course END CLOSE curst_course A: Use the statement DEALLOCATE curst_course in the end. B: Use @@fetch_status = 1 instead of @@fetch_status = 0 C: Dont close the cursor. D: Dont open the cursor. Dap An: A Cau 028 Identify the type of user defined function. CREATE FUNCTION product_code (@city varchar(30)) RETURNS varchar (30) AS BEGIN DECLARE @product_code varchar (30) SELECT @product_code=case @pr_desc When doll then P0001 When cycle then P0002 When swing then P0003

When puzzle then P0004 Else unknown End Return @product_code END A: Scalar functions B: Inline table-valued functions C: Multi-statement table-valued functions D: System-defined functions Dap An: A Cau 029 Identify the type of user defined function. CREATE FUNCTION fn_Pub(@CountryPar nvarchar(30) ) RETURNS table AS RETURN ( SELECT pub_id,pub_name FROM pubs.dbo.Publishers WHERE country = @CountryPar ) A: Scalar functions B: Inline table-valued functions C: Multi-statement table-valued functions D: System-defined functions Dap An: B Cau 030 Identify the type of user defined function. CREATE FUNCTION LargeSales(@lParm int ) RETURNS @LargeSalesTab TABLE ( StorID char(4), title_id char(6), ) AS BEGIN INSERT @LargeSalesTab SELECT s.stor_id, t.title_id FROM Sales AS s INNER JOIN titles AS t

ON s.title_id= t.title_id WHERE s.qty > @lParm RETURN END A: Scalar functions B: Inline table-valued functions C: Multi-statement table-valued functions D: System-defined functions Dap An: C Cau 031 Identify the locks that prevent a coon form of deadlock from occurring. A: Shared Locks B: Update Locks C: Exclusive Locks D: Intent Locks Dap An: D Cau 032 Identify the transactional concurrency control that allows transactions to execute without locking any resources. Resources are checked only when a transaction has to coit, in order to determine if any conflict has occurred. If there is a conflict, the transaction starts again. A: Phantom reads B: Uncoitted Dependency C: Pessimistic Concurrency D: Optimistic Concurrency Dap An: D Cau 033 Which of the following is used to set the maximum time that a statement waits on a blocked resource. A: SET LOCK_TIMEOUT coand B: SET DEADLOCK_PRIORITY coand C: sp_lock stored procedure D: @deadlock_var Dap An: A Cau 034 Identify the SQL Server lock mode that is used to establish a lock hierarchy.

A: Intent (I) B: Schema C: Exclusive (X) D: Update (U) Dap An: A Cau 035 Identify the lock mode of intent locks that indicates the intention of a transaction to read some of the resources lower down in the hierarchy, by placing shared (S) locks on those individual resources. A: Intent Exclusive (IX) B: Intent (I) C: Shared with Intent Exclusive (SIX) D: Intent Shared (IS) Dap An: D Cau 036 Consider the following statements: Statement 1: Transaction management ensures the atomicity and consistency of all transactions. Statement 2: Locking is a feature that preserves transaction isolation and durability. Which of the following is correct about the above statements? A: Both statements are true. B: Both statements are false. C: Statement 1 is true and statement 2 is false. D: Statement 2 is true and statement 1 is false. Dap An: A Cau 037 Consider the following statements: Statement 1: Optimistic concurrency allows transactions to execute without locking any resources. Resources are checked only when a transaction has to coit, in order to determine if any conflict has occurred. If there is a conflict, the transaction starts again.

Statement 2: A pessimistic concurrency control locks resources for the duration of a transaction. Unless a deadlock occurs, a transaction is assured of successful completion. Which of the following is correct about the above statements? A: Both statements are true. B: Both statements are false. C: Statement 1 is true and statement 2 is false. D: Statement 2 is true and statement 1 is false. Dap An: A Cau 038 Consider the following statements: Statement 1: A lost update problem occurs when two or more transactions try to modify the same row that is based on the originally selected value. Statement 2: An inconsistent analysis problem occurs when a user views a document before and while the document is being updated. Which of the following is correct about the above statements? A: Both statements are true. B: Both statements are false. C: Statement 2 is true and statement 1 is false. D: Statement 1 is true and statement 2 is false. Dap An: A Cau 039 Consider the following situation. User 1 has coitted Transaction A. Transaction A has locked the DISTRIBUTOR table and wants to lock the PRODUCTS table. User B has coitted Transaction B. Transaction B has locked the PRODUCTS table and wants to lock the DISTRIBUTOR table. This is resulting in a deadlock, as both transactions wait for the other transaction to release the table. The SQL server notifies User Bs application by returning error message number 1205. Identify the cause of error. A: SQL Server ends a deadlock by automatically choosing the user who can break the deadlock as the deadlock victim. Subsequently, SQL Server notifies the users application by returning error message number 1205.

B: The SQL Server sets the maximum time that a statement waits on a blocked resource. Subsequently, SQL Server notifies the users application by returning error message number 1205. C: The SQL Server sets DEADLOCK_PRIORITY as HIGH for a session causes that particular session to be chosen as the deadlock victim and returns error message number 1205. D: The SQL Server sets DEADLOCK_PRIORITY as MEDIUM for a session causes that particular session to be chosen as the deadlock victim and returns error message number 1205. Dap An: A Cau 040 An employee reads a particular document twice. Between the two readings by the employee, the writer is in the process of rewriting the original document. When the employee reads the document for the second time, it has completely changed. The result is that the original read is not repeatable, leading to confusion. Identify the concurrency problem in the given situation. A: Inconsistent Analysis B: Phantom Reads C: multi-granular locking D: Lost Updates Dap An: A Cau 041 Identify the tool available in Enterprise Manager that is used to: A: Monitor various events that occur in the SQL Server B: Performance of SQL Server C: Debug T-SQL statements D: Troubleshoot problems on SQL server. A: SQL Profiler B: Data Transformation Services C: Replication D: SQL Query Analyzer Dap An: A Cau 042 Identify the tool available in Enterprise Manager that is used to start a wizard that helps in creating a full text catalog of the database and keeps track of location and usage of significant words.

A: Full-Text Indexing B: Manage SQL Server Messages C: Options D: External Tools Dap An: A Cau 043 Identify the type of replication that allows users to work and update data autonomously. A: Merge replication B: Snapshot replication C: Transactional replication D: User defined replication Dap An: A Cau 044 Identify the component of replication model that is a collection of articles from a database. A: Publisher B: Distributor C: Subscribers D: Publication Dap An: D Cau 045 Identify the replication model in which one server is defined as the publisher that replicates data to multiple servers known as the subscribers. The publisher and the distributor are on the same server and there is only one source of data that is published on the destination servers. A: The central publisher model B: Republisher C: Central subscriber D: Remote distributor Dap An: A Cau 046 True Travel Services is an online travel agency. The agency uses a SQL database to store data. The travel agency has appointed an analyst to review the performance and guide business growth path. The analyst wants to use various applications that take input in form of plain text file. However, during BCP you want to allow

maximum 15 errors. Which option will you use in the given scenario with the BCP statement? A: -m B: -b C: -e D: -C Dap An: A Cau 047 MyTravel Services is an online travel agency. The agency uses a SQL database to store data. The travel agency has recently acquired another travel agency named Myholidays. MyTravel Services wants to update their database with the details of Myholidays that are stored in text files. The system administrator of MyTravel Services decided to use the BCP utility for the said purpose. However, during BCP the system administrator wants to instruct SQL Server that IDENTITY columns are present in the file being imported. Which option will the system administrator use in the given scenario with the BCP statement to allow IDENTITY columns? A: -t B: -k C: -E D: -C Dap An: C Cau 048 Identify the INCORRECT statement about BULK INSERT statement? A: BULK INSERT statement can be executed from the coand prompt or from the query analyzer but not as part of a transaction. B: While inserting data using the BULK INSERT statement into a table with a clustered index, you can enhance the performance by sorting the data file in the same order of the clustered index. C: The TABLOCK clause of the BULK INSERT statement can be used to lock the table during the bulk copy operation. D: BULK INSERT statements cannot be executed as part of a transaction. Dap An: A Cau 049 Identify the INCORRECT statement about DTS? A: DTS is a set of graphical tools and prograable objects with which you can extract, transform, and consolidate data from dissimilar tables.

B: DTS is a set of graphical tools and prograable objects with which you can extract, transform, and consolidate data in different locations into single or multiple locations. C: DTS Tasks are functions that are executed in a single step in a DTS package. D: During data transformations, you can execute a set of Transact-SQL statements but not Microsoft ActiveX scripts against a data source. Dap An: D Cau 050 Identify the INCORRECT statement about DTS package? A: A DTS package contains a collection of DTS transformations, DTS tasks, connections, and workflow constraints. B: DTS Tasks are functions that are executed in multiple steps in a DTS package. C: Send and receive messages to and from other users and packages in one of the coon task performed by DTS packages. D: Execute a set of Transact-SQL statements or Microsoft ActiveX scripts against a data source in one of the coon task performed by DTS packages. Dap An: B Cau 051 You have just joined ABC Books. ABC Books stores data about the books publishes in a SQL database. You want to query this database to find details of books published by ABC Books. You dont have a login id for accessing the database. Whom would you contact in such a scenario? A: Administrator B: serveradmin C: processadmin D: diskadmin Dap An: A Cau 052 Nancy Jones is the system administrator of a Life Insurance company. The organization uses the SQL database to store details of life insurance policies. To avoid any loss of data, Nancy want to take timely backups by using backup devices. Nancy assigns this responsibility to Jim Lewis. Which fixed server roles needs to be assigned to Jim to perform the task. A: dbcreator B: diskadmin C: securityadmin D: processadmin

Dap An: B Cau 053 You are the sysadmin of a call centre. Whenever a customer care executive receives a call, the executive runs a system stored procedure named call. You want to assign permissions to customer care executives of the organization to successfully execute the procedure. Identify the object permission that you will assign in the given scenario. A: UPDATE B: SELECT C: REFERENCES D: EXECUTE Dap An: D Cau 054 Identify the coand that you will execute to assign sysadmin fixed server role to Jim. A: EXEC sp_addsrvrolemember 'Jim', 'sysadmin' B: EXEC spaddsrvrolemember 'Jim', 'sysadmin' C: EXEC sp_addlogin 'Jim','Password','master' D: EXEC sp_droplogin 'master','Password','Jim' Dap An: A Cau 055 You are the system administrator of a call centre that supports banking operations. The banks data is stored in a SQL database. The call centre executives access data through an application called find_details. To prevent unauthorized usage, you want that customer care executives should access the database only through the application. Identify the database role that you will assign in the given scenario. A: Custom Database Roles B: Application Roles C: db_ddladmin D: db_backupoperator Dap An: B Cau 056 Identify the type of join used in the following code. SELECT * FROM Sales s JOIN Titles t ON s.Title_Id = t.Title_Id

JOIN Publishers p ON t.Pub_Id = p.Pub_Id A: Equi Join B: Natural Join C: Cross Join D: Self Join Dap An: A Cau 057 Identify what will the following code return? SELECT * FROM Sales s JOIN Titles t ON s.Title_Id = t.Title_Id JOIN Publishers p ON t.Pub_Id = p.Pub_Id A: The output produced by the above query results in redundant column data from the two tables. B: The output produced by the above query results in redundant row data from the Authors table. C: The output produced by the above query results in redundant column data from the three tables. D: The output produced by the above query results in redundant column data from the Titles table. Dap An: C Cau 058 Identify the query that lists all titles along with their title IDs from the Titles table where price is greater than the minimum price of books published by the publisher with the publisher ID 0A11. A: SELECT Title_Id, Title FROM Titles WHERE price >ANY (SELECT price FROM Titles WHERE Pub_Id=0A11'') B: SELECT Title_Id, Title FROM Titles WHERE price >ALL (SELECT price FROM Titles WHERE Pub_Id='0736') C: SELECT Publisher_ID = Pub_Id, Name = Pub_Name FROM Publishers WHERE City = ANY (SELECT City FROM authors) D: SELECT Publisher_ID = Pub_Id, Name = Pub_Name FROM Publishers

WHERE City <> ANY (SELECT City FROM authors) Dap An: A Cau 059 Which of the following database objects can be used to print a report in the following format: Student Name: XXXX Student Age: XXX Student Copurse:XXXXX Student Address: XXX A: Procedure B: Trigger C: Attributes D: Cursors Dap An: D Cau 060 The information that is represented by the elements of an XML document is called ___________. A: content B: tags C: attributes D: Processing Instruction Dap An: A Cau 061 An XML schema is: A: an XML document, which describes the elements and attributes that, can be used in other XML documents. B: additional information about the elements of a XML document. C: elements that contain data embedded within the start and the end tags. D: tag that does not come in pairs. Dap An: A Cau 062 To store the details of projects done by various employees, a EmployeeProjects table is created as follows: CREATE TABLE EmployeeProjects ( cEmployeeCode char(6) not null,

cProjectCode char(4) not null, dStartDate datetime not null, dEndDate datetime not null, constraint pkEcodePrjCode Primary Key (cEmployeeCode, cProjectCode) ) The cProjectCode attribute denotes the project done by an employee. An employee can do more than one project but cannot repeat the same project. The EmployeeProjects table is in 2NF. Which of the following statements is correct about the EmployeeProjects table? A: The dStartDate and dEndDate attributes are functionally dependent on the primary key. B: The dStartDate and dEndDate attributes are functionally dependent on the cEmployeeCode attribute. C: The dStartDate and dEndDate attributes are functionally dependent on the cProjectCode attribute. D: The cProjectCode attribute is functionally dependent on the cEmployeeCode attribute. Dap An: A Cau 063 To store the details of projects done by various employees, a EmployeeProjects table is created as follows: CREATE TABLE EmployeeProjects ( cEmployeeCode char(6) not null, cProjectCode char(4) not null, dStartDate datetime not null, dEndDate datetime not null, constraint pkEcodePrjCode Primary Key (cEmployeeCode, cProjectCode) ) The cProjectCode attribute denotes the project done by an employee. An employee can do more than one project but cannot repeat the same project. The EmployeeProjects table is in 2NF.

Which of the following statements is correct about the EmployeeProjects table? A: In the table, the dStartDate attribute is not functionally dependent on the primary key. B: In the table, the dEndDate attribute is not functionally dependent on the primary key. C: In the table, the cProjectCode attribute is not functionally dependent on the cEmployeeCode attribute. D: In the table, the cProjectCode attribute is functionally dependent on the cEmployeeCode attribute. Dap An: C Cau 064 To store the details of all customers, a Customer table is created as follows: CREATE TABLE Customer ( cCustomerId char(4) not null constraint pkCustomerId primary key, cCustomerName char(20) not null, vAddress varchar(40) null, cCity char(20) null, cState char(20) null, cPhone char(10) null ) The Customer table is in 3NF. Two customers can have the same name. Which of the following statements is correct about the Customer table? A: The cCustomerName attribute is functionally dependent on the Primary key. B: The vAddress attribute is functionally dependent on the cCustomerName attribute. C: The cPhone attribute is functionally dependent on the cCustomerName attribute. D: The primary key is functionally dependent on the cCustomerName attribute. Dap An: A Cau 065 To store the details of all customers, a Customer table is created as follows: CREATE TABLE Customer ( cCustomerId char(4) not null constraint pkCustomerId primary key,

cCustomerName char(20) not null, vAddress varchar(40) null, cCity char(20) null, cState char(20) null, cPhone char(10) null ) The Customer table is in 3NF. Which of the following statements is correct about the Customer table? A: The cCustomerId attribute is functionally dependent on the cCustomerName, vAddress, cCity, cState, and cPhone attributes. B: The cCustomerName, vAddress, cCity, cState, and cPhone attributes are functionally dependent on the cCustomerId attribute. C: The cCustomerName attribute is functionally dependent on the cCustomerId, vAddress, cCity, cState, and cPhone attributes. D: The cCustomerId, vAddress, cCity, cState, and cPhone attributes are functionally dependent on the cCustomerName attribute. Dap An: B Cau 066 In a university, students take at least 76 tests for different courses that they do during their graduation in a discipline. The details of students and their test scores are stored in two different tables. The details of the students are stored in the Student table, and their test scores are stored in the StudentTest table. The two tables are created are created as follows: CREATE TABLE Student ( cStudentId char(6) not null, cStudentName char(20) not null, vAddress varchar(40) not null, cCity char(10) not null, cState char(20) not null, cDisciplineCode char(6) not null ) CREATE TABLE StudentTest (

cStudentId char(6) not null, cCourseCode char(6) not null iTestNo int not null, iTestScore int not null, dTestDate datetime not null ) To calculate the aggregate percentage for all tests taken by a student at any point in time, the StudentTest table is queried upon. However, this is taking longer time than expected. To improve the performance of the query, which of the following actions should you take. A: Add a new column in the StudentTest table, which will store the aggregate percentage of all tests taken by a student. Then query this table each time the aggregate percentage value is required. B: Add a new column in the Student table, which will store the aggregate percentage value of all tests taken by a student. Then query this table each time the aggregate percentage value is required. C: Retain the table structures as they are. Nothing much can be done to improve the performance of the query. D: Add all the columns of the StudentTest table in the Student table and delete the StudentTest table. Then query the Student table each time the aggregate percentage value is required. Dap An: B Cau 067 A Soap company sells various soaps. Each soap is treated as a product and is given a unique product code. No two soaps have the same name. However, the price and the weight of some products is the same. A table called Product is proposed to store the details of various soaps. The proposed structure of the Product table is as follows: CREATE TABLE Product ( cProductCode char(6) not null, cProductName char(20) not null, mPrice money not null, iWeight int not null )

Which of the following statements is correct? A: The cProductCode attribute is a candidate key. B: The mPrice attribute can be chosen as a primary key. C: The iWeight attribute is an alternate key. D: The cProductName is a foreign key. Dap An: A Cau 068 A Soap company sells various soaps. Each soap is treated as a product and is given a unique product code. No two soaps have the same name. However, the price and weight of some products is the same. A table called Product is proposed to store the details of various soaps. The proposed structure of the Product table is as follows: CREATE TABLE Product ( cProductCode char(6) not null, cProductName char(20) not null, mPrice money not null, iWeight int not null ) Which of the following attributes of the Product table are candidate keys? A: The cProductCode and mPrice attributes. B: The mPrice and iWeight attributes. C: The cProductName and mPrice attributes. D: The cProductName and cProductCode attributes. Dap An: D Cau 069 An OrderDetail table is proposed to store various items sold on a particular day. Multiple items can be sold in one order. The order number is used to denote an order placed. The proposed table structure of the OrderDetail table is as follows:

CREATE TABLE OrderDetail ( cOrderNo char(6) not null, cItemCode char(4) not null,

dOrderDate datetime not null, iQtySold int not null, mItemCost money null ) Which of the following statements is correct about the OrderDetail table? A: The cOrderNo attribute can be chosen as the primary key. B: The cOrderNo and cItemCode attributes are candidate keys. C: A combination of the cOrderNo and cItemCode attributes can be chosen as the primary key. D: If the cOrderNo attribute is chosen as the primary key, then the cItemCode attribute is the alternate key. Dap An: C Cau 070 An OrderDetail table is proposed to store various items sold on a particular day. Multiple items can be sold in one order. The order number is used to denote an order placed. No two items have the same description. The proposed table structure of the OrderDetail table is as follows:

CREATE TABLE OrderDetail ( cOrderNo char(6) not null, cItemCode char(4) not null, cItemDescription char(20) not null, dOrderDate datetime not null, iQtySold int not null, mItemCost money null ) Which of the following statements is correct about the OrderDetail table? A: The table is in BCNF. B: The cItemCode and cItemDescription attributes are candidate keys. C: A combination of the cOrderNo and cItemDescription attributes can be chosen as the primary key. D: The cOrderNo attribute can be chosen as the primary key. Dap An: C Cau 071

The details of employees and the departments they work in are stored in the Employee table and the Department table. Many employees have the same name, but not the same employee code. Besides, many employees work in a single department. The Employee table is created as follows: CREATE TABLE Employee ( cEmployeeCode char(6) not null, cEmployeeName char(20) not null, vAddress varchar(40) not null, cDepartmentCode char(4) not null ) The Department table is created as follows: CREATE TABLE Department ( cDepartmentCode char(4) not null, cDepartmentName char(10) not null ) Which of the following statements is correct about the two tables? A: The cEmployeeName attribute in the Employee table is a candidate key. B: The cDepartmentCode attribute in the Employee table is a foreign key. C: The cDepartmentCode attribute in the Department table is a foreign key. D: The cDepartmentCode attribute in the Employee table is a candidate key. Dap An: B Cau 072 A university offers many disciplines. Many students graduate in these disciplines after clearing various courses assigned to each discipline. Some courses are coon to certain disciplines. The university maintains the details of courses, disciplines and the students in a SQL Server database. Which of the following statements is correct about the logical model of the system? A: The entities are university, course, discipline and student. B: The relationship between the entities course and discipline is one-to-many.

C: The relationship between the entities discipline and course is many-to-many. D: Course and discipline are the only entities. Dap An: C Cau 073 A university offers many disciplines. Each discipline has many courses assigned to it. An instructor can take courses belonging to only one discipline. However, many instructors can take more than one course for that discipline. Click on the Exhibit button to view the ER diagram depicting part of the logical model of the database. Which of the following statements is true for the ER diagram? A: The ER diagram depicts three entities. B: The relationship between the entities is one-to-many. C: The ER diagram depicts two relationships. D: The entity Course is depicted in the ER diagram. Dap An: B Cau 074 A university offers many disciplines. Many students graduate in these disciplines after clearing various courses assigned to each discipline. A student can graduate in only one discipline. Some courses are coon to certain disciplines. The university maintains the details of courses, disciplines and the students in a SQL Server database. Which of the following statements is correct about the logical model of the system? A: The relationship between the entities Course and Student is one-to-many B: The relationship between the entities Course and Discipline is many-to-one C: The relationship between the entities Discipline and Student is one-to-many . D: The relationship between the entities Course and Student is one-to-one. Dap An: C Cau 075 A university offers many disciplines. Many students graduate in these disciplines after clearing various courses assigned to each discipline. A student can graduate in only one discipline. Some courses are coon to certain disciplines. The university maintains the details of courses, disciplines and the students in a SQL Server database.

Which of the following statements is correct about the logical model of the system? A: The relationship between the entities Course and Student is many-to-many. B: The relationship between the entities Course and Discipline is one-to-many. C: The relationship between the entities Discipline and Student is one-to-one. D: The relationship between the entities Course and Student is one-to-one. Dap An: A Cau 076 A university offers many disciplines. Many students graduate in these disciplines after clearing various courses assigned to each discipline. A student can graduate in only one discipline. Some courses are coon to certain disciplines. The university maintains the details of courses, disciplines, and the students in a SQL Server database. Which of the following statements is correct about the logical model of the system? A: The relationship between the entities Course and Student is many-to-one. B: The relationship between the entities Course and Discipline is many-to-many. C: The relationship between the entities Discipline and Student is one-to-one. D: The relationship between the entities Course and Discipline is one-to-many. Dap An: B Cau 077 Which person uses the external level in the architecture of a database system? A: User B: Database Administrator C: System Database Administrator D: Network Administrator Dap An: A Cau 078 In which level of the database architecture is the physical storage of data described? A: External level B: Conceptual level C: Internal level D: Mapping level Dap An: C

Cau 079 Identify the type of Manager that services all requests for data. A: Database Manager B: File Manager C: Disk Manager D: DBA Dap An: B Cau 080 Consider the following statements: Statement 1: DBMS helps in reducing data redundancy. Statement 2: DBMS does not provide security to data from unauthorized users. Which of the following is correct about the above statements? A: Both statements are true. B: Both statements are false. C: Statement 1 is true and statement 2 is false. D: Statement 1 is false and statement 2 is true. Dap An: C Cau 081 According to relational theory, what is the number of tuples called? A: degree B: relation C: domain D: caridnality Dap An: D Cau 082 Consider the following statements: Statement 1: A relationship is an association among entities. Statement 2: A relation is depicted as a rectangle in the entity-relationship diagram. Which of the following is correct about the above statements?

A: Both statements are true. B: Both statements are false. C: Statement 1 is true and statement 2 is false. D: Statement 1 is false and statement 2 is true. Dap An: C Cau 083 According to relational theory, what is the number of fields called? A: degree B: cardinality C: relation D: domain Dap An: A Cau 084 According to relational theory, what is a record called? A: relation B: tuple C: cardinality D: degree Dap An: B Cau 085 According to relational theory, what is a field called? A: attribute B: tuple C: cardinality D: degree Dap An: A Cau 086 Which of the following constraints of SQL Server implements domain integrity? A: Primary key constraint B: Unique key constraints C: Check constraint D: Default constraint Dap An: C Cau 087

Statement A: The ROLLBACK operation confirms that the database is consistent and all updates made by the transaction have been successfully completed. Statement B: The COMMIT operation signifies that all updates made by the transaction till the point of failure must be undone. Which of the following options is correct about the above statements? A: Statement A is true and Statement B is false. B: Statement A is false and Statement B is true. C: Both, Statement A and Statement B, are true. D: Both, Statement A and Statement B, are false. Dap An: D Cau 088 Statement A: The transaction log tracks all transactions of a database. Statement B: The transaction log displays one copy of each row affected by a SQL statement. Which of the following options is correct about the above statements? A: Statement A is true and Statement B is false. B: Statement A is false and Statement B is true. C: Both, Statement A and Statement B, are true. D: Both, Statement A and Statement B, are false. Dap An: A Cau 089 Which of the following problems can occur in a multi-user environment? A) The lost update problem B) The uncoitted dependency problem C) The inconsistent data problem A: A and B B: B and C C: A and C D: A, B, and C Dap An: D

Cau 090 Which SQL statements are used to create and delete tables? A: DDL B: DQL C: DML D: DCL Dap An: A Cau 091 Statement A: An exclusive lock is used by the DBMS when a transaction wants to read data from the database. Statement B: When a transaction has an exclusive lock on some data, no other transaction can acquire a lock on the same data. Which of the following options is correct about the above statements? A: Statement A is true and Statement B is false. B: Statement A is false and Statement B is true. C: Both, Statement A and Statement B, are true. D: Both, Statement A and Statement B, are false. Dap An: B Cau 092 A _____ is a named, derived, virtual table that does not exist physically. A: Source table B: Query C: View D: Base table Dap An: C Cau 093 Which type of view includes all rows but only some columns of the source table? A: Joined B: Column subset C: Grouped D: Row subset Dap An: B Cau 094

Which data integrity constraint requires that a column contain a non-null value? A: Entity integrity B: Referential integrity C: Business rules D: Required data Dap An: D Cau 095 Statement A: The information rule of Codd states that every data value in a relational database should be logically accessible by specifying a combination of the table name, the primary key value, and the column name. Statement B: The information rule of Codd forms the basis of the relational database design model. Which of the following options are correct about the above statements? A: Statement A is true and Statement B is false. B: Statement A is false and Statement B is true. C: Both, Statement A and Statement B, are true. D: Both, Statement A and Statement B, are false. Dap An: B Cau 096 For any event that causes a change in the contents of a table, a user can specify an associated action that the DBMS should carry out. What is this action called? A: Log B: Trigger C: Integrity D: Relation Dap An: B Cau 097 Mike is querying a table that has duplicate rows. He wants to remove the duplicate rows from the query result. Which of the following clauses should he use with the SELECT statement? A: GROUP BY B: HAVING C: DISTINCT D: ORDER BY

Dap An: C Cau 098 New Book Store is a leading bookseller of New York. The store maintains a central database for managing the transactions. There are two operators, A and B, to record all transactions in the database. A new bestseller has just arrived in the market and New Book Store has a stock of 100 units of the book. Operator A receives an order of 50 units of the book from a public library and updates the database. Which of the following actions by DBMS will enable operator A to ensure that whenever the next transaction is made with the database, it does not cause an error? A: Create a shared lock. B: COMMIT the transaction. C: Create an exclusive lock. D: ROLLBACK the transaction. Dap An: B Cau 099 Statement A: A subquery is given in parentheses. Statement B: You can nest subqueries to any depth. Which of the following options is true about the above statements? A: Statement A is true and Statement B is false. B: Both, Statement A and Statement B, are true. C: Both, Statement A and Statement B, are false. D: Statement A is false and Statement B is true. Dap An: B Cau 100 Theatre View is a group of public outlets for selling theatre tickets in New Jersey. The group manages its sales records through a central database system. There is an operator at every outlet to manage computerized ticket sales. Which of the following actions by DBMS enables an operator to ensure that the database is not manipulated till a current transaction is complete? A: COMMIT the transaction. B: Create a shared lock. C: Create a deadlock. D: Create an exclusive lock.

Dap An: D Cau 101 The Employee table contains the columns, emp-code, dept, basic, and age. What does the following SQL statement do? CREATE VIEW emp (emp-code, basic) AS SELECT emp-code, basic FROM employee A: The statement creates a column subset view. B: The statement creates a row subset view. C: The statement creates a joined view. D: The statement creates a grouped view. Dap An: A Cau 102 Don Allen, the database designer of RedSky IT Systems is due for a week-long leave. Don wants Jim Lewis, his assistant to update the database in his absence. Which of the following SQL coands will enable Don to allow Jim to manipulate the database? A: SELECT B: GRANT C: UPDATE D: INSERT Dap An: B Cau 103 What does the following statement do? SELECT prod-code FROM product WHERE desc = television INTERSECT SELECT prod-code FROM sale WHERE cust-no = C2584 A: The statement finds the codes of all products that are televisions but have not been bought by customer C2584.

B: The statement finds the codes of all products that are televisions or have been bought by customer C2584. C: The statement finds the codes of all products that are not televisions but have been bought by customer C2584. D: The statement finds the codes of all products that are televisions and have been bought by customer C2584. Dap An: D Cau 104 Steve Irving is designing the database management system of his organization. He needs to set proper security parameters for the database. Steve has the following list of actions: A) Allow only selected users to access data in tables directly. B) Restrict access to sensitive tables on a column-by-column basis. C) Allow all users to access tables through an application program. Which of the following options enables Steve to maintain security of the database? A: A and B B: B and C C: A and C D: A, B, and C Dap An: D Cau 105 Statement A: The RESTRICT delete rule tells the DBMS to automatically delete child rows if the corresponding parent row is deleted. Statement B: The CASCADE delete rule prevents deletion of the parent row if there are any matching child rows. Which of the following options is true about the above statements? A: Both, Statement A and Statement B, are true. B: Both, Statement A and Statement B, are false. C: Statement A is false and Statement B is true. D: Statement A is true and Statement B is false. Dap An: B Cau 106 Ron Floyd has created a table to store export details of his company. He needs to share a part of the data with his clients, and hide a section of the table. Which of

the following actions enables Ron to limit the access of his clients to only a section of the table? A: Create a shared lock. B: Create a view. C: Pass a GRANT privilege. D: Create an exclusive lock. Dap An: B Cau 107 Mary wants to create a table, orders. The attributes to be stored in this table are part number, supplier number, order description, and quantity. Part number and supplier number form the composite primary key. Which of the following statements should Mary use to create the table? A: CREATE TABLE orders (part-no CHAR (5), supplier-no CHAR(5), order-desc CHAR (10), qty DECIMAL (8,2), PRIMARY KEY (part-no, supplier-no)) B: CREATE TABLE orders (part-no CHAR (5) NOT NULL, supplier-no CHAR(5) NOT NULL, order-desc CHAR (10), qty DECIMAL (8,2), PRIMARY KEY (part-no) PRIMARY KEY (supplier-no)) C: CREATE TABLE orders (part-no CHAR (5) NOT NULL, supplier-no CHAR(5) NOT NULL, order-desc CHAR (10), qty DECIMAL (8,2), PRIMARY KEY (part-no, supplier-no)) D: CREATE TABLE orders part-no CHAR (5) NOT NULL, supplier-no CHAR(5) NOT NULL, order-desc CHAR (10), qty DECIMAL (8,2), PRIMARY KEY (part-no, supplier-no) Dap An: C

Cau 108 Mary has created a table, orders. This table has columns, part number, supplier number, order description, and quantity. Now, Mary wants to add a column value to the orders table. Which of the following statements should she use? A: ALTER TABLE orders ADD value CHAR(5) B: ALTER orders TABLE ADD value CHAR(5) C: ALTER orders ADD value CHAR(5) D: ALTER TABLE orders value CHAR(5) Dap An: A Cau 109 Consider a table, customer. This table has the columns, cust-no, name, phonenumber, and city. Which of the following statements will display the names of all customers who live in California? A: SELECT * FROM customer WHERE city = 'California' B: SELECT name FROM customer WHERE city = 'California' C: SELECT name FROM customer D: SELECT name WHERE city = 'California' Dap An: B Cau 110 Consider a table, customer. This table has the columns, cust-no, name, phonenumber, and city. Which of the following statements will change the phone number of customer C5684 to 6405768? A: UPDATE customer phone-number = 6405768 WHERE cust-no = C5684 B: UPDATE customer TABLE SET phone-number = 6405768 WHERE cust-no = C5684 C: UPDATE customer SET phone-number = 6405768

D: UPDATE customer SET phone-number = 6405768 WHERE cust-no = C5684 Dap An: D Cau 111 Consider a table, customer. This table has the columns, cust-no, name, phonenumber, and city. Which of the following statements will delete the rows of all customers who are based in Boston? A: DELETE * FROM customer WHERE city = 'Boston' B: DELETE customer WHERE city = "Boston" C: DELETE FROM customer WHERE city = 'Boston' D: DELETE FROM customer city = 'Boston' Dap An: C Cau 112 Which of the following methods can you use to restrict user-access to specific columns of a SQL Server table? A: Building an XPath query that defines an XML schema B: Building an XPath query without defining an XML schema C: Creating a view without using an XML schema D: Creating a view and an XML schema Dap An: A Cau 113 The SQL Server Mobile Edition is supported on ___________. A: Windows Server 2003 SP1 B: Windows 2000 Professional SP4 C: Windows XP SP2 D: Windows CE 5.0 Dap An: D

Cau 114 Which of the following character should you use to substitute spaces in an URL query? A: * B: / C: + D: Dap An: C Cau 115 Identify the correct order of steps to be performed while using a cursor in SQL Server. Step 1: Closing the cursor Step 2: Opening the cursor Step 3: Fetching the row Step 4: Releasing the cursor Step 5: Declaring the cursor

A: Step 5, Step 2, Step 3, Step 1, and Step 4 B: Step 5, Step 4, Step 1, Step 2, and Step 3 C: Step 1, Step 2, Step 3, Step 4, and Step 5 D: Step 2, Step 5, Step 3, Step 1, and Step 4 Dap An: A Cau 116 Consider the following statements: Statement 1: You can fetch a specific row from the result set if the cursor is defined as scrollable. Statement 2: You can only fetch the next row from the result set if the cursor is defined as a forward-only cursor. Which of the following is correct about the above statements? A: Both statements are true.

B: Both statements are false. C: Statement 1 is true and statement 2 is false. D: Statement 1 is false and statement 2 is true. Dap An: A Cau 117 Which of the following database objects can be used to print a report in the following format: Publisher Id: XXXX State:XXXXX A: Procedure B: Triggers C: Cursor D: Batches Dap An: C Publisher Name: XYZ City:XXXXXX

Cau 118 Consider the following statements: Statement A: Any row can be fetched from the result set of the cursor using an Absolute option in the fetch statement. Statement B: The order of fetched field can be different from the order of the fields given in the Select statement. Which of the following is correct about the above statements?

A: Both statements are true. B: Both statements are false. C: Statement A is true and statement B is false. D: Statement A is false and statement B is true. Dap An: C Cau 119 Predict the output of the following SQL statement. Select * from sales where sale_date >= dateadd(dd,-10, getdate())

A: Displays all the rows for which the date of sales is 10 days after the current system date B: Displays all the rows for which the date of sale is 10 days before the current system date C: Displays all the rows for which the date of sale is the current system date D: Displays all the rows for which the date of sale is 10 weeks after the current system date Dap An: B Cau 120 Predict the output of the following SQL statement if the date of sale for the given product is July 23, 2001 and the order date is July 1, 2001. Select datediff(dd, sale_dt, order_dt) from transaction where prod_id = 10202

A: 22 B: -22 C: 18 D: 21 Dap An: B Cau 121 Predict the output of the following SQL statement. Select floor(1234.567)

A: 1234.56

B: 1234 C: 1235 D: 12345.67 Dap An: B Cau 122 Identify the SQL statement that will display the current date in the format. dd..yyyy A: Select date= dd..yy, getdate() B: Select convert(char(12),4,getdate()) C: Select convert(char(12),getdate(),4) D: Select convert(char(12),getdate(),104) Dap An: D Cau 123 Identify the query that will display the titles of all those books for which the advance amount is more than the average advance paid for the business-related books. A: Select title from titles where advance > (Select advance from titles where type = business) B: Select title from titles where advance > (Select avg(advance) from titles where type = business) C: Select title from titles where advance >=

(Select avg(advance) from titles where type = business) D: Select title from titles where advance > avg (advance) and type = business Dap An: B Cau 124 Consider the following statements: Statement 1: A subquery that returns multiple values has to be accessed through modified operators. Statement 2: Any type of subquery can be converted to a join. Which of the following is correct about the above statements? A: Both statements are true. B: Both statements are false. C: Statement 1 is true and statement 2 is false. D: Statement 1 is false and statement 2 is true. Dap An: C Cau 125 Predict the output of the following SQL statement. Select au_fname, au_lname from authors where city =any ( Select distinct city from publishers) A: Displays the names of all the authors who live in the city in which the publishers lives. B: Displays the names of all the authors who do not live in the same city as the publisher. C: Displays an error because the subquery may return more than one city name in which the publisher lives.

D: Displays no result because the subquery may return multiple values and the author may not belong to any of the cities returned as a result set. Dap An: A Cau 126 Shop Junction is a chain of retail store spread across the globe. Each retail store manages data about daily sales at their own end. However, every week a report is generated detailing out the sales made by each retail store and sent to the head quarters. The details of these reports are then stored at a centralized location at the head office. Identify the utility that you will use in this situation. A: BCP B: BULK INSERT statement C: DTS Designer D: DTS Export/Import Wizard Dap An: B Cau 127 Identify the SQL statement that you will use to copy data of the dailysales table of the sales database to the dailysales.txt data file using the character data format. A: BCP Sales..dailysales out dailysales.txt -c -S(local) -Usa -Ppassword B: BCP Sales..dailysales out dailysales.txt -c -T(local) -Usa -Ppassword C: BCP Sales..dailysales out dailysales.txt -c -K(local) -Usa -Ppassword D: BCP Sales..dailysales out dailysales.txt -c -E(local) -Usa -Ppassword Dap An: A Cau 128 Stop Finance is a finance company that lends finance to corporate. The company has offices spread across the whole of North America. The offices send a daily report of their transactions to the Head Office located in Seattle. The Head Office maintains data about these transactions in a SQL database. In the Head Office there are four managers who coordinate the work of importing these reports to the SQL database. Identify the option that the managers can use in the given scenario. A: -m option of BULK INSERT statement B: -m option of BCP utility C: TABLOCK clause of the BULK INSERT statement D: BCP OUT with TABLOCK clause Dap An: C Cau 129

You have collected data about various students in the colleges of South America who will be completing their graduation in the next 2 months and would like to start working full time. You have collected data about students of each college in separate files. You want to now, collate these files into a database called employment. You want to store the details in a table named college. Identify the SQL statement that you will use to copy details of the file college1 to the database. A: BCP employment..College IN College1.txt SHRServer Usa -Ppassword B: BCP employment..College IN College1.txt mServer Usa -Ppassword C: BCP employment..College OUT College1.txt cServer Usa -Ppassword D: BCP employment..College OUT College1.txt SHRServer Usa -Ppassword Dap An: A Cau 130 You are the system administrator of your organization. You want to secure the SQL server of your organization and limit the amount of access for an individual database user. Identify the server role that you will assign for your own login. Your login should allow any action in SQL Server without any restrictions. A: sysadmin B: serveradmin C: setupadmin D: securityadmin Dap An: A Cau 131 You are the system administrator of XYZ Inc. XYZ Inc. stores all the data related to day-to-day working in a SQL database. As a security measure, you want to assign different rights to employees of your organization to access the SQL Server depending on the organizational requirements. One of the requirements is to assign rights to the employees of the Accounts department for querying purposes. However, you dont want them to make changes. Identify the fixed database role that you will assign to the employees of the Accounts department.

A: db_securityadmin B: db_backupoperator C: db_denydatareader D: db_denydatawriter Dap An: D Cau 132 You are the system administrator of ABC Inc. You want to assign access rights to various managers of the organization to access the SQL Server of the organization. The access rights are dependent on the designation and the requirements of the managers. Identify the database role that you will assign to the managers of ABC Inc. A: Application Role B: Custom Database Role C: Fixed Database Role D: db_denydatareader Dap An: B Cau 133 You have created login for Jim Lewis, the head of marketing division of your organization. You have assigned him rights to access the SQL Server as per his requirements. However, he has resigned and left the organization. You now want to remove his login. What will you do to remove his login? A: Execute the system stored procedure sp_droplogin. B: Execute the system stored procedure sp_droprolemember. C: Assign the value backslash to his login name. D: Assign NULL to his login name. Dap An: A Cau 134 You are the system administrator of the ABC Books. You have created a SQL database that will store the details of books published by ABC Books. You want to grant permissions to the users of the database to work with the data stored in the database. Identify the object permission that you will grant to allows users to execute the stored procedure on which the permission is defined. A: UPDATE B: DELETE C: REFERENCES D: EXECUTE Dap An: D

Cau 135 Which of the following XML documents is well-formed? A: <?xml version=1.0?> <employee id=E001> <fname> Jerry </Fname> <lname> Mathew </lname> </employee> B: <?xml version=1.0?> <employee id=E001> <fname> Jerry </fname> <lname> Mathew </lname> </employee> C: <?xml version=1.0?> <employee id=E001> <fname> Jerry <lname> Mathew </lname></fname> </employee> D: <?xml version=1.0?> <employee id=E001> <fname> Jerry </fname> <lname> Mathew </lname> </employee> Dap An: D Cau 136 Identify the system stored procedure that is used to display the structure of a table? A: sp_helpindex B: sp_helpdb C: sp_help D: sp_helptext Dap An: C Cau 137 Consider the XML document given below: <?xml version=1.0?> <SupplierData> <Supplier SuppId=S001> <SuppName> Kelvin </SuppName> <Address City=DavenPort State=IA Zip=52807 2343> <Phone> 343987656 </Phone><Fax 34397650 </Fax> </Supplier> </SupplierData>

This document displays an error message when opened in Internet Explorer 5.0. Which line in the above code causes an error? A: <SuppName> Kelvin </SuppName> B: <Address City=DavenPort State=IA Zip=52807 2343> C: <Phone> 343987656 </Phone><Fax 34397650 </Fax> D: <Supplier SuppId=S001> Dap An: B Cau 138 Identify the system stored procedure that is used to verify whether or not a table exists in the database? A: sp_helpdb B: sp_helpindex C: sp_help D: sp_helptext Dap An: C Cau 139 Statement A: The FOR XML clause is used to retrieve the XML data by using the EXPLICIT mode. Statement B: A validating parser checks whether an XML document conforms to the structure defined in the schema. However, it does not check whether an XML document is well-formed. A: Statement A is true and statement B is false. B: Statement A is false and statement B is true. C: Both statements are true. D: Both statements are false. Dap An: A Cau 140 Consider the given statements: Statement 1: A user-defined datatype is created to ensure that the corresponding column has the same datatype, length, and nullability in all tables in which the datatype appears. Statement 2: Creating a user-defined datatype is optional.

Which of the following is correct about the above statements? A: Both statements are true. B: Both statements are false. C: Statement 1 is true and statement 2 is false. D: Statement 1 is false and statement 2 is true. Dap An: A Cau 141 What type of integrity is applied by defining a primary key in a given table? A: Entity B: Domain C: Referential D: User-defined Dap An: A Cau 142 Consider the following statements: Statement 1: Multiple rules can be bound on a single column. Statement 2: If a new rule is bound to a column that already has a rule, the new rule will replace the old one. Which of the following is correct about the above statements? A: Both statements are true. B: Both statements are false. C: Statement 1 is true and statement 2 is false. D: Statement 1 is false and statement 2 is true. Dap An: A Cau 143 Which of the following methods can be used to create user-defined SQL Server messages? A: MS DTC B: Query Analyzer C: Enterprise Manager D: SQL Server does not allow user-defined messages to be created Dap An: C

Cau 144 In which model of replication data is replicated to multiple servers by one publisher server? A: Central publisher B: Central publisher with a remote distributor C: Republisher D: Central subscriber Dap An: A Cau 145 Which of the following options enable the SQL Server to start automatically when you register a server by using the Registered SQL Server Properties dialog box? A: Display SQL Server state in console. B: Automatically start SQL Server when connecting. C: Show system databases and system objects. D: Use Windows authentication. Dap An: B Cau 146 To store the details of students and their performance, the Student and Marks tables were created as follows: CREATE TABLE Student ( cStudentCode char(4) not null, cStudentName char(30) not null, cStudentAddress char(30) not null, cStudentCity char(40) not null, cStudentState char(30) not null, cStudentPhone char(15) null ) CREATE TABLE Marks ( cStudentCode char(4) not null, dTestDate datetime not null, iTestMarks1 int not null, iTestMarks2 int not null )

The following view was created based on the Student and the Marks table. CREATE VIEW vwStudentView as SELECT cStudentName,cStudentPhone,Marks=iTestMarks1+iTestMarks2 FROM Student JOIN Marks ON Student.cStudentCode=Marks.cStudentCode The following SELECT statement is given to view the data. SELECT * FROM vwStudentView Consider the following statements regarding the output of the SELECT statement: Statement 1. Four columns would be displayed in the output. Statement 2. The data would be retrieved from the Student table and the Marks table. Statement 3. The data would be retrieved from the table vwStudentMarks Statement 4. The sum of iTestMarks1 and iTestMarks2 would be displayed. Which of the above statements are true? A: Statement 1 and Statement 2 B: Statement 2 and Statement 3 C: Statement 3 and Statement 4 D: Statement 2 and Statement 4 Dap An: D Cau 147 A travel agency stores the details of various resorts in the following Resort table. CREATE TABLE Resort ( cResortCode char(50) not null, cResortName char(30) not null, cAddress char(50) not null, cCity char(30) not null, mPrice money null, mDiscount money null ) The discount is fixed for each city. To update the discount for a given city the following procedure has been created:

CREATE PROCEDURE prcUpdateDiscount @City char(30), @Discount money AS IF EXISTS ( SELECT * FROM Resort WHERE cCity = @City) BEGIN UPDATE Resort SET mDiscount = @Discount WHERE cCity = @City RETURN 0 END ELSE BEGIN RETURN 1 END If the table is successfully updated then 0 is returned else 1 is returned. Which of the following statements should you use to update the discount amount to $10 for the city of Houston? The statements should display the return status of the procedure. A: DECLARE @ReturnValue int EXEC @ReturnValue = prcUpdateDiscount 'Houston',10 SELECT @ReturnValue B: DECLARE @ReturnValue int OUTPUT EXEC @ReturnValue , prcUpdateDiscount , 'Houston',10 SELECT @ReturnValue C: DECLARE @ReturnValue int EXEC prcUpdateDiscount 'Houston',10, @ReturnValue OUTPUT SELECT @ReturnValue D: DECLARE @ReturnValue int EXEC prcUpdateDiscount = @ReturnValue, 'Houston',10 SELECT @ReturnValue Dap An: A Cau 148 The details of students studying in a university are stored in the following Student table.

CREATE TABLE Student ( cStudentCode char(10) not null, cStudentName char(30) not null, cStudentAddress char(50) not null, cStudentState char(50) not null, cStudentPhone char(15) not null, dStudentBirthDate datetime not null ) A procedure to display all the details of students belonging to a particular state was created as follows: CREATE PROCEDURE prcDisplayStudent @State char(50) AS BEGIN SELECT * FROM Student WHERE cStudentState = @State END The indexes on the Student table are modified very often. You need to modify the above procedure so that its performance can improve. Which of the following coand should you use to modify the above procedure? A: Use the DROP PROCEDURE statement to drop the existing procedure and recreate it using the CREATE PROCEDURE STATEMENT. B: Use the EXECUTE statement without any parameters to modify the procedure. C: Use the sp_helptext statement to modify the procedure. D: Use the ALTER PROCEDURE along with the WITH RECOMPILE option. Dap An: D Cau 149 To store the details of various books being sold in a shop, the following Books table has been created: CREATE TABLE Books ( cBookId char(10) not null, cBookName char(30) not null, mPrice money not null, cCategory char(10) null

) You need to write a procedure that would accept the book id and display Expensive Book, if the price of the book is more than $100, and if the price is less than $100 display Affordable Book. Which of the following procedures should you create to get the above output? A: CREATE PROCEDURE prcBook @BookId char(10) AS DECLARE @Price money SELECT @Price=mPrice FROM Books WHERE cBookId=@BookId IF @Price < 100 PRINT 'Affordable Book' ELSE PRINT 'Expensive Book' RETURN B: CREATE PROCEDURE prcBook AS DECLARE @BookId char(10) DECLARE @Price money SELECT @Price=mPrice FROM Books WHERE cBookId=@BookId IF @Price < 100 PRINT 'Affordable Book' ELSE PRINT 'Expensive Book' RETURN C: CREATE PROCEDURE prcBook @BookId char(10) AS DECLARE @Price money SELECT @Price=mPrice FROM Books WHERE cBookId=@BookId IF @Price > 100 PRINT 'Affordable Book' ELSE PRINT 'Expensive Book' RETURN D: CREATE PROCEDURE prcBook AS DECLARE @BookId char(10) DECLARE @Price money

SELECT @Price=mPrice FROM Books WHERE cBookId=@BookId IF @Price > 100 PRINT 'Affordable Book' ELSE PRINT 'Expensive Book' RETURN Dap An: A Cau 150 A wholesale cloth merchant maintains a system that automatically updates the required tables whenever a transaction takes place. When a new row is added to the Orders table, the iQuantityOnHand attribute in the Products table must reduce accordingly. Click on the exhibit button to view the structures of the Products and the Orders table. Which of the following triggers should be created to ensure the above update? A: An insert trigger on the Products table. B: An update trigger on the Orders table. C: An insert trigger on the Orders table. D: An update trigger on the Products table. Dap An: C Cau 151 Macy has proposed the following alteration to an existing trigger: ALTER TRIGGER trgOrderDetails ON Orders FOR INSERT AS BEGIN UPDATE Customer SET iAmountDue = iAmountDue + Inserted.OrderCost FROM Customer JOIN Inserted ON Customer.cCustomerNo= Inserted.cCustomerNo END RETURN Which of the following statements are true? A: The trigger will fire when a value in the Orders table is updated

B: The trigger will fire when a value in the Customer table is updated C: The trigger will fire when a new row is inserted in the Orders table. D: The trigger will fire when a new row is inserted in the Customer table. Dap An: C Cau 152 Identify the SQL statements that defines the table tmpCount with the primary key that automatically generates the number and accepts the number of pages less than 50. A: Create table tmpCount ( id int identity(1,1), page int constraint check page between 1 to 49) B: Create table tmpCount ( id int identity(1,1), page int constraint check page between 1 to 50) C: Create table tmpCount ( id char identity(1,1), page int constraint check page between 1 to 49) D: Create table tmpCount ( id int identity(1,1), page char constraint check page between 1 to 49) Dap An: A Cau 153 True Travel Services is an online travel agency. The agency uses a SQL database to store data. The travel agency has appointed an analyst to review its performance and guide business growth path. The analyst wants to use various applications that take input in form of plain text file. Identify the utility that you will use in this situation. A: BCP B: BULK INSERT statement C: DTS Designer D: DTS Export/Import Wizard Dap An: A Cau 154

An element called SUPPLIER needs to be declared in an XML schema. This element should contain other elements, such as SUPPNAME, ADDRESS, CITY, STATE, ZIP, COUNTRY, and PHONE. Which of the following statements will you use to declare the SUPPLIER element? A: <ElementType name=SUPPLIER content=eltOnly model=closed> B: <element type=SUPPLIER /> C: <element type=SUPPLIER content=eltOnly model=closed> D: <ElementType name=SUPPLIER content=eltOnly model=closed order=seq> Dap An: D Cau 155 What type of integrity is applied by defining a check constraint on a particular column? A: Entity B: Domain C: Referential D: User-defined Dap An: B Cau 156 An element called EMPDATA is to be declared in an XML schema. The EMPDATA element should contain one or more EMPLOYEE elements. Which of the following code snippets matches the given requirement? A: <ElementType name=EMPLOYEE> <element type=EMPDATA minOccurs=1 maxOccurs=* /> </ElementType> B: <element type=EMPDATA content=eltOnly model=closed> <ElementType=EMPLOYEE minOccurs=1 maxOccurs=* /> </element> C: <xsd:element name="EMPDATA"> <xsd:complexType> <xsd:sequence> <xsd:element name="EMPLOYEES" minOccurs="1" maxOccurs="*"></xsd:sequence> </xsd:complexType> </xsd:element> D: <xsd:element name="EMPDATA"> <xsd:complexType> <xsd:sequence>

<xsd:element name="EMPLOYEES" minOccurs="0" maxOccurs="1"> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> Dap An: C Cau 157 Which type of default index is created when a primary key is defined? A: Clustered B: Nonclustered C: Unique D: Unique clustered Dap An: D Cau 158 Consider the following table structure: Create table Apply_For_Passport ( File_no char(5) constraint unique not null, Passport_no char(10) null, Contact_no char(20) not null ) The Passport_no contains a unique value for all those records for which personal details have got verified. However, creating the Passport_no as a primary key by using the alter table coand generates an error. What is the reason for the error? A: A primary key cannot be created on columns that have been defined as NULL during table creation. B: A primary key cannot be created because already a unique key exists in the table. C: A primary key cannot be defined for the table by using the alter table coand. D: A primary key cannot be created on columns with duplicate values. Dap An: A Cau 159 Consider the following statements: Statement 1: Constraints are created only at the table level.

Statement 2: Rules enable you to validate values in the column, and they can be bound to columns from multiple tables. Which of the following is correct about the above statements? A: Both statements are true. B: Both statements are false. C: Statement 1 is true and statement 2 is false. D: Statement 1 is false and statement 2 is true. Dap An: A Cau 160 Consider the following statements: Statement 1: Rules can be bound to a system-defined datatype. Statement 2: When a rule is bound to a user-defined datatype, it prevents the existing columns of the user-defined datatype from incorporating the rule. Which of the following is correct about the above statements? A: Both statements are true. B: Both statements are false. C: Statement 1 is true and statement 2 is false. D: Statement 1 is false and statement 2 is true. Dap An: B Cau 161 Consider the following statements: Statement 1: A join without any condition creates a cartesian product between two or more tables and is called an inner join (using inner join). Statement 2: A join that displays redundant column data in the result set is termed as an equi join. Which of the following is correct about the above statements? A: Both the statements are true. B: Both statements are false. C: Statement 1 is true and statement 2 is false.

D: Statement 1 is false and statement 2 is true. Dap An: A Cau 162 Which type of join should be created to display the names of books that have the same price? A: Cross Join B: Natural Join C: Self Join D: Equi Join Dap An: C Cau 163 Consider the following statements: Statement A: An outer join is possible only between two tables. Statement B: An outer join returns all records that do not match the rows in related tables. Which of the following is correct about the above statements? A: Both statements are true. B: Both statements are false. C: Statement A is true and statement B is false. D: Statement A is false and statement B is true. Dap An: C Cau 164 Identify the query that would display the titles that have the same price. A: Select t1.title, t2.title, t1.price from titles t1 Join titles t2 On t1.price=t2.price where t1.title_id<t2.title_id B: Select t1.title, t2.title, t1.price from titles t1 Join titles t2 On t1.price=t2.price

C: Select title, price from titles t1 Join titles t2 On t1.price=t2.price D: Select * from titles t1 Join titles t2 On t1.price=t2.price Dap An: A Cau 165 Which of the following query would display all rows from the publishers table? A: Select pub_name, substring(au_fname,1,1)+ . +au_lname from publishers p left outer join authors a on p.city=a.city B: Select pub_name, substring(au_fname,1,1)+ . +au_lname from publishers p right outer join authors a on p.city=a.city C: Select pub_name, substring(au_fname,1,1)+ . +au_lname from publishers p join authors a on p.city=a.city D: Select pub_name, substring(au_fname,1,1)+ . +au_lname from publishers p join authors a Dap An: A Cau 166 You need to create a table to store the details of customers. You should be able to store the customer id, the name, the address, and the password of the customer. The id of the customer should be unique. While storing the details of the customers, the customer id, the name, and the password must be stored without fail. However, if the address is not known, it need not be stored. Which of the following statements should you use to create the Customer table? A: CREATE TABLE Customer ( cCustomerId char(6) constraint pkCustomerId primary key, cName char(40) null,

cAddress char(30) not null, cPassword char(10) null ) B: CREATE TABLE Customer ( cCustomerId char(6) constraint fkCustomerId foreign key, cName char(40) null, cAddress char(30) not null, cPassword char(10) null ) C: CREATE TABLE Customer ( cCustomerId char(6) constraint pkCustomerId primary key, cName char(40) not null, cAddress char(30) null, cPassword char(10) not null ) D: CREATE TABLE Customer ( cCustomerId char(6) constraint fkCustomerId foreign key, cName char(40) not null, cAddress char(30) null, cPassword char(10) not null ) Dap An: C Cau 167 To store the details of the sales made, a table called Sales needs to be created. The following conditions need to be enforced using the CREATE TABLE statement. Condition 1: Values for all the attributes must be inserted while storing the details of the sales made. Condition 2: The sale amount must be a positive value. Condition 3: The sale date should always be the current date. Condition 4: The sale id should not allow any duplicate values. The statement proposed for creating the Sales table is as follows:

CREATE TABLE Sales ( cSalesId char(4) constraint pkSales primary key, mSalesAmount money not null, mTax money not null, dSalesDate datetime not null constraint defOrderdate DEFAULT getdate() ) Which of the conditions will the above CREATE TABLE statement enforce? A: Condition 1 and condition 2 B: Condition 1 and condition 3 C: Condition 1 and condition 4 D: Condition 1, condition 3 and condition 4 Dap An: C Cau 168 To store the details of orders, a table called OrderDetail needs to be created The following conditions need to be enforced using the CREATE TABLE statement. Condition 1: cOrderNo attribute should not allow duplicate values. Condition 2: cCustomerId in the OrderDetail table must be present in the Customer table. Condition 3: Quantity and Total cost should allow null values. Condition 4: Quantity must be a positive value. The statement proposed for creating the OrderDetail table is as follows: CREATE TABLE OrderDetail ( cOrderNo char(6) constraint pkOrderNo primary key, cCustomerId char(6) not null constraint fkCustomerId references Customer(cCustomerId), iQuantity int not null, mTotalCost money not null ) Which of the conditions will the above CREATE TABLE statement enforce? A: Condition 1 and condition 3

B: Condition 1 and condition 2 C: Condition 1, condition 2 and condition 3 D: Condition 1, condition 2 and condition 4 Dap An: B Cau 169 To store the details of various projects being under taken in an organization, the following Project table has been created. CREATE TABLE Project ( cProjectCode char(3) not null, cProjectName char(30) not null, cProjectDescription char(30) not null, dProjectStartDate datetime not null, dProjectEndDate datetime not null, mProjectCost money not null ) You have created a rule rulMaxCost to limit the maximum cost of any project to $50,000 as follows: CREATE RULE rulMaxCost as @Cost<50000 When you insert rows into the Project table, you are able to insert values more than $50,000 in the mProjectCost attribute. What could be the possible reason due to which you are able to insert values more than $50,000? A: The rule has not been bound to the mProjectCost attribute using the sp_bindrule coand. B: Instead of a rule, a default should have been created on the mProjectCost attribute. C: The rule has not been bound to the mProjectCost attribute using the sp_addtype coand. D: The condition given in the CREATE RULE is incorrect, it should have been @Cost>50000. Dap An: A

Cau 170 To store the details of books in a library, a Books table has been created using the following CREATE TABLE statement. CREATE TABLE Books ( cBookId char(4) not null, cTitle char(20) not null, cAuthor char(30) not null, mCost money not null, dIssueDate datetime null, dRetrunDate datetime not null ) If the date of issue of a particular book is not entered, the current date should be entered automatically. To do this you create the following default: CREATE DEFAULT defDate as getdate() It is observed that in spite of creating the default, when you enter information of a book without specifying the date of issue, the current date is not entered. Instead, a null value is inserted. What could be the possible reason due to which the current date is not inserted automatically in the dIssueDate attribute? A: The default has not been bound to the dIssueDate attribute using the sp_bindefault statement. B: Instead of a default, a rule should have been created for the dIssueDate attribute. C: Instead of a default, a user-defined datatype should have been created for the dIssueDate attribute. D: The dIssueDate attribute should have been defined as 'dIssueDate datetime not null' in the CREATE TABLE statement. Dap An: A Cau 171 What do you call a component that is a collection of information about the data or database objects that have to be replicated?

A: Publisher B: Publication C: Article D: Subscription Dap An: C Cau 172 To store the details of customers, a table called Customer has been created using the following CREATE TABLE statement. CREATE TABLE Customer ( cCustomerId char(20) not null, cName char(30) not null, cEmailId char(50) not null, vAddress varchar(40) null, cCity char(50) null, mAmountDue money not null ) You need to ensure that while inserting data in the table, if the city of the customer is not mentioned, the cCity attribute should store the value, 'New York'. Which of the following actions will you take? A: Create a default using the following statement: CREATE DEFAULT defCity as 'New York' And then bind the default using the following statement: sp_bindefault defCity,'Customer.cCity' B: Create a rule using the following statement: CREATE RULE rulCity as 'New York' And then bind the rule using the following statement: sp_bindrule rulCity,'Customer.cCity' C: Create a rule using the following statement: CREATE RULE rulCity as 'New York'

And then bind the rule using the following statement: sp_addtype rulCity, 'Customer.cCity' D: Create a default using the following statement: CREATE DEFAULT defCity as 'New York' And then bind the default using the following statement: sp_addtype defCity, 'Customer.cCity' Dap An: A Cau 173 To store the details of shoppers, a Shopper table has been created using the following CREATE TABLE statement. Create table Shopper ( cShopperId char(6) not null, cPassword char(20) not null, vFirstName varchar(20) not null, vLastName varchar(20) not null, vEmailId varchar(20) not null, vAddress null ) Some of the shoppers' email-id is not available at the time of entering data. What should you do so that the message 'NOT AVAILABLE' should be entered when the email-id of the shopper is not provided? A: Use the ALTER TABLE coand and add a check constraint for the vEmailId attribute. B: Use the ALTER TABLE coand and add a default constraint for the vEmailId attribute. C: Use the sp_addtype statement to add the user-defined datatype for the vEmailId attribute. D: Use the sp_bindrule statement to bind a rule to the vEmailId attribute. Dap An: B Cau 174 Which of the following given tasks can be done by using Enterprise Manager? A) Define groups of servers running SQL Sever.

B) Create and administer all SQL Server databases, objects, logins, users, and permissions in each registered server. C) Act as a transactional manager in a distributed database environment. D) Provide objects and wizards to configure the process of replication. A: A, B, C B: A, B, D C: B, C, D D: A, D, C Dap An: B Cau 175 To store the details of products, you need to create a Product table. The table should store the product id, the product name, the price and the quantity on hand. The product id for the first product should start with 1 and should increment automatically for successive products. The quantity on hand of the products should always be a positive value. Which of the following statements would you use to create the Product table? A: CREATE TABLE Product ( iProductId int IDENTITY(1,1), cProductName char(20) not null, iProductPrice int not null, iQuantity int not null constraint chkQty check(iQuantity<0) ) B: CREATE TABLE Product ( iProductId int IDENTITY(1,1), cProductName char(20) not null, iProductPrice int not null, iQuantity int not null constraint chkQty check(iQuantity>0) ) C: CREATE TABLE Product ( iProductId int not null constraint defProductId DEFAULT 1, cProductName char(20)not null, iProductPrice int not null, iQuantity int not null constraint chkQty check(iQuantity<0) )

D: CREATE TABLE Product ( iProductId int not null constraint defProductId DEFAULT 1, cProductName char(20)not null, iProductPrice int not null, iQuantity int not null constraint chkQty check(iQuantity>0) ) Dap An: B Cau 176 To store the details of books published by various publishers, the following tables were created using the CREATE TABLE statement. CREATE TABLE Books ( cBookId char(4) not null, cPublisherId char(6) not null, cBookName char(30) not null, iBookPrice int not null ) CREATE TABLE Publisher ( cPublisherId char(6) not null, cPublisherName char(30) not null, cPublisherAddress char(40) not null, cPublisherCity char(35) not null, cPublisherState char(40) not null, cPublisherPhone char(15) not null ) Referential integrity should be maintained between the Books and the Publisher table. To maintain referential integrity what steps would you take? A: Create a user defined datatype typPublisher of char(4) type and use it in only the Books table for the cPublisherId attribute. B: Create a primary key constraint on the cPublisherId attribute of the Publisher table and a foreign key constraint on the cPublisherId attribute of the Books table.

C: Create a primary key constraint on the cPublisherId attribute of the Books table and a foreign key constraint on the cPublisherId attribute of the Publisher table. D: Create a user defined datatype typPublisher of char(6) type and use it in both the Books table and the Publisher table for the cPublisherId attribute. Dap An: B Cau 177 In an online hotel reservation system, to store the details of various rooms available in a hotel and their charges, the following Room table was created. CREATE TABLE Room ( cRoomCode char(4) not null, cRoomDescription char(50) not null, mRoomCharge money not null, iTimesRented int not null ) The Room table is rarely updated. The table is mainly used for queries based on the cRoomCode attribute. In addition, no two rooms can have the same room code. You want to improve the performance of the queries. To improve the performance of the queries, what type of index would you create on the cRoomCode attribute? A: A clustered index on the cRoomCode attribute of the Room table. B: A non-clustered index on the cRoomCode attribute of the Room table. C: A unique clustered index on the cRoomCode attribute of the Room table. D: A unique non-clustered index on the cRoomCode attribute of the Room table. Dap An: C Cau 178 In a hotel reservation system, to store the details of various rooms and their charges, the following Room table was created. CREATE TABLE Room ( cRoomCode char(4) not null constraint pkRoomCode primary key, cRoomDescription char(50) not null, mRoomCharge money not null, iTimesRented int not null ) The description about any two rooms in the hotel can be same. There is a primary key defined on the cRoomCode attribute. The queries involving cRoomDescription

take a long time to execute. You want to improve the performance of the queries involving cRoomDescription. To improve the performance of the queries what type of index would you create? A: A clustered index on the cRoomDescription attribute. B: A non-clustered index on the cRoomDescription attribute. C: A unique clustered index on the cRoomDescription attribute D: A unique non-clustered index on the cRoomDescription attribute. Dap An: B Cau 179 To store the details of students in an institute, a Student table is created as follows: CREATE TABLE Student ( cStudentCode char(3) not null, cStudentName char(40) not null, cStudentAddress char(50) not null, cStudentState char(30) not null, cStudentCity char(30) not null, cStudentPhone char(40) not null, cStudentEmail char(40) null ) There are many queries being executed on the Student table every day based on the code of the student. No two students can have same student code. Details of new students are entered in the Student table at the end of each semester. You want to improve the performance of the queries. What type of index should you create? A: A clustered index on the cStudentCode attribute. B: A non-clustered index on the cStudentCode attribute. C: A unique clustered index on the cStudentCode attribute. D: A unique non-clustered index on the cStudentCode attribute. Dap An: C Cau 180 To store the details of reservations done for various flights, The following FlightReservation table has been created. CREATE TABLE FlightReservation (

cReservationNumber char(4) not null, cCustomerCode char(8) not null, cFlightNumber char(8) not null, mTicketCost money not null, cFlightClass char(30) not null, dFlightDate datetime not null, cFlightSector char(30) not null ) Many customers reserve air tickets in a day. The table is a highly transacted table, with lots of inserts, updates and delete operations. No two customers can have the same reservation number. What kind of index would you create on the table to improve the queries based on cReservationNumber attribute? A: Create a unique clustered index on the cReservationNumber attribute in the FlightReservation table. B: Create a unique non-clustered index on the cReservationNumber attribute in the FlightReservation table. C: Create a clustered index on the cReservationNumber attribute in the FlightReservation table. D: Create a non-clustered index on the cReservationNumber attribute in the FlightReservation table. Dap An: B Cau 181 To store information about various flights in an online air-reservation system, the following Flight table is being used: CREATE TABLE Flight ( cFlightNumber char(6) not null, cAircraftDescription char(30) not null, cFlightSource char(30) not null, cFlightDestination char(30) not null, dFlightTime datetime not null, mFlightBusinessRate money not null, mFlightFirstclassRate money not null )

The table is used to store information about various flights. The table is rarely updated. Around 2 new flights are added to the Flight table every year. The table is used heavily for queries. In addition, no two flights can have the same flight number. What type of index would you create to improve the performance of the queries? A: Create a clustered index on the cFlightNumber attribute of the Flight table. B: Create a non-clustered index on the cFlightNumber attribute of the Flight table. C: Create a unique clustered index on the cFlightNumber attribute of the Flight table. D: Create a unique non-clustered index on the cFlightNumber attribute of the Flight table. Dap An: C Cau 182 In the Customer table, the details of customers and the amount they have to pay are stored. The structure of the customer table is as follows: CREATE TABLE Customer ( cCustomerId char(4) not null, cName char(30)not null, cAddress char(50) null, cCity char(30) null, iAmountDue int not null ) A view called vwCust is created using the following statement: CREATE VIEW vwCust as SELECT cCustomerId,cName,iAmountDue FROM Customer A new row is added to the view using the following insert statement: INSERT vwCust VALUES('0001','Jack',500) Where will the row be inserted? A: In a temporary table tempCustomer. B: In the Customer table.

C: In the vwCust view. D: In a temporary table of the tempdb database. Dap An: B Cau 183 An Internet service provider keeps details of various subscribers in the following Subscriber table. CREATE TABLE Subscriber ( cEmailId char(50) not null primary key, cName char(30) not null, cAddress char(50) not null, cCity char(60) not null, cState char(70) not null, cPassword char(90) not null, dDateOfSubscription datetime not null, dDateOfExpiry datetime not null, mAmountPaid money ) A stored procedure is to be created that accepts the email id and returns the name and the password of the person to whom that email id belongs. Which of the following procedure would you create? A: CREATE PROCEDURE prcSubscriber @emailid char(50), @name char(30), @password char(90) as SELECT @name=cName, @password=cPassword FROM Subscriber WHERE cEmailId=@emailid B: CREATE PROCEDURE prcSubscriber @emailid char(50), @name char(30) NULL, @password char(90) NULL as SELECT @name=cName, @password=cPassword FROM Subscriber WHERE cEmailId=@emailid C: CREATE PROCEDURE prcSubscriber

@emailid char(50), @name char(30) OUTPUT, @password char(90) OUTPUT as SELECT @name=cName, @password=cPassword FROM Subscriber WHERE cEmailId=@emailid D: CREATE PROCEDURE prcSubscriber @emailid char(50) OUTPUT, @name char(30), @password char(90) as SELECT @name=cName, @password=cPassword FROM Subscriber WHERE cEmailId=@emailid Dap An: C Cau 184 The orders placed by various customers at an online gift store are stored in the following Orders table: CREATE TABLE Orders ( iOrderCode int constraint pkOrders primary key, iGiftCode int not null, iCustomerCode int not null, iQuantityOrdered int not null, mTotalAmount money null, mDiscount money null ) The discount is calculated, for each order, based on the total amount of the order. If the total amount of the order is less than $100, the discount is 1% of the total amount. If the total amount of the order is $100 or more, the discount is 5% of the total amount. Which of the following statement can you use to calculate the discount for each order? A: IF (SELECT SUM(mTotalAmount) FROM Orders)<100 BEGIN UPDATE Orders SET mDiscount=0.01*mTotalAmount

END ELSE BEGIN UPDATE Orders SET mDiscount=0.05*mTotalAmount END B: UPDATE Orders SET mDiscount= CASE WHEN mTotalAmount>=100 THEN 0.01*mTotalAmount WHEN mTotalAmount <100 THEN 0.05*mTotalAmount END C: UPDATE Orders SET mDiscount= CASE WHEN mTotalAmount<100 THEN 0.01*mTotalAmount WHEN mTotalAmount >=100 THEN 0.05*mTotalAmount END D: IF EXISTS (SELECT mTotalAmount FROM Orders ) BEGIN UPDATE Orders SET mDiscount=0.01*mTotalAmount END ELSE BEGIN UPDATE Orders SET mDiscount=0.05*mTotalAmount END Dap An: C Cau 185 To store the details of various gift items being sold at an online gift store, the following Gift table is being used: CREATE TABLE Gift ( iGiftCode int not null, cGiftDescription char(10) not null, cSize char(40) not null, iWeight int not null, mPrice money not null )

A procedure is created that accepts the gift code and returns 0 if the gift is present in the table and returns 1 if the gift is not present in the table. The procedure is created as follows: CREATE PROCEDURE prcGift @GiftCode int AS IF EXISTS (SELECT * FROM Gift WHERE iGiftCode = @GiftCode) BEGIN RETURN 0 END ELSE BEGIN RETURN 1 END Which of the following statements should you use to display the return status of the procedure prcGift for iGiftCode = 1004? A: DECLARE @ReturnStatus int EXEC @ReturnStatus = prcGift 1004 SELECT @ReturnStatus B: DECLARE @ReturnStatus int EXEC prcGift 1004 , @ReturnStatus SELECT @ReturnStatus C: DECLARE @ReturnStatus int EXEC prcGift 1004 , @ReturnStatus OUTPUT SELECT @ReturnStatus D: DECLARE @ReturnStatus int EXEC prcGift = @ReturnStatus , 1004 SELECT @ReturnStatus Dap An: A Cau 186 To store the details of various resorts, a travel agency uses the following Resort table: CREATE TABLE Resort ( cResortCode char(50) not null, cResortName char(30) not null, cAddress char(50) not null,

cCity char(30) not null, mPrice money null, mDiscount money null ) The price of all the resorts are to be increased by $5 till the average price reaches $500. There should be no resort with price more than $700. Which of the following batch statements should you use to update the price? A: IF (SELECT MAX(mPrice) FROM Resort)<700 BEGIN UPDATE Resort SET mPrice=mPrice+5 END B: IF (SELECT AVG(mPrice) FROM Resort)<500 BEGIN UPDATE Resort SET mPrice= mPrice+5 END C: WHILE (SELECT AVG(mPrice)+5 FROM Resort) <500 BEGIN IF (SELECT MAX(mPrice)+5 FROM Resort)<700 BEGIN UPDATE Resort SET mPrice = mPrice + 5 CONTINUE END ELSE BREAK END D: WHILE (SELECT MAX(mPrice)+5 FROM Resort) <500 BEGIN IF (SELECT AVG(mPrice)+5 FROM Resort)<700 BEGIN UPDATE Resort SET mPrice = mPrice + 5 BREAK END ELSE CONTNUE

END Dap An: C Cau 187 To store the information about various products being sold at a store, the following Product table is being used: CREATE TABLE Product ( cProductCode char(10) not null, cProductName char(20) not null, cProductDescription char(30) not null, iQuantityOnHand int not null, mPrice money not null ) The quantity on hand has to be increase by 1 till the average quantity on hand of a product is less than 100 Which of the following batch statements should you use to update the quantity on hand? A: WHILE (SELECT AVG(iQuantityOnHand+1) FROM Product) <100 BEGIN UPDATE Product SET iQuantityOnHand = iQuantityOnHand + 1 END B: WHILE (SELECT MAX(iQuantityOnHand) FROM Product) <100 BEGIN UPDATE Product SET iQuantityOnHand = iQuantityOnHand + 1 END C: IF (SELECT AVG(iQuantityOnHand+1) FROM Product) <100 BEGIN UPDATE Product SET iQuantityOnHand = 1 END D: IF (SELECT MAX(iQuantityOnHand) FROM Product) <100 BEGIN UPDATE Product SET iQuantityOnHand = 1 END Dap An: A

Cau 188 To store the details of various gift items being sold at an online gift store, The following Gift table is being used: CREATE TABLE Gift ( iGiftCode int not null, cGiftDescription char(10) not null, cSize char(40) not null, iWeight int not null, mPrice money not null ) A report is required that display four columns which consist of the gift code, the gift description, the price and the tax amount. If the price is less than 50 then 0 should be displayed as tax. If the price is between 50 and 100 then 1% of the price should be displayed as tax. If the price is more than 100 then 3% of the price should be displayed as tax. Which of the following statements should you use to display the required report? A: SELECT iGiftCode, iGiftDescription, mPrice, 'TAX'= CASE WHEN mPrice < 50 THEN 0 WHEN mPrice >=50 AND mPrice <100 THEN 0.01*mPrice WHEN mPrice >100 THEN 0.03*mPrice END FROM Gift B: SELECT iGiftCode, iGiftDescription , mPrice, 'Tax less than 50'=0, 'TAX between 50 and 100' = 0.01*mPrice , 'Tax more than 100'=0.03 * mPrice FROM Gift C: SELECT iGiftCode, iGiftDescription , mPrice ,0, 0.01*mPrice , 0.03 * mPrice FROM Gift D: IF (SELECT mPrice FROM Gift)<50 BEGIN SELECT 0 END ELSE IF (SELECT mPrice FROM Gift)>=50 AND (SELECT mPrice FROM Gift)>100 BEGIN SELECT 0.01*mPrice FROM Gift END ELSE SELECT 0.03*mPrice FROM Gift Dap An: A

Cau 189 A music store maintains the details of various audio-CDs being sold at the store in the following MusicSales table CREATE TABLE MusicSales ( cMusicCode char(6) not null, cMusicTitle char(30) not null, cArtistName char(30) not null, iMusicQuantityOnHand int not null, mMusicPrice money ) Currently the average price of the music CDs is $70. You have to decrease the price of all the CDs being sold by $1 at the music store till the average price reaches a price less than $50. Which of the following batches will you use to decrease the price of all the CDs? A: WHILE (SELECT AVG(mMusicPrice) FROM MusicSales )>50 BEGIN UPDATE MusicSales SET mMusicPrice=mMusicPrice + 1 END B: WHILE (SELECT AVG(mMusicPrice) FROM MusicSales )>50 BEGIN UPDATE MusicSales SET mMusicPrice=mMusicPrice - 1 END C: WHILE (SELECT AVG(mMusicPrice) FROM MusicSales )<50 BEGIN UPDATE MusicSales SET mMusicPrice=mMusicPrice + 1 END D: WHILE (SELECT AVG(mMusicPrice) FROM MusicSales )<50 BEGIN UPDATE MusicSales SET mMusicPrice=mMusicPrice - 1 END Dap An: B Cau 190 An online flower shop stores details of flowers in the following Flower table:

CREATE TABLE Flower ( cFlowerCode char(5) not null, cFlowerName char(30) not null, cFlowerDescription char(50) not null, mPrice money not null, mShippingCharges money not null, iWeight int not null ) The shipping charges are to be increased by $1 for all the flowers till the average shipping charges reach $8. However, the maximum shipping charge should not exceed $10. Which of the following batch will you use to increase the shipping charge? A: WHILE (SELECT AVG(mShippingCharges) FROM Flower)<8 BEGIN UPDATE Flower SET mShippingCharges = mShippingCharges + 1 IF (SELECT MAX(mShippingCharges) +1 FROM Flower)>10 BREAK ELSE CONTINUE END B: WHILE (SELECT MAX(mShippingCharges) FROM Flower)<8 BEGIN UPDATE Flower SET mShippingCharges = mShippingCharges + 1 IF (SELECT AVG(mShippingCharges) +1 FROM Flower)>10 BREAK ELSE CONTINUE END C: WHILE (SELECT AVG(mShippingCharges) FROM Flower)<8 BEGIN UPDATE Flower SET mShippingCharges = 1 IF (SELECT MAX(mShippingCharges) +1 FROM Flower)>10 BREAK ELSE

CONTINUE END D: WHILE (SELECT MAX(mShippingCharges) FROM Flower)<8 BEGIN UPDATE Flower SET mShippingCharges = 1 IF (SELECT AVG(mShippingCharges) +1 FROM Flower)>10 BREAK ELSE CONTINUE END Dap An: A Cau 191 To store the details of various sports items in a shop, the following SportsItems table has been created: CREATE TABLE SportsItems ( cItemCode char(4) not null, cItemDescription char(30) not null, iQuantityOnHand int not null, mItemPrice money not null ) An item is present in the store if the quantity on hand of that item is more than zero. A procedure has been created that would return 0 if the item with a particular item code is present and 1 if that item is not present. CREATE PROCEDURE prcAvailableItem @ItemCode char(4) AS IF (SELECT iQuantityOnHand FROM SportsItems WHERE cItemCode=@ItemCode)>0 RETURN 0 ELSE RETURN 1

You need to create another procedure that accepts an item code and displays Item available or Item unavailable based on the value returned by the procedure prcAvailableItem. Which of the following procedure should you create? A: CREATE PROCEDURE prcItemStatus @ItemCode char(4) AS DECLARE @ReturnValue int EXEC @ReturnValue = prcAvailableItem @ItemCode IF @ReturnValue = 0 PRINT 'Item available' ELSE PRINT 'Item unavailable' RETURN B: CREATE PROCEDURE prcItemStatus @ItemCode char(4) AS DECLARE @ReturnValue int EXEC @ItemCode = prcAvailableItem @ReturnValue IF @ReturnValue = 0 PRINT 'Item available' ELSE PRINT 'Item unavailable' RETURN C: CREATE PROCEDURE prcItemStatus @ItemCode char(4) AS DECLARE @ReturnValue int EXEC @ReturnValue = prcAvailableItem @ItemCode IF @ReturnValue = 0 PRINT 'Item unavailable' ELSE PRINT 'Item available' RETURN D: CREATE PROCEDURE prcItemStatus @ItemCode char(4) AS DECLARE @ReturnValue int EXEC @ItemCode = prcAvailableItem @ReturnValue

IF @ReturnValue = 0 PRINT 'Item unavailable' ELSE PRINT 'Item available' RETURN Dap An: A Cau 192 To store the details of various perfumes in a department store, the following Perfume table was created: CREATE TABLE Perfume ( cPerfumeId char(4) not null, cPerfumeName char(30) not null, cManufacturedBy char(30) not null, iQuantityOnHand int not null, mPerfumePrice money not null ) The 'Standard Perfume' cost less than $30 and 'Premium perfume' cost more than $30. The following procedure is created that accepts the perfume id and returns a value 0 if the price of the perfume is less than $30 else 1 is returned. CREATE PROCEDURE prcPerfumePrice @PerfumeId char(4) AS IF (SELECT mPerfumePrice FROM Perfume WHERE cPerfumeId=@PerfumeId)<30 RETURN 0 ELSE RETURN 1 A message Standard perfume should be displayed if the cost is less than $30 and a message Premium perfume should be displayed if the cost is more than $30. Which of the following procedures would you create that uses the procedure prcPerfumePrice to display the required message? A: CREATE PROCEDURE prcPerfumeType @PerfumeId char(4) AS

DECLARE @ReturnValue int EXEC @ReturnValue = prcPerfumePrice @PerfumeId IF @ReturnValue = 0 PRINT 'Standard perfume' ELSE PRINT 'Premium perfume' RETURN B: CREATE PROCEDURE prcPerfumeType AS DECLARE @PerfumeId char(4) DECLARE @ReturnValue int EXEC @ReturnValue = prcPerfumePrice @PerfumeId IF @ReturnValue = 0 PRINT 'Standard perfume' ELSE PRINT 'Premium perfume' RETURN C: CREATE PROCEDURE prcPerfumeType @PerfumeId char(4) AS DECLARE @ReturnValue int EXEC @PerfumeId = prcPerfumePrice @ReturnValue IF @ReturnValue = 0 PRINT 'Standard perfume' ELSE PRINT 'Premium perfume' RETURN D: CREATE PROCEDURE prcPerfumeType AS DECLARE @PerfumeId char(4) DECLARE @ReturnValue int EXEC @PerfumeId = prcPerfumePrice @ReturnValue IF @ReturnValue = 0 PRINT 'Standard perfume' ELSE PRINT 'Premium perfume' RETURN Dap An: A Cau 193

The details of various products are stored in a Products table. The quantity on hand of each product is stored in the Products table. As and when these products are received or dispatched from the stores, new rows are added in the Transactions table to record the transactions. When a new product is added to the store, the details of the product are also recorded in the Products table by adding a new row. Whenever a a product is received or dispatched, the total quantity on hand must be updated automatically. Which of the following triggers will you use to ensure the update happens automatically? A: An INSERT trigger on the Products table. B: An UPDATE trigger on the Transactions table. C: An INSERT trigger on the Transactions table D: An UPDATE trigger on the Products table. Dap An: C Cau 194 Employee details are maintained in the Employee table. The company has a scheme that encourages employees to own a car. When any employee avails this scheme, the details related to the scheme are recorded in the CarScheme table. However, the scheme can be availed by only those employees who have completed one year of service in the company. The date of joining is stored in the Employee table in the attribute called dDateOfJoining and the date on which they avail the scheme is maintained in the dDateOfScheme attribute of the CarScheme table. How will you ensure that the car scheme is being availed by only those employees who have completed one year of service in the company? A: By creating a default on the dDateOfScheme attribute. B: By creating a rule and binding it on the dDateOfScheme attribute. C: By creating an insert trigger on the Employee table. D: By creating an insert trigger on the CarScheme table. Dap An: D Cau 195 An advertising company maintains daily expenses in the DailyExpense table by inserting rows as and when an expense is incurred for a specific category of expense. The cash balance for each expense category is maintained in the ExpenseCategory table. When an expense is incurred, the cash balance should be decreased accordingly.

Which of the following triggers will you use to ensure that the cash balance is decreased when an expense is made? A: An UPDATE trigger on the DailyExpenses table. B: An INSERT trigger on the ExpenseCategory table. C: An INSERT trigger on the DailyExpenses table. D: An UPDATE trigger on the ExpenseCategory table. Dap An: C Cau 196 A transportat company has a table Customer to keep information about their customers. The table to maintain customer information was created with the following statement: CREATE TABLE Customer ( cCustomerCode char(5) not null, cCustomerName char(20) not null, cCustomerAddress char(50) null, cPhone char(7) null, cEmail char(25) null ) Now, you need to generate a report to list all those customers who prefer to be contacted through email and hence have not given their phone numbers as a means to contact them. Which of the following statements is the correct solution for the required report? A: SELECT cCustomerName FROM Customer WHERE cPhone IS NOT NULL AND cEmail IS NULL B: SELECT cCustomerName FROM Customer WHERE cPhone IS NULL OR cEmail IS NOT NULL C: SELECT cCustomerName FROM Customer WHERE cPhone IS NULL AND cEmail IS NOT NULL D: SELECT cCustomerName FROM Customer WHERE cPhone IS NOT NULL OR cEmail IS NULL Dap An: C Cau 197

Malory High School maintains details about the courses taken up by the students. A table called StudentCourses was created to store the required details using the following CREATE TABLE statement: CREATE TABLE StudentCourses ( cRegistrationNo char (6) not null, cCourseNameMajor char (20) not null, cCourseNameMinor char(20) not null ) Students who major in Literature are not allowed to major in Statistics. Any student can take Political Science and History as a minor. Details of all the final year students who will major in Literature or Statistics with Political Science as a minor is required. Which of the following queries should be used to retrieve the required information? A: SELECT * FROM StudentCourses WHERE cCourseNameMajor = 'Literature' AND cCourseNameMajor = 'Statistics' AND cCourseNameMinor= 'Political Science' B: SELECT * FROM StudentCourses WHERE (cCourseNameMajor = 'Literature' OR cCourseNameMajor = 'Statistics') AND cCourseNameMinor= 'Political Science' C: SELECT * FROM StudentCourses WHERE cCourseNameMajor = 'Literature' OR cCourseNameMajor = 'Statistics' OR cCourseNameMinor= 'Political Science' D: SELECT * FROM StudentCourses WHERE (cCourseNameMajor = 'Literature' AND cCourseNameMajor = 'Statistics') OR cCourseNameMinor= 'Political Science' Dap An: B Cau 198 The HR department created a table to maintain employee details. The table was created using the following statement: CREATE TABLE EmployeeDetails ( cEmployeeCode char(6) primary key, cEmployeeName char(20) not null, cAddress char(50) not null, cPhone char(10) null, iAge int null,

iSalary int not null ) They have to send a mailer to Agnes Haynes. A label with her name and address is required. Her name should be printed in upper case and her address in lower case. Which of the following queries will retrieve the required information? A: SELECT upper(cEmployeeName) ,lower(cAddress) FROM EmployeeDetails WHERE upper(cEmployeeName)= 'AGNES HAYNES' B: SELECT lower(cEmployeeName) ,upper(cAddress) FROM EmployeeDetails WHERE cEmployeeName= 'Agnes Haynes' C: SELECT cEmployeeName, lower(cAddress) FROM EmployeeDetails WHERE upper(cEmployeeName) = 'AGNES HAYNES' D: SELECT cEmployeeName, cAddress FROM EmployeeDetails WHERE cEmployeeName = 'agnes haynes' Dap An: A Cau 199 The following SELECT statement was executed by a student: SELECT substring(Microsoft SQL Sever is a great product,2,4) Which of the following strings will the substring function return? A: icro B: icr C: ir D: ro Dap An: A Cau 200 The information on appraisals of all employees in Hugh and Co. is maintained in a table called Appraisal. The table was created using the following statement: CREATE TABLE Appraisal ( cEmployeeCode char (6) not null, dDateOfAppraisal datetime not null, cReviewer char(15) not null, cStatus char(3) not null )

The employees are appraised every quarter. The dDateOfAppraisal attribute contains the date of the last appraisal. With which of the following queries can an employee find out the date of his next appraisal? A: SELECT dateadd(qq, 3,dDateofAppraisal)FROM Appraisal B: SELECT datepart (,dDateOfAppraisal) +3 FROM Appraisal C: SELECT datepart (,dDateOfAppraisal ) FROM Appraisal D: SELECT dateadd (,3,dDateOfAppraisal) FROM Appraisal Dap An: D

You might also like