Thursday, November 10, 2016

MS SQL Server 2005 Test 2016 – Upwork Test Answers

Upwork MS SQL Server 2005 Test 2016

77 Answered Test Questions:
1. Which of the following clauses are not allowed in a single row sub-query?
Answers:
a. From
a. Where
a. Group by
a. Having
a. Order by
2. What is the function of “DBCC CHECKDB” command?
Answers:
a. It checks the allocation of all the objects in the specified database
a. It checks the structural integrity of all the objects in the specified database
a. It checks for consistency in and between system tables in the specified database
a. It checks the consistency of disk space allocation structures of a specified database
3. You have a table “engineers” with the following table structure:
enggid int(4)
name varchar(50)
salary int(4)
You want to select the top 2 engineers in the decreasing order of their salaries, starting with the maximum salary. Which of the following SQL queries will fetch this data?
Answers:
a. SELECT TOP 2 * FROM engineers ORDER BY max(salary) DESC
a. SELECT TOP 2 * FROM engineers ORDER BY salary DESC, GROUP BY salary
a. SELECT TOP 2 * FROM engineers GROUP BY salary DESC
a. SELECT TOP 2 * FROM engineers ORDER BY salary DESC
a. SELECT TOP 2 [name], salary FROM engineers ORDER BY salary DESC
4. SQL SERVER 2005 provides a new feature to enable partitioning of the data in the database. But only those database objects can be partitioned which store data in the database. In accordance with the above statement, which of the following database objects can be partitioned?
Answers:
a. Functions
a. Triggers
a. Table
a. Indexes
a. Assemblies
5. Which of the following are the SQL Transaction statements?
Answers:
a. REVERT STATEMENT
a. ROLLBACK STATEMENT
a. START STATEMENT
a. COMMIT STATEMENT
a. END STATEMENT
6. Which of the following operators perform pattern matching?
Answers:
a. %
a. _ (underscore) 
a. =
a. ==
a. is =
7. Which of the following statements regarding “views” are incorrect?
Answers:
a. A view has a data of its own
a. Data can be inserted into the table using its own view
a. Data can be updated in the table using its own view
a. A table can be altered by altering its corresponding view
a. A View is derived from another table
8. You have a table named ’employees’, having the following structure.
empid int(4)
deptname varchar(50)
salary int(4)
And a view is created as follows:
create view viemployees as select * from employees
You want to insert a new row into the table having the following values:
empid=1010, deptname=HR, salary=10000.
Which of the following are the correct insert SQL queries?
Answers:
a. insert into employees values (1010, HR, 10000)
a. insert into employees values (1010, ‘HR’, 10000) 
a. insert into viemployees values (1010, ‘HR’, 10000) 
a. insert into viemployees (empid, deptname, salary) values (1010, HR, 10000)
a. insert into employees (empid, deptname, salary) set values (1010, ‘HR’, 10000)
9. Examine the data in the EMPLOYEES table given below:
LAST_NAME DEPARTMENT_ID SALARY
Allen 10 3000
Miller 20 1500
King 20 2200
Davis 30 5000
Which of the following sub-queries work?
Answers:
a. SELECT * FROM employees where salary > (SELECT MIN(salary) FROM employees GROUP BY department_id)
a. SELECT * FROM employees WHERE salary = (SELECT AVG(salary) FROM employees GROUP BY department_id)
a. SELECT distinct department_id FROM employees Where salary > ANY (SELECT AVG(salary) FROM employees GROUP BY department_id) 
a. SELECT department_id FROM employees WHERE SALARY > ALL (SELECT AVG(salary) FROM employees GROUP BY department_id) 
a. SELECT department_id FROM employees WHERE salary > ALL (SELECT AVG(salary) FROM employees GROUP BY AVG(SALARY))
10. Which of the following are not Database Models?
Answers:
a. Hierarchical model
a. Network model
a. Composite model
a. Relational model
a. Recursive model
11. Which functions does the following SQL QUERY perform?
DBCC CHECKIDENT (‘table_name’, RESEED, new_reseed_value)
Answers:
a. It checks the current identity field value of the specified table
a. It sets the identity field value to the new reseed value
a. It sets the identity field value to 1
a. None of the above
12. You have a table named “employees” with the following table structure:
empid int(4)
deptname varchar(50)
salary int(4)
The following select query is executed on this table:
SELECT * FROM employees ORDER BY deptname DESC, salary DESC
What will be the output of the above query?
Answers:
a. The above SQL query will give an error
a. Records will be shown with the salary field displayed in the descending order
a. Records will be shown with the deptname field in the ascending order and salary in the descending order
a. Records will be shown with the deptname field and the salary field in the descending order
a. Records will be shown in a jumbled manner
13. Consider the following tables:
Customers
– – – – – – – –
Customerid
Customername
Address
Orders
– – – – –
Orderid
Customerid
Orderdate
Comments
What will be the query to fetch Customername and 1st Orderdate for order placed by each customer?
Answers:
a. Select Customers.Customername,(Select Min(Orderdate) From Orders Where Customers.Customerid=Orders.Customerid) From Customers
a. Select Customers.Customername,(Select Max(Orderdate) From Orders Where Customers.Customerid=Orders.Customerid) From Customers
a. Select Customers.Customername,(Select Orderdate From Orders Where Customers.Customerid=Orders.Customerid) From Customers
a. Select Customers.Customername,Min(Orders.Orderdate) From Orders,Customers Where Customers.Customerid=Orders.Customerid
a. None of these
14. Which edition of the SQL SERVER 2005 will best meet the following scenario?
A company has an online shopping website named www.shoppingxyz.com. It also has to handle its line of business portion. Its main server supports 4 CPUs and a multi-core processor.
Answers:
a. SQL SERVER 2005 Enterprise Edition
a. SQL SERVER 2005 Standard Edition
a. SQL SERVER 2005 Workgroup Edition
a. SQL SERVER 2005 Developer Edition
a. SQL SERVER 2005 Express Edition
15. State whether True or False.
While using the Select query, the IN clause is a better choice than the EXIST clause.
Answers:
a. True
a. False
16. Consider the following table structure of employees:
empid int(4)
deptname varchar(50)
salary int(4)
Which query will be used to display the Department (deptname) that is giving the maximum salary?
Answers:
a. select deptname from employees where salary =max(salary)
a. select deptname from employees where salary =max(salary) group by deptname
a. select deptname from employees where salary = (select salary from employees group by salary)
a. select deptname from employees where salary =(select max(salary) from employees) 
a. select deptname from employees where salary in (select salary from employees group by salary)
a. select deptname from employees where max(salary) in (select salary from employees group by salary)
17. State whether True or False.
Many-to-One is a type of relationship in RDBMS.
Answers:
a. False
a. True
18. State whether True or False.
You can send emails through the Database engine.
Answers:
a. False
a. True
19. State whether True or False.
The ‘Having’ clause can not be used when there is a ‘Where’ clause in the statement already.
Answers:
a. True
a. False
20. What exactly is a Foreign key?
Answers:
a. A Foreign key is a column or a set of columns that uniquely identifies rows in a table
a. A Foreign key checks the number of columns in a table which have non-null values
a. A Foreign key is used to match columns in other tables
a. A Foreign key checks the number of rows in a table which have non-null values
21. Which of the following is not a relational operation?
Answers:
a. Restriction
a. Extraction
a. Projection
a. Intersection
a. Union
22. Which of the following statements regarding Trigger and Stored Procedures is correct?
Answers:
a. Triggers are fired manually and Stored Procedures are fired automatically
a. Triggers can call Stored Procedures but Stored Procedures cannot call Triggers
a. Both Stored Procedures and Triggers can pass parameters
a. None of These
23. A table of employees has the following values for its salary field:
10000, 11000, 12000, 10000, 14000, 12000, 13000, 10000, 14000, 10000
What will the following query return?
Select distinct (salary) from employees
Answers:
a. 10000, 14000, 12000, 10000, 11000
a. 10000, 11000, 12000, 10000, 14000, 12000
a. 10000, 11000, 14000, 12000, 13000, 10000
a. 10000, 11000, 12000, 13000, 10000, 14000
a. 10000, 11000, 12000, 14000, 13000
24. Which one of the following statements regarding “views” is incorrect?
Answers:
a. A view is like a window through which data on tables can be viewed or changed
a. A view is stored as a select statement only
a. A view cannot be derived from another view
a. A view has no data of its own
25. What will the following query do?
Delete Orders
Answers:
a. It will remove the Orders Table from the database
a. It will remove up to 1000 rows from the Orders Table
a. It will remove all rows from the Orders Table
a. It will remove all the rows as well as the indexes and constraints from the Orders Table
a. It will produce error on execution
26. The – (Negative) and ~(Bitwise NOT) are examples of the _________ type of operators.
Answers:
a. logical
a. arithmetical
a. assignment
a. unary
27. You have a table “engineers” with the following table structure:
enggid int(4)
deptname varchar(50)
salary int(4)
You want to display the minimum and maximum salaries of the individual departments. Which of the following queries will fetch the desired results?
Answers:
a. select deptname, min(salary) as Minimum, max(salary) as Maximum from engineers
a. select deptname, min(salary) as Minimum, max(salary) as Maximum from engineers group by deptname
a. select deptname, min(salary) as Minimum, max(salary) as Maximum from engineers group by salary
a. select deptname, min(salary) as Minimum, max(salary) as Maximum from engineers order by deptname
a. None of these
28. Which of the following are correct?
Answers:
a. With DDL, you can create and remove tables, schemas, domains, indexes and views
a. Select, Insert and Update are DCL commands
a. Grant and Revoke are DML commands
a. Commit and Rollback are DCL commands
29. We have a table named “Customer” which has a column named “Customerid” having datatype Integer. We need to fetch the output with column title: ‘Customer id is (value of customerid from the table)’. What will be the query?
Answers:
a. Select ‘Customer id is’ + customerid From Customer
a. Select ‘Customer id is’ + CAST(customerid AS varchar) From Customer
a. Select ‘Customer id is’ + CAST(customerid AS integer) From Customer
a. Both a and b
a. None of these
30. Which of the following statements is wrong?
Answers:
a. Truncate is faster than Delete
a. Truncate is a DDL command
a. Truncate retains the identity of the table
a. Truncate cannot be rolled back
a. Truncate removes all rows from the table
31. The table Comments has an auto incremented column called “Commentid” and a “UserComments” column, both of which store the comments of the users visiting the site. What will be the correct query to display the latest comments first?
Answers:
a. Select usercomments From Comments Order by commentid
a. Select usercomments From Comments Order by commentid desc
a. Select usercomments From Comments Order by usercomments
a. Select usercomments From Comments Order by usercomments desc
32. Consider the following table:
Order
– – – – –
Orderid
Customerid
Orderdate
Comments
Select ISNULL (Comments, ‘No comments’) AS comments From Order
What will be the output of the above query?
Answers:
a. The output will always be “No comments” irrespective of the value in the Comments field
a. The output will be null in all the rows
a. The output will be “No comments”, when the database entry is Null
a. The output will be “No comments”, when the database entry is Not Null
a. This query is erroneous
33. What is the maximum storage capacity of XML data type in SQL SERVER 2005?
Answers:
a. 1GB
a. 2GB
a. 4GB
34. Columns are called _____________ of a table in a relational model.
Answers:
a. Tuples
a. Elements
a. Objects
a. Attributes
a. Constraints
35. Which is the best method to handle errors and deadlocks?
Answers:
a. Errors and deadlocks can be handled by using stored procedures
a. Errors and deadlocks can be handled by using cursors
a. Errors and deadlocks can be handled by using Try and Catch constructs
a. Errors and deadlocks can be handled by using inline queries
36. Which of the following is not a Data type in the SQL SERVER 2005?
Answers:
a. ntext
a. nvarchar(n)
a. xml
a. nsmallmoney
37. Which command is used to create User defined Data Type in the SQL SERVER 2005?
Answers:
a. sp_addtype
a. Create Type
a. Create Data Type
a. None of these
38. Which of the following mechanisms is used by “ENCRYPTION by passphrase” to encrypt the data in the SQL SERVER 2005?
Answers:
a. DES (Data Encryption Standard)
a. AES (Advanced Encryption Standard)
a. user defined password
39. Which one of the following statements about Indexes is wrong?
Answers:
a. Indexes are created in an existing table to locate rows more quickly and efficiently
a. It is possible to create an index on one or more columns of a table
a. A table is scanned when index is not available
a. Indexes can only be implemented on integer datatypes
40. What will be the output of the following SQL query?
SET SHOWPLAN_TEXT ON
GO
SELECT * FROM abcsite.abctable
GO
Answers:
a. It will show the query plan and the estimated cost of running
a. It will show all the rows of the “abctable” table
a. It will show all the rows of the “abctable” table and the table structure
a. It will show the identities and Constraints applied on this table
41. __________ is a container that holds tables, views, procedures, functions and so on.
Answers:
a. Instance
a. Cluster
a. Metadata
a. Schema
a. None of the above
42. What exactly is a Super key?
Answers:
a. A Super key is a column or a set of columns that uniquely identifies rows in a table
a. A Super key checks the number of columns in a table which have non-null values
a. A Super key is used to match columns in other tables
a. A Super key checks the number of rows in a table which have non-null values
43. State whether True or False.
Triggers can be created in Assemblies.
Answers:
a. True
a. False
44. Which one of the following statements is correct?
Answers:
a. You can create DDL triggers
a. You can create DML triggers
a. Both a and b are correct
a. Neither a nor b is correct
45. Starting from the slowest, arrange the following operators in the order in which they produce results in “SQL WHERE” query.
1. >, >=, <, <=
2. <>
3. =
4. LIKE
Answers:
a. 1,4,3,2
a. 4,1,2,3
a. 3,2,1,4
a. 2,4,1,3
46. Why are Joins generally better than the Correlated sub-query?
Answers:
a. The Correlated sub-query scans the whole table
a. Joins pick up the rows according to the condition of the queries
a. The Correlated sub-query creates a nested loop
a. The Correlated sub-query makes the statement complex
47. Consider the following table “Students”:
Students
– – – – – –
Name Hobbies
John Driving
Miller Fishing
David Writing
Robert Singing
What will be the output of the following query?
Select Substring(Hobbies,3) From students Where name= “john”
Answers:
a. Dri
a. ivi
a. iving
a. ving
a. It will give an error
48. What exactly is the Full-Text Catalog?
Answers:
a. The Full-Text catalog is an index for searching specific keywords
a. The Full-Text catalog is a file which contains full-text indexes
a. The Full-Text catalog is basically an inbuilt function for checking the validation of a text
a. The Full-Text catalog is a system trigger for checking text validation
49. The commands GRANT and REVOKE are examples of :
Answers:
a. DDL (Data Definition Language)
a. DML (Data Manipulation Language)
a. TCL (Transaction Control Language)
a. DCL (Data Control Language) 
50. We are creating Stored Procedure in Database and using “sp_” prefix in its name. Which of the following statements is correct in accordance with the performance of the Stored Procedure execution?
Answers:
a. The prefix will speed up the execution as it is in cache and will always get executed with high priority
a. The prefix will slow down the execution as the prefix is reserved for system stored procedures
a. The performance will not be affected as “sp_” is just a prefix for a stored procedure
a. The prefix will speed up the execution as prefix “sp_” is used for stored procedures by default
51. Which of the following commands will be used to see the structure of the table named ‘salary’?
Answers:
a. sp_helptext salary
a. sp_define salary
a. sp_help salary
a. define salary
52. Which of the following operators will be evaluated first in the following statement?
Select (salary+40^2*30/5) from employees
Answers:
a. +
a. *
a. /
a. ^
53. State whether True or False.
The “text” and “ntext” data type can store character based data. These data types can be used in joins.
Answers:
a. True
a. False
54. Which of the following is not a type of Database backup in the SQL SERVER 2005?
Answers:
a. Complete backup
a. Differential backup
a. Transaction Log backup
a. Partial backup
a. File(s) and Filegroup(s) backup
55. Which clause will be used to extract data from Tables A and B having a similar structure but no relation between themselves?
Answers:
a. Join
a. Group By
a. Order By
a. Union All
a. Where
56. You have a database named ‘marketnikkie’, the backup of which is stored at ‘D:\marketnikkie.bak’ location on your server. Due to some electric fluctuations, the database gets corrupt. Which of the following is the correct query to restore your database?
Answers:
a. RESTORE DATABASE marketnikkie FROM DISK = ‘D:\marketnikkie.bak’
a. RESTORE DATABASE FROM DISK = ‘D:\marketnikkie.bak’
a. RESTORE DATABASE marketnikkie FROM = ‘D:\marketnikkie.bak’
a. RESTORE marketnikkie FROM DISK = ‘D:\marketnikkie.bak’
a. RESTORE DATABASE marketnikkie.mdf FROM DISK = ‘D:\marketnikkie.bak’
57. Which among the following are the new datatypes introduced in the SQL Server 2005?
Answers:
a. varchar (max)
a. varbinary (max)
a. nvarchar (max)
a. nvarbinary (max)
a. image
a. uniqueidentifier
a. xml
58. Which of the following is not a Method call of .NET class for Assemblies in the SQL Server?
Answers:
a. Init
a. Accumulate
a. Aggregate
a. Merge
a. Terminate
59. You have two tables emp_1 and emp_2, having the following data:
Table emp_1
Name Date
Robert 1/5/2008
John 1/6/2008
Michael 1/7/2008
Rachael 1/10/2008
Joey 1/10/2008
Table emp_2
Name Date
Lewis 1/05/2008
David 1/07/2008
George 1/11/2008
Jerry 1/12/2008
Monica 1/12/2008
The following query is run in the Query Analyzer:
SELECT Date FROM emp_1
EXCEPT
SELECT Date FROM emp_2
What will be the result of the query?
Answers:
a. 1/6/2008, 1/10/2008, 1/11/2008, 1/12/2008
a. 1/6/2008, 1/10/2008, 1/10/2008
a. 1/6/2008, 1/10/2008, 1/11/2008, 1/12/2008, 1/12/2008
a. 1/6/2008, 1/10/2008
a. The query will give an error as EXCEPT is only concerned with varchar values
60. State whether True or False.
The plus (+) and minus (-) operators cannot be used to perform increment/decrement operations on datetime and smalldatetime values.
Answers:
a. True
a. False
61. Which of the following is the new sample database in the SQL SERVER 2005?
Answers:
a. Northwind
a. pubs
a. AdventureWorks
a. master
a. tempdb
62. Which of the following SQL queries correctly selects the rows from the table “employees” that have NULL value in the “salary” column?
Answers:
a. SELECT * FROM employees WHERE salary=null
a. SELECT * FROM employees WHERE salary equals null
a. SELECT * FROM employees WHERE salary is null
a. SELECT * FROM employees WHERE salary contains null
63. Which level of data abstraction describes the data that is stored in the database and their corresponding relationships?
Answers:
a. View Level
a. Procedural Level
a. Physical Level
a. Logical Level
a. Conceptual Level
64. Which of the following “insert queries” will be inserted in the XML field?
The creation query of the table is:
CREATE TABLE Branches(recordID int, description XML)
Answers:
a. INSERT Into Branches(recordID, description) VALUES(1, ‘SalesThe connection timed out.’) 
a. INSERT UniversalLog(recordID, description) VALUES(1, ‘database unavailable’)
a. INSERT Into Branches(recordID, description) VALUES(1, ‘SalesThe connection timed out’)
a. XML cannot be inserted into database
a. XML can be inserted but syntax in all queries is wrong
65. Which of the following is not an Aggregate function?
Answers:
a. AVG()
a. LEN()
a. COUNT()
a. SUM()
a. MAX(column)
66. Consider the following query:
Select name from employees where name like “%_n_”
Which names will be displayed?
Answers:
a. Names starting with n
a. Names containing n
a. Names containing n as the second letter
a. Names containing n as the second last letter
a. Names having 3 ns
67. You want to select a row using cursors in the table ‘qlist’. Which of the following statements DECLARES a cursor ‘qselect’ to perform the desired operation?
Answers:
a. DECLARE qselect CURSOR ON SELECT * FROM qlist
a. DECLARE qselect CURSOR FOR SELECT * FROM qlist
a. DECLARE qlist CURSOR ON SELECT * FROM qselect
a. DECLARE qselect CURSOR AS SELECT * FROM qlist
68. Which query will be used for a particular column of a table, if ‘Reading’ is to be replaced by ‘Writing’?
Answers:
a. Update [Table Name] set [Field Name]= (replace(‘Reading’,’Writing’))
a. Update [Table Name] set [Field Name]= (replace(‘Writing’,’ Reading’))
a. Update [Table Name] set [Field Name]= (replace([Field Name],’ Writing’))
a. Update [Table Name] set [Field Name]= (replace([Field Name],’ Reading ‘))
a. Update [Table Name] set [Field Name]= (replace([Field Name],’Reading’,’Writing’)) 
a. Update [Table Name] set [Field Name]= (replace([Field Name],’Writing ‘,’Reading’))
69. What is wrong with the following query in accordance with performance?
SELECT * FROM [Table_Name] WHERE LOWER(Field_Name) = ‘name’
Answers:
a. The required keyword (‘name’) is already in the LOWER case
a. The query requires more time to convert to the LOWER case
a. T-Sql is not case sensitive. Hence, the LOWER keyword is not required
a. Instead of ‘=’ the operator, ‘LIKE’ should be used
70. How is the following query incorrect?
select * from Orders where OrderID = (select OrderID from OrderItems where ItemQty > 50)
Answers:
a. In the sub-query, ‘*’ should be used instead of ‘OrderID’
a. The sub-query can return more than one row, so, ‘=’ should be replaced with ‘in’
a. The sub-query should not be in parenthesis
a. None of the above
71. Which data type in the SQL SERVER 2005 converts itself into the type of data that is inserted into it?
Answers:
a. real
a. rowversion
a. type_var
a. sql_variant
a. monetary
72. Which of the following is not a logical operator?
Answers:
a. between
a. any
a. some
a. like
a. with
73. Which of the following methods is used to backup the Transaction log on to a secondary database in order to backup and recover data in a synchronized manner?
Answers:
a. Using the backup of Transaction log (ldf) file
a. Taking Backup using flat files
a. Using Log Shipping
a. Taking Database Snapshot of Transaction log
74. Which of the following statements is/are wrong?
Answers:
a. Both Primary key and Unique key enforce uniqueness
a. Primary keys create a clustered index by default
a. Both Primary key and Unique key don’t allow NULL values
a. Unique keys create a non-clustered index by default
a. It is possible to have more than one Primary key in a table
75. Which of the following is a database object?
Answers:
a. Tables
a. Stored Procedures
a. Indexes
a. UDF(User Defined Functions)
a. All of the above
76. State whether True or False.
A User Defined Function ‘findsum’ is to be created as follows:
Create function findsum(@x int, @y int)
As
Begin
Return(@x+@y)
End
But the SQL SERVER is unable to create the desired function and gives an error. The error can be removed by specifying the return type of the function.
Answers:
a. False
a. True
77. Which of the following statements is correct?
Answers:
a. Modifications made in a table will be faster if the number of indexes is more
a. Modifications made in a table will be slower if the number of indexes is more
a. The number of indexes does not affect the modification process of a table

No comments:

Post a Comment

Earn for Free

http://hiredrmjru.trade/3670784521590/