wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

SQLServer_ADO

Total questions: 40

Worksheet time: 14mins

Name
Class
Date
1.

Which of the following is not a aggregate function ?

a)

Avg

b)

Sum

c)

With

d)

Min

2.

Which of the following SQL clauses is used to DELETE record from a database table ?

a)

DELETE

b)

REMOVE

c)

DROP

d)

CLEAR

3.

Which of the following is one of the basic approaches for joining tables?

a)

Subqueries

b)

Union Join

c)

Natural join

d)

All of the Mentioned

4.

Which of the following constraint does not enforce uniqueness ?

a)

UNIQUE

b)

Primary key

c)

Foreign key

d)

None of the mentioned

5.

Select * from employee where salary>10000 and dept_id=101; Which of the following fields are displayed as output?

a)

Salary, dept_id

b)

Employee

c)

Salary

d)

All the field of employee relation

6.

Purpose of foreign key constraint in SQL Server is :

a)

FOREIGN KEY constraints identify and enforce the relationships between tables

b)

A foreign key in one table points to a candidate key in another table

c)

You cannot insert a row with a foreign key value, except NULL, if there is no candidate key with that value

d)

None of the mentioned

7.

What is the full form of SQL

a)

Structured Query Language

b)

Structured Query List

c)

Simple Query Language

d)

None of these

8.

Which is the subset of SQL commands used to manipulate database structures, including tables?

a)

Data Definition Language(DDL)

b)

Data Manipulation Language(DML)

c)

Both of above

d)

None

9.

Which operator performs pattern matching?

a)

BETWEEN operator

b)

LIKE operator

c)

EXISTS operator

d)

None of these

10.

What operator tests column for the absence of data?

a)

EXISTS operator

b)

NOT operator

c)

IS NULL operator

d)

None of these

11.

In SQL, which command(s) is(are) used to change a table's storage characteristics?

a)

ALTER TABLE

b)

MODIFY TABLE

c)

CHANGE TABLE

d)

All of the above

12.

In SQL, which command is used to SELECT only one copy of each set of duplicable rows

a)

SELECT DISTINCT

b)

SELECT UNIQUE

c)

SELECT DIFFERENT

d)

All of the above

13.

Which of the SQL statements is correct?

a)

SELECT Username, Password FROM Users

b)

SELECT Username AND Password FROM Users

c)

SELECT Username, Password WHERE Username = 'user1'

d)

None of these

14.

The FROM SQL clause is used to...

a)

specify range for search condition

b)

specify search condition

c)

specify what table we are selecting or deleting data FROM

d)

None of these

15.

Which SQL keyword is used to retrieve a maximum value?

a)

TOP

b)

MOST

c)

UPPER

d)

MAX

16.

Which of the following is a SQL aggregate function?

a)

LEFT

b)

AVG

c)

JOIN

d)

LEN

17.

Which SQL keyword is used to sort the result-set?

a)

SORT BY

b)

ORDER

c)

ORDER BY

d)

SORT

18.

Find all the cities whose humidity is 89

a)

SELECT city WHERE humidity = 89;

b)

SELECT city FROM weather WHERE humidity = 89;

c)

SELECT humidity = 89 FROM weather;

d)

SELECT city FROM weather;

19.

Find the temperature in increasing order of all cities

a)

SELECT city FROM weather ORDER BY temperature;

b)

SELECT city, temperature FROM weather;

c)

SELECT city, temperature FROM weather ORDER BY temperature;

d)

SELECT city, temperature FROM weather ORDER BY city;

20.

What is the meaning of LIKE '%0%0%'

a)

Feature begins with two 0's

b)

Feature ends with two 0's

c)

Feature has more than two 0's

d)

Feature has two 0's in it, at any position

21.

To use the .NET Framework Data Provider for SQL Server, an application must reference the _____________ namespace.

a)

System.Data.Client

b)

System.Data.SqlClient

c)

System.Data.Sql

d)

None of the mentioned

22.

Valid Code for Creating a SqlConnection Object would be ____________

a)

SqlConnection conn = new SqlConnection(

"Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI");

b)

SqlConnect conn = new SqlConnection(

"Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI");

c)

SqlConnection conn = new SqlConnect(

"Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI");

