0% found this document useful (0 votes)
20 views10 pages

Question Bank

Uploaded by

manthanb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLS, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views10 pages

Question Bank

Uploaded by

manthanb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLS, PDF, TXT or read online on Scribd
You are on page 1/ 10

What’s the difference between the System.Array.

CopyTo() and
System.Array.Clone()?
How can you sort the elements of the array in descending order?

What’s the .NET collection class that allows an element to be accessed


using a unique key?

Will the finally block get executed if an exception has not occurred?­

What’s the C# syntax to catch any possible exception?

Can you prevent your class from being inherited by another class?

Can you inherit multiple interfaces?


What is .NET framework

What is the role of data provider?


The Clone() method returns a new array (a shallow copy) object containing all the
elements in the original array. The CopyTo() method copies the elements into another
existing array. Both perform a shallow copy. A shallow copy means the contents (each
array element) contains references to the same object as the elements in the original
array. A deep copy (which neither of these methods performs) would create a new
instance of each element's object, resulting in a different, yet identacle object.

By calling Sort() and then Reverse() methods.

HashTable.

Yes.
catch block that catches the exception of type System.Exception. You can also omit
the parameter data type in this case and just write catch {}.

Yes. The keyword “sealed” will prevent the class from being inherited.

Yes. .NET does support multiple interfaces

The .NET data provider layer resides between the application and the database. Its
task is to take care of all their interactions.

The .NET Data provider can be demonstrated to be:

SQL Server data provider


OLEDB data provider
ODBC Data Provider

ADO.NET supports the following OLE DB Providers:

- SQLOLEDB - Microsoft OLE DB Provider for SQL Server.


- MSDAORA - Microsoft OLE DB Provider for Oracle.
- Microsoft.Jet.OLEDB.4.0 - OLE DB Provider for Microsoft Jet.
Question

What is Object Oriented Programming ?

What’s a Class ?

What’s a Object ?

What’s the difference between System.String and


System.Text.StringBuilder classes?
What’s an abstract class?

When do you absolutely have to declare a class as abstract?


What is an interface class?

What’s the difference between an interface and abstract class?

Between Windows Authentication and SQL Server Authentication,


which one is trusted and which one is untrusted?

What is the difference between Finalize() and Dispose()?

Explain the use of virtual, sealed, override, and abstract.

What are generics in C#.NET?

Explain serialization?

What is an Event?
What is GAC (global assembly cache)?

How is the DLL Hell problem solved in .NET?

What is partial class. & what is advantage.


What is .NET remoting
Answer

It is a problem solving technique to develop software systems. It’s a technique to think real world in terms of objects. Object maps the
software model to real world concept. These objects have responsibilities and provide services to application or other objects.
A class describes all the attributes of objects, as well as the methods that implement the behavior of member objects.Its a comprehensive
data type which represent a blue print of objects.It’s a template of object.
It’s a basic unit of a system.An object is an entity that has attributes, behavior, and identity. Objects are members of a class.Attributes
and behavior of an object are defined by the class definition.
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of
operations can be performed.
StringBuilder is more efficient in cases where there is a large amount of string manipulation. Strings are immutable, so each time a string
is changed, a new instance in memory is created
A class that cannot be instantiated. An abstract class is a class that must be inherited and have the methods overridden. An abstract
class is essentially a blueprint for a class without any implementation
1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden.
2. When at least one of the methods in the class is abstract.

Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation.
They are implemented by classes, and defined as separate entities from classes.

In an interface class, all methods are abstract - there is no implementation. In an abstract class some methods can be concrete. In an
interface class, no accessibility modifiers are allowed. An abstract class may have accessibility modifiers.

Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server
authentication is untrusted, since SQL Server is the only verifier participating in the transaction.

Dispose() is called by as an indication for an object to release any unmanaged resources it has held.
Finalize() is used for the same purpose as dispose however finalize doesn’t assure the garbage collection of an object.
Dispose() operates determinalistically due to which it is generally preferred.

The virtual keyword enables a class to be overridden. If it has to be prevented from being overridden, then the sealed keyword needs to
be used. If the keyword virtual is not used, members of the class can even then be overridden. However, its usage is advised for making
the code meaningful.

The override keyword is used to override the virtual method in the base class. Abstract keyword is used to modify a class, method or
property declaration. You cannot instantiate an abstract class or make calls to an abstract method directly.

An abstract virtual method means that the definition of the method needs to be given in the derived class.

Generic types to maximize code reuse, type safety, and performance.


They can be used to create collection classes.
Generic collection classes in the System.Collections.Generic namespace should be used instead of classes such as ArrayList in the
System.Collections namespace
Serialization is a process of converting an object into a stream of bytes. .Net has 2 serializers namely XMLSerializer and SOAP/BINARY
Serializer. Serialization is maily used in the concept of .Net Remoting.

When an action is performed, this action is noticed by the computer application based on which the output is displayed. These actions are
called events. Examples of events are pressing of the keys on the keyboard, clicking of the mouse. Likewise, there are a number of events
which capture your actions
GAC, global assembly cache is an area of memory reserved to store the assemblies of all .NET applications that are running on a certain
machine.

It shares assemblies among multiple .NET applications. The assemblies must have a strong name and must be publicly shared to be
installed in the GAC

