wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CP3 FINALS

Total questions: 112

Worksheet time: 56mins

Name
Class
Date
1.

Represent a source that provides a sequence of bytes, such as a file, an input/output (I/O) device, an communication pipe, or a TCP/IP socket.

a)

Streams

b)

ADO.NET

c)

File Pointer

d)

Seek

2.

It is a class that is used to create a byte-oriented stream attached to a file.

a)

Streams

b)

ADO.NET

c)

File Pointer

d)

FileStream

3.

It refers to a printer, remote server location, or a printer where the data is written.

a)

Output Streams

b)

Input Streams

c)

Data Buffer

d)

Network Socket

4.

It refers to a file or any source where the data can be read and assigned to the memory variables

in the program.

a)

Output Streams

b)

Input Streams

c)

Data Buffer

d)

Network Socket

5.

In C#, which namespace contains classes specifically designed for working with files, including reading and writing their contents?

a)

System.Text

b)

System.Data

c)

System.IO

d)

System.Collections

6.

The code to be used for creating a FileStream object is?

a)

FileStream(string filename,FileMode mode)

b)

FileStream(string path, FileAccess access)

c)

FileStream(string path, FileMode mode, FileAccess access)

d)

FileStream(string filename, FileShare share)

7.

It creates a new output file, which will be overwritten if a file already exists.

a)

FileMode.Create

b)

FileMode.CreateNew

c)

FileMode.Open

d)

FileMode.OpenOrCreate

8.

It creates a new output file that is not existing.

a)

FileMode.Create

b)

FileMode.CreateNew

c)

FileMode.Open

d)

FileMode.OpenOrCreate

9.

It opens an existing file.

a)

FileMode.Truncate

b)

FileMode.CreateNew

c)

FileMode.Open

d)

FileMode.OpenOrCreate

10.

It opens an existing. If not, it creates a new one.

a)

FileMode.Truncate

b)

FileMode.CreateNew

c)

FileMode.Open

d)

FileMode.OpenOrCreate

11.

It opens an existing file and truncates the content that already exists.

a)

FileMode.Truncate

b)

FileMode.CreateNew

c)

FileMode.Open

d)

FileMode.OpenOrCreate

12.

This method reads a single byte from a file and returns as an integer value.

a)

ReadByte()

b)

Read()

c)

WriteByte()

d)

Write()

13.

This method reads the specified number of bytes from a file into an array.

a)

ReadByte()

b)

Read()

c)

WriteByte()

d)

Write()

14.

It writes the specified byte into the file.

a)

ReadByte()

b)

Read()

c)

WriteByte()

d)

Write()

15.

It writes an array of bytes into the file.

a)

Flush()

b)

void Close()

c)

WriteByte()

d)

Write()

16.

This method instantly writes the data into the file.

a)

Flush()

b)

void Close()

c)

WriteByte()

d)

Write()

17.

This method closes the file, releasing the system resources that are allocated to it.

a)

Flush()

b)

void Close()

c)

WriteByte()

d)

Write()

18.

Determines the location of the next read/write operation to take place on the file.

a)

File Pointer

b)

File Stream

c)

File Buffer

d)

File Handle

19.

The method used to relocate the file pointer in the file

a)

Seek

b)

Read

c)

Write

d)

Open

20.

Method that allows setting the file position indicator of file pointer to the preferred location in the file.

a)

Seek

b)

Read

c)

Write

d)

Open

21.

Syntax for seek method

a)

long Seek(long n, SeekOrigin location)

b)

void Seek(long n, SeekOrigin location)

c)

long Seek(int n, SeekOrigin location)

d)

Seek(long n, SeekOrigin location)

22.

It returns true if the stream can be read.

a)

bool CanRead

b)

bool CanSeek

c)

bool CanTimeout

d)

bool CanWrite

23.

It returns true if the stream supports position requests.

a)

bool CanRead

b)

bool CanSeek

c)

bool CanTimeout

d)

bool CanWrite

24.

It returns true if the stream can time out.

a)

bool CanRead

b)

bool CanSeek

c)

bool CanTimeout

d)

bool CanWrite

25.

It returns true if the stream can be written.

a)

long length

b)

int ReadTimeout

c)

int WriteTimeout

d)

bool CanWrite

26.

It contains the size of the stream.

a)

long length

b)

int ReadTimeout