d)

All of the mentioned

23.

Syntax for closing and opening the connection in ADO.net is _______________

a)

sqlConn.Open() and sqlConn.close()

b)

sqlConn.open() and sqlConn.Close()

c)

sqlConn.Open() and sqlConn.Close()

d)

none of the mentioned

24.

__________object is used to fill a DataSet/DataTable with query results in ADO.net.

a)

Dataset

b)

DataAdapter

c)

DataTables

d)

DataReader

25.

If you are using the DataSet and you have to display the data in sorted order what will you do?

a)

Use Sort method of DataTable

b)

Use Sort method of DataSet

c)

Use DataView object with each sort

d)

Use datapaging and sort the data.

26.

Which of the following is true?

a)

DataTable object contain DataRow and DataColoumn objects

b)

DataSet and DataTable can be binary serialized

c)

DataSet and DataTable can be XML serialized

d)

All of the above

27.

How do you execute multiple SQL statements using a DataReader?

a)

Call the ExecuteReadermethod of two Command objects and assign the results tothe same instance of a DataReader.

b)

Call the ExecuteReadermethod of a single Command object twice.

c)

Set the Command.CommandTextproperty to multiple SQL statements delimited by a semicolon.

d)

Set the Command.CommandTypeproperty to multiple result sets.

28.

What happens when you call the Close method of a connection object?

1) The connection is destroyed

2) The connection is returned to the connection pool.

3) The StateChangeevent is fired.

4) All non - committed pending transactions are rolled back.

a)

1, 2

b)

1,3

c)

2, 3, 4

d)

All of the above

29.

Which SqlCommand execution returns the number of effected records in the table?

a)

ExecuteNonQuery

b)

ExecuteReader

c)

ExecuteXmlReader

d)

ExecuteScalar

30.

Which SqlCommand execution returns the value of the first column of the first row from a table?

a)

ExecuteNonQuery

b)

ExecuteReader

c)

ExecuteXmlReader

d)

ExecuteScalar

31.

Which data provider gives the maximum performance from a connection to SQL Server?

a)

The OLE DB data provider.

b)

The JDBC data provider.

c)

The SqlClient data provider.

d)

The Oracle data provider

32.

What datatype is returned when calling the ExecuteScalar method of a command object?

a)

System.Int32

b)

Object

c)

No. of effected records

d)

None of the above

33.

What are the minimum attribute is required to create a connection string using SqlConnection object?

a)

Data Source, Initial Catalog, Integrated security=true

b)

Server, Database, Integrated security=true

c)

Option 1 and 2 both are correct

d)

None of the above

34.

What are the Command Object Methods?

a)

ExecuteNonQuery

b)

ExecuteReader

c)

ExecuteScalar

d)

All of the above

35.

Choose the correct option about DataSet object.

a)

Provides Disconnected mode

b)

Can store multiple table simultaneously

c)

Both option 1 & 2 are correct

d)

None of the above

36.

Choose the correct option about DataReader object.

a)

DataReader object is a forward-only object.

b)

It provides connection oriented environment.

c)

DataReader is read only object.

d)

All of the above

37.

The three statements are given below about DataSet and DataReader, choose the correct option according to the statement.


Statement 1: DataSet Provides Disconnected environment but DataReader provides Connected environment.


Statement 2: DataSet Provides Connected environment but DataReader provides Disconnected environment.



Statement 3: DataSet Can store multiple table simultaneously but DataReader Supports a single table based on a single SQL query.

a)

Only Statement 1 is correct.

b)

Statement 1 and 2 is correct.

c)

Statement 2 and 3 is correct.

d)

Statement 1 and 3 is correct.

38.

Which ADO.NET class provide Connected Environment?

a)

DataReader

b)

DataSet

c)

Command

d)

None of the above

39.

Which ADO.NET class provide Disconnected Environment?

a)

DataReader

b)

DataSet

c)

Command

d)

None of the above.

40.

What are the three main objects of DataSet?

a)

DataTable, DataColumn, and type.

b)

DataTable, DataRelation, and DataAdapter.

c)

DataTable, DataColumn, and DataRelation.

d)

DataReader,DataAdapter, and Command.