DLL Hell problem is solved in .NET with the introduction of Assembly versioning. It allows the application to specify not only the library it
needs to run, but also the version of the assembly
Write down query to find out fifth maximum query

What are different normalization forms?

What is Stored Procedure?

What is Trigger?

What is Index?
What is difference between DELETE & TRUNCATE
commands?

Difference between Function and Stored Procedure?

What types of Joins are possible with Sql Server?

What is the difference between a HAVING CLAUSE


and a WHERE CLAUSE?

What is sub-query? Explain properties of sub-query.

What are types of sub-queries?


1NF: Eliminate Repeating Groups
Make a separate table for each set of related attributes, and give each table a primary key. Each field contains at most one va
attribute domain.
2NF: Eliminate Redundant Data
If an attribute depends on only part of a multi-valued key, remove it to a separate table.
3NF: Eliminate Columns Not Dependent On Key
If attributes do not contribute to a description of the key, remove them to a separate table. All attributes must be directly depen
primary key
BCNF: Boyce-Codd Normal Form
If there are non-trivial dependencies between candidate key attributes, separate them out into distinct tables.

A stored procedure is a named group of SQL statements that have been previously created and stored in the server database
procedures accept input parameters so that a single procedure can be used over the network by several clients using different
And when the procedure is modified, all clients automatically get the new version. Stored procedures reduce network traffic an
performance. Stored procedures can be used to help ensure the integrity of the database.
e.g. sp_helpdb, sp_renamedb, sp_depends etc.

A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs. Triggers are store
managed by the DBMS.Triggers are used to maintain the referential integrity of data by changing the data in a systematic fash
cannot be called or executed; the DBMS automatically fires the trigger as a result of a data modification to the associated table
can be viewed as similar to stored procedures in that both consist of procedural logic that is stored at the database level. Store
procedures, however, are not event-drive and are not attached to a specific table as triggers are. Stored procedures are explic
by invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can also execute stored proced
Nested Trigger: A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so when the trigger is fired becau
modification it can also cause another data modification, thereby firing another trigger. A trigger that contains data modification
itself is called a nested trigger.

An index is a physical structure containing pointers to the data. Indices are created in an existing table to locate rows more qu
efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cann
indexes, they are just used to speed up queries. Effective indexes are one of the best ways to improve performance in a datab
application. A table scan happens when there is no index available to help a query. In a table scan SQL Server examines ever
table to satisfy the query results. Table scans are sometimes unavoidable, but on large tables, scans have a terrific impact on
performance.

Clustered indexes define the physical sorting of a database table’s rows in the storage media. For this reason, each database
have only one clustered index.
Non-clustered indexes are created outside of the database table and contain a sorted list of references to the table itself.
Delete command removes the rows from a table based on the condition that we provide with a WHERE clause. Truncate will a
remove all the rows from a table and there will be no data in the table after we run the truncate command.

TRUNCATE
TRUNCATE is faster and uses fewer system and transaction log resources than DELETE.
TRUNCATE removes the data by deallocating the data pages used to store the table’s data, and only the page deallocations a
in the transaction log.
TRUNCATE removes all rows from a table, but the table structure and its columns, constraints, indexes and so on remain. The
used by an identity for new rows is reset to the seed for the column.
You cannot use TRUNCATE TABLE on a table referenced by a FOREIGN KEY constraint.
Because TRUNCATE TABLE is not logged, it cannot activate a trigger.
TRUNCATE can not be Rolled back using logs.
TRUNCATE is DDL Command.
TRUNCATE Resets identity of the table.

DELETE
DELETE removes rows one at a time and records an entry in the transaction log for each deleted row.
If you want to retain the identity counter, use DELETE instead. If you want to remove table definition and its data, use the DRO
statement.
DELETE Can be used with or without a WHERE clause

UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures can
UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables.
Inline UDF’s can be though of as views that take parameters and can be used in JOINs and other Rowset operations.
Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upo
another table.
Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs. OUTER JOINs are further classified as LEFT OUTER JOINS, R
OUTER JOINS and FULL OUTER JOINS
Specifies a search condition for a group or an aggregate. HAVING can be used only with the SELECT statement. HAVING is t
in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause. Having Clause is basically us
the GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the GROUP BY function in
HAVING criteria is applied after the the grouping of rows has occurred.

Sub-queries are often referred to as sub-selects, as they allow a SELECT statement to be executed arbitrarily within the body
SQL statement. A sub-query is executed by enclosing it in a set of parentheses. Sub-queries are generally used to return a sin
an atomic value, though they may be used to compare values against multiple rows with the IN keyword.

A subquery is a SELECT statement that is nested within another T-SQL statement. A subquery SELECT statement if executed
independently of the T-SQL statement, in which it is nested, will return a result set. Meaning a subquery SELECT statement ca
standalone and is not depended on the statement in which it is nested. A subquery SELECT statement can return any number
and can be found in, the column list of a SELECT statement, a FROM, GROUP BY, HAVING, and/or ORDER BY clauses of a
statement. A Subquery can also be used as a parameter to a function call. Basically a subquery can be used anywhere an exp
be used.

Single-row subquery, where the subquery returns only one row.


Multiple-row subquery, where the subquery returns multiple rows,.and
Multiple column subquery, where the subquery returns multiple columns

You might also like