c)

int WriteTimeout

d)

bool CanWrite

27.

It indicates the time before a timeout occurs for read operations.

a)

long length

b)

int ReadTimeout

c)

int WriteTimeout

d)

bool CanWrite

28.

It indicates the time before a timeout occurs for write operations.

a)

long length

b)

int ReadTimeout

c)

int WriteTimeout

d)

bool CanWrite

29.

Writes characters to a stream and contains several constructors

a)

StreamWriter

b)

FileStream

c)

StreamReader

d)

StringBuilder

30.

It is used to create a character-based output stream.

a)

SteamWriter(Stream stream)

b)

StreamWriter(string fileName)

c)

StreamReader(Stream stream)

d)

FileStream(string path, FileMode mode)

31.

It is used to open a file directly.

a)

SteamWriter(Stream stream)

b)

StreamWriter(string fileName)

c)

StreamReader(Stream stream)

d)

FileStream(string path, FileMode mode)

32.

It closes the file.

a)

Close()

b)

Flush()

c)

Write()

d)

WriteLine()

33.

It instantly saves the file content from buffer to memory

a)

Close()

b)

Flush()

c)

Write()

d)

WriteLine()

34.

Using a File stream class, this writes into the specified file.

a)

Close()

b)

Flush()

c)

Write()

d)

WriteLine()

35.

Line by line, it writes into a file.

a)

Close()

b)

Flush()

c)

Write()

d)

WriteLine()

36.

It is the name of an open stream such I/O devices or a file.

a)

StreamReader(Stream stream)

b)

StreamReader(string fileName)

c)

StreamReader(Stream stream)

d)

FileStream(string path, FileMode mode)

37.

It specifies the name of the file to open.

a)

StreamReader(Stream stream)

b)

StreamReader(string fileName)

c)

StreamReader(Stream stream)

d)

FileStream(string path, FileMode mode)

38.

From buffer to memory, it instantly saves the file content.

a)

Flush()

b)

Close()

c)

Read()

d)

ReadLine()

39.

It closes the file and is mandatory to this class.

a)

Flush()

b)

Close()

c)

Read()

d)

ReadLine()

40.

From the file stream, it reads the content.

a)

Flush()

b)

Close()

c)

Read()

d)

ReadLine()

41.

From the given file stream, it reads the content line by line.

a)

ReadToEnd()

b)

Peek()

c)

Seek()

d)

ReadLine()

42.

From the current location until the end of the stream, it reads all characters.

a)

ReadToEnd()

b)

Peek()

c)

Seek()

d)

ReadLine()

43.

It returns the value in the stream without moving the file pointer.

a)

ReadToEnd()

b)

Peek()

c)

Seek()

d)

ReadLine()

44.

Sets the file pointer at the desired position in a file.

a)

ReadToEnd()

b)

Peek()

c)

Seek()

d)

ReadLine()

45.

ADO.NET

a)

Active Data Objects

b)

Advanced Data Objects

c)

Abstract Data Object

d)

ActiveX Data Objects

46.

One of the five (5) data providers that gives data access on Microsoft SQL Server.

a)

Data Provider for SQL Server

b)

Data Provider for OLE DB

c)

Data Provider for ODBC

d)

Data Provider for Oracle

47.

One of the five (5) data providers that is used for connecting OLE DB data source.

a)

Data Provider for SQL Server

b)

Data Provider for OLE DB

c)

Data Provider for ODBC

d)

Data Provider for Oracle

48.

System.Data.SqlClient

a)

Data Provider for SQL Server

b)

Data Provider for OLE DB

c)

Data Provider for ODBC

d)

Data Provider for Oracle

49.
a)

Data Provider for SQL Server

b)

Data Provider for OLE DB

c)

Data Provider for ODBC

d)

Data Provider for Oracle

50.
a)

Data Provider for SQL Server

b)

Data Provider for OLE DB

c)

Data Provider for ODBC

d)

Data Provider for Oracle

51.
a)

EntityClient Provider

b)

Data Provider for OLE DB

c)

Data Provider for ODBC

d)

Data Provider for Oracle

52.
a)

EntityClient Provider

b)

Data Provider for OLE DB

c)

Data Provider for ODBC

d)

Data Provider for Oracle

53.

It manages the data for any entity. It contains zero or more rows of data, and each value shown

