|
VB.NET Interview questions and answer part 3.
By Nishant Kumar
Part 1 | Part 2 | Part 3 | Part 4 | part
5
Define arrays and
collections. | Why do you use properties instead
of fields? | Define delegate. |
Define parse method. | Briefly describe
kinds of multidimensional arrays. | What is
encapsulation? | Define method overloading.
| Describe an abstract class. |
Describe Break mode. | Define Watch
window? | What is trace? Describe its
working. | Describe exception handling in
VB.NET. | What is data provider? Explain its
components. | ADO.NET. | Explain
commandType property of a SqlCommand object. |
Define typed and untyped DataSet objects.
Question - Define
arrays and collections. Answer - An array is fixed
length type that can store group of objects. A collection can also
store group of objects. But unlike an array which is fixed length,
the collection can grow or shrink dynamically, and items can be
added or removed at run time.
Question - Why do you use properties
instead of fields? Answer - You can provide
validation code with properties that validate data being read or
set. You can not add any validation code while using fields.
Question - Define delegate.
Answer - A delegate acts like
a strongly typed function pointer. Delegates can invoke the methods
that they reference without making explicit calls to those methods.
Question - Define
parse method. Answer - Parse method is used
to convert string value to numeric type. All numeric data type have
a Parse method.
Question - Briefly describe kinds of
multidimensional arrays. Answer - Multidimensional
arrays are just like a table structure with rows and column.
Multidimensional arrays can be either rectangular arrays or jagged
arrays. A rectangular array has same number of columns for each row.
A Jagged array can contain different number of columns for each row.
Question - What is encapsulation?
Answer -
Question - Define
method overloading. Answer - It allows several
methods with the same name but different signatures. It is useful
where several similar functionalities are required.
Question - Describe an abstract class.
Answer - An abstract class is
a class that cannot be instantiated but must be inherited. It can
contain both implemented methods and abstract methods.
Question - Describe
Break mode. Answer - Break mode allows
reading code line-by-line. You can observe code in Break mode by
using Step Into, Step Over, Step Out, Run To Cursor, and Set Next Statement.
Question - Define Watch window? Answer - Watch window is used
to watch the values of application variables in Break mode.
Question -
What is trace? Describe its working. Answer - Trace produces
messages about program conditions even after application is compiled
and released without interrupting application
execution.
Steps to add Trace in the code. Create an
instance of TextWriterTraceListener and add it to the Listeners
collection. Configure the TextWriterTraceListener to write
output to a text file. Create Trace switches that control when
Trace statements are executed. Compile and deploy the
application with Trace defined. Enable the Trace switches in the
application .config file.
Question - Describe exception handling in
VB.NET. Answer - The Try block
encapsulate set of code that is error prone and can throw exception.
If an exception is thrown, it can be caught in an appropriate Catch
(catch) block. You have Finally block that can contain code that
must be executed even if no exception is handled.
Question - What is
data provider? Explain its components. Answer - Data Provider is a
set of components that facilitate data access. It contains
components like connection, command, dataReader, dataAdapter.
Connection object connects to the data source. Command object
represents a direct command to the data source. DataReader object
that provides connected, forward-only, read-only access to a
database. DataAdapter that provides disconnected data
access.
Question - Define DataReader and DataAdapter in ADO.NET. Answer - DataReader: It is
lightweight class that provides connected and forward-only data
access. It uses connection object exclusively. You can read data;
you can’t modify data using DataReader.
DataAdapter: This class
provides disconnected data access. It opens a data connection just
long enough to retrieve the data, and loads the data into a DataSet,
thus provides in-memory copy of the data.
Question - Explain commandType property of
a SqlCommand object. Answer - CommandType property
can set to Text, StoredProcedure, or TableDirect. Text: This
directs the command object to execute the SQL string.
StoredProcedure: This indicates that command object has to
access stored procedure. TableDirect: This indicates that
command object has to retrieve contents of the table.
Question - Define typed and untyped DataSet
objects.
Part 1 | Part 2 | Part 3 | Part 4 | part
5
<<Previous Next>>
|