in the data table is identified by the DataColumn. It also consists of primary key, foreign key, constraint, and relation information of different tables.

a)

DataTable

b)

DataColumn

c)

DataRelation

d)

DataColumnMapping

54.

It includes a data type declaration based on the kind of data saved.

a)

DataTable

b)

DataColumn

c)

DataRelation

d)

DataColumnMapping

55.

It is used to link two (2) DataTable classes inside the DataSet class.

a)

DataView

b)

DataColumn

c)

DataRelation

d)

DataColumnMapping

56.

It is used to map a table name from the database to a DataTable within a DataSet.

a)

DataView

b)

DataColumn

c)

DataRelation

d)

DataColumnMapping

57.

It is used to customize the view of the table or desired view of the rows in a DataTable.

a)

DataView

b)

DataColumn

c)

DataRelation

d)

DataColumnMapping

58.

It can run SQL commands and perform a stored procedure—accessing and manipulating data. Data

management statements and SQL queries are wrapped in the Command object.

a)

Command

b)

Connection

c)

DataAdapters

d)

DataReaders

59.

From the data source, it allows users to connect and disconnect. Communications with the external

data sources happen through the Connection object.

a)

Command

b)

Connection

c)

DataAdapters

d)

DataReaders

60.

It transfers DataSets between the data source and the caller. It also acts as a connection between

the data source and DataSet, where DataAdapters contain a connection and set of Command objects that help in fetching and updating data.

a)

Command

b)

Connection

c)

DataAdapters

d)

DataReaders

61.

It is a read-only access to data using a server-side cursor. The DataReader object is gained by

invoking the ExecuteReader method of the Command object. It requires closing the connection when using the DataReader object.

a)

Command

b)

Connection

c)

DataAdapters

d)

DataReaders

62.

Used as wrappers for SQL statements or stored procedure calls.

a)

SqlCommand, OleDbCommand, and ODBCCommand

b)

SqlCommandBuilder, OleDbCommandBuilder, and ODBCCommandBuilder

c)

SqlConnection, OleDbConnection, and ODBCConnection

d)

SqlDataAdapter, OleDbDataAdapter, and ODBCDataAdapter

63.

Generate SQL commands for updating database tables

Automatically generate SQL commands from a SELECT statement

a)

SqlCommand, OleDbCommand, and ODBCCommand

b)

SqlCommandBuilder, OleDbCommandBuilder, and ODBCCommandBuilder

c)

SqlConnection, OleDbConnection, and ODBCConnection

d)

SqlDataAdapter, OleDbDataAdapter, and ODBCDataAdapter

64.

Used to connect to the database

a)

SqlCommand, OleDbCommand, and ODBCCommand

b)

SqlCommandBuilder, OleDbCommandBuilder, and ODBCCommandBuilder

c)

SqlConnection, OleDbConnection, and ODBCConnection

d)

SqlDataAdapter, OleDbDataAdapter, and ODBCDataAdapter

65.

Handle interaction between DataSet and data source

Help in executing different SQL commands to populate a DataSet and update the data source

a)

SqlDataReader, OleDbDataReader, and ODBCDataReader

b)

SqlParameter, OleDbParameter, and ODBCParameter

c)

SqlTransaction, OleDbTransaction, and ODBCTransaction

d)

SqlDataAdapter, OleDbDataAdapter, and ODBCDataAdapter

66.

Used as a forward-only, read-only access to data using a cursor.

a)

SqlDataReader, OleDbDataReader, and ODBCDataReader

b)

SqlParameter, OleDbParameter, and ODBCParameter

c)

SqlTransaction, OleDbTransaction, and ODBCTransaction

d)

SqlDataAdapter, OleDbDataAdapter, and ODBCDataAdapter

67.

Define a parameter to a stored procedure.

a)

SqlDataReader, OleDbDataReader, and ODBCDataReader

b)

SqlParameter, OleDbParameter, and ODBCParameter

c)

SqlTransaction, OleDbTransaction, and ODBCTransaction

d)

SqlDataAdapter, OleDbDataAdapter, and ODBCDataAdapter

68.

Represent transactions to be made in data source

a)

SqlDataReader, OleDbDataReader, and ODBCDataReader

b)

SqlParameter, OleDbParameter, and ODBCParameter

c)

SqlTransaction, OleDbTransaction, and ODBCTransaction

d)

SqlDataAdapter, OleDbDataAdapter, and ODBCDataAdapter

69.

It includes all generic data access classes.

b)
c)

System.Data.EntityClient

d)

System.Data.Linq.SqlClient

70.

It includes classes that are shared or overridden by individual data providers.

b)
c)

System.Data.EntityClient

d)

System.Data.Linq.SqlClient

71.

It includes Entity Framework classes.

b)
c)

System.Data.EntityClient

d)

System.Data.Linq.SqlClient

72.

It includes LINQ to SQL provider classes.

75.

It includes new base classes and connection factory classes.

76.

It includes new generic interfaces and classes for SQL Server data access.

79.

CREATE DATABASE db_name;

a)

Query for creating a database

b)

Query for dropping a database

c)

Query for creating a database table

d)

Query for dropping a database table

80.

DROP DATABASE db_name;

a)

Query for creating a database

b)

Query for dropping a database

c)

Query for creating a database table

d)

Query for dropping a database table

81.

CREATE TABLE table_name ( column1 datatype, column2 datatype,

column3 datatype,...);

a)

Query for creating a database

b)

Query for dropping a database

c)

Query for creating a database table

d)

Query for dropping a database table

82.

DROP TABLE table_name;

a)

Query for creating a database

b)

Query for dropping a database

c)

Query for creating a database table

d)

Query for dropping a database table

83.

The first step in accessing data from the database (C-O-C-U-C)

a)

Create a connection to the specified server.

b)

Open a connection using the SqlConnection object.

c)

Create a command using the SqlCommand object.

d)

Use and create a DataReader or DataAdapter object.

e)

Call the Close() method to close the connection and release the resources.

84.

The SECOND step in accessing data from the database (C-O-C-U-C)

a)

Create a connection to the specified server.

b)

Open a connection using the SqlConnection object.

c)

Create a command using the SqlCommand object.

d)

Use and create a DataReader or DataAdapter object.

e)

Call the Close() method to close the connection and release the resources.

85.

The THIRD step in accessing data from the database (C-O-C-U-C)

a)

Create a connection to the specified server.

b)

Open a connection using the SqlConnection object.

c)

Create a command using the SqlCommand object.

d)

Use and create a DataReader or DataAdapter object.

e)

Call the Close() method to close the connection and release the resources.

86.

The FOURTH step in accessing data from the database (C-O-C-U-C)

a)

Create a connection to the specified server.

b)

Open a connection using the SqlConnection object.

c)

Create a command using the SqlCommand object.

d)

Use and create a DataReader or DataAdapter object.

e)

Call the Close() method to close the connection and release the resources.

87.

The FIFTH step in accessing data from the database (C-O-C-U-C)

a)

Create a connection to the specified server.

b)

Open a connection using the SqlConnection object.

c)

Create a command using the SqlCommand object.

d)

Use and create a DataReader or DataAdapter object.

e)

Call the Close() method to close the connection and release the resources.

88.

This class is used to open a connection using the Open() method. The connection can be closed by calling the Close() method.

a)

SqlConnection

b)

SqlCommand

c)

SqlDataReader

d)

SqlDataSet

89.

A property that is used to read or assign the connection string to be used by the SqlConnection class.

a)

ConnectionString

b)

DataSource

c)

Database

d)

State

90.

A read-only property that returns the name of the SQL Server instance.

a)

ConnectionString

b)

DataSource

c)

Database

d)

State

91.

A read-only property that returns the name of the database.

a)

ConnectionString

b)

DataSource

c)

Database

d)

State

92.

A read-only property that returns the current state of the connection.

a)

ConnectionString

b)

DataSource

c)

Database

d)

State

93.

This class is used to perform desired processing on the database. It allows executing any direct T-SQL or stored procedure on the server.

a)

SqlConnection

b)

SqlCommand

c)

SqlDataReader

d)

SqlParameterCollection

94.

This method executes the command but does not return output.

a)

ExecuteNonQuery

b)

ExecuteReader

c)

SqlDataReader

d)

ExecuteRow

e)

ExecuteScalar

95.

This method executes the command and returns a DataReader object based on the SQL statement.

a)

ExecuteNonQuery

b)

ExecuteReader

c)

SqlDataReader

d)

ExecuteRow

e)

ExecuteScalar

96.

This object is forward-only and read-only cursor that can be iterated through to fetch the rows in it.

a)

ExecuteNonQuery

b)

ExecuteReader

c)

SqlDataReader

d)

ExecuteRow

e)

ExecuteScalar

97.

It executes the command and returns the SqlRecord object that contains a single returned row.

a)

ExecuteNonQuery

b)

ExecuteReader

c)

SqlDataReader

d)

ExecuteRow

e)

ExecuteScalar

98.

It executes the command and returns the first column of the first row in the result set.

a)

ExecuteNonQuery

b)

ExecuteReader

c)

SqlDataReader

d)

ExecuteRow

e)

ExecuteScalar

99.

It gets or sets the SqlConnection class that can be used by the Command object.

a)

Connection

b)

CommandText

c)

CommandType

d)

CommandTrial

100.

It gets or sets the stored procedure or the T-SQL statement.

a)

Connection

b)

CommandText

c)

CommandType

d)

CommandTrial

101.

It indicates the way the CommandText property should be interpreted.

a)

Connection

b)

CommandText

c)

CommandType

d)

CommandTrial

102.

It refers to a collection of parameters that is connected with SqlCommand.

a)

SqlConnection

b)

SqlCommand

c)

SqlDataReader

d)

SqlParameterCollection

103.

Query for selecting all the data of the table

a)

SELECT * FROM table_name;

b)

SELECT column1, column2, column3,... FROM table_name;

c)

CREATE TABLE table_name ( column1 datatype, column2 datatype,

column3 datatype,...);

d)

DROP TABLE table_name;

104.

Query for selecting specific columns of the table

a)

SELECT * FROM table_name;

b)

SELECT column1, column2, column3,... FROM table_name;

c)

CREATE TABLE table_name ( column1 datatype, column2 datatype,

column3 datatype,...);

d)

DROP TABLE table_name;

105.

Query for inserting data for all the columns of the table

a)

INSERT INTO table_name VALUES(value1, value2, value3,... );

b)

INSERT INTO table_name (column1, column2, column3, ... ) VALUES(value1, value2, value3, ... );

c)

CREATE TABLE table_name ( column1 datatype, column2 datatype,

column3 datatype,...);

d)

DROP TABLE table_name;

106.

Query for inserting data for specified column names

a)

INSERT INTO table_name VALUES(value1, value2, value3,... );

b)

INSERT INTO table_name (column1, column2, column3, ... ) VALUES(value1, value2, value3, ... );

c)

CREATE TABLE table_name ( column1 datatype, column2 datatype,

column3 datatype,...);

d)

DROP TABLE table_name;

107.

Query for updating data.

a)

UPDATE table_name SET column1 = value1, column2 = value2, column3 = value3 WHERE condition;

b)

INSERT INTO table_name (column1, column2, column3, ... ) VALUES(value1, value2, value3, ... );

c)

CREATE TABLE table_name ( column1 datatype, column2 datatype,

column3 datatype,...);

d)

DROP TABLE table_name;

108.

It adds the specified SqlParameter object to the SqlParameterCollection and contains two (2) arguments: string paramaterName and SqlDbType.

a)

Add()

b)

AddWithValue()

c)

Insert()

d)

SetParameter()

109.

It adds a value to the end of the SqlParameterCollection and contains two (2) arguments, a string parameterName and an object, that includes the value of that parameter.

a)

Add()

b)

AddWithValue()

c)

Insert()

d)

SetParameter()

110.

The correct syntaxt for Add()

a)

public SqlParameter Add(string paramterName, SqlDbtype sqlDbType);

b)

public void Add(string paramterName, SqlDbType sqlDbType);

c)

public SqlParameter Add(string paramterName, object value);

d)

public void Add(SqlParameter parameter);

111.

The correct syntax for AddWithValues()

a)

public SqlParameter AddWithValue(string parameterName, object value);

b)

public void AddWithValue(string parameterName, object value);

c)

public SqlParameter AddWithValue(object value, string parameterName);

d)

public SqlParameter AddWithValue(SqlDbType dataType, object value);

112.

It is used to modify or update an existing record. It uses the WHERE clause to determine the number of records that will be updated.

a)

SQL UPDATE

b)

SQL INSERT

c)

SQL DELETE

d)

SQL SELECT

Similar Resources on Wayground