Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
81 views

Sample Basic Interview - Questions

The document discusses C# and ASP.NET questions and answers. It covers topics like inheritance, static keyword, serialization, session state, code-behind, caching, stored procedures, triggers, views, indexes, and cursors.

Uploaded by

dotnetlogesh
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views

Sample Basic Interview - Questions

The document discusses C# and ASP.NET questions and answers. It covers topics like inheritance, static keyword, serialization, session state, code-behind, caching, stored procedures, triggers, views, indexes, and cursors.

Uploaded by

dotnetlogesh
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 9

sC# Questions

1. If a base class has a bunch of overloaded constructors and an inherited class


has another bunch of overloaded constructors,can you enforce a call from a inherited
constructor to an arbitary base.

Yes (Correct Answer)


No

2. Which one will not combine with Static Keyword.

Abstract
Virtual
Override
All (Correct Answer)

3. Which C# Keyword can be applied to a class to prevent it from being used as a


base class.

Final
Sealed (Correct Answer)
Not Inheritable

4. FileSystemInfo Class provides which services

Only Basic Information about the file system such as the amount of free space on disk.

Sophisticated operations such as the ability to access network drives.

Operations common to both files and directories (Correct Answer).

6. Is the Static Modifier on the Program Entry Point required

Yes (Correct Answer)

No

7. For Xml Serialization using the .Net Framework which of the following is true of
object property

When a object is serialized only public read/write properties are serialized. (Correct
Answer)

When a object is serialized only public read properties are serialized.

When a object is serialized both public and private read/write properties are serialized.
8. A delegate field has what initial value

Zero

Null

Empty String.

9. What is the difference between 'Const' and 'Read Only'.

Const is evaluated at runtime

Read – Only is evaulated at complie time.

Const is evaluated at complile time. (Correct Answer)

Asp.Net Questions

1. Which one of the following is the correct code for inheriting from the ASP.NET
Page class?

Inherits System.Web.UI.Page (Correct Answer)

Inherits System.ASP.NET.Page

Inherits Page

Inherits Page.Class

Inherits System.Web.Page

2. How does ASP.NET store SessionIDs by default?

In cache

In URL strings

In cookies (correct answer)

In a global variable

In a database
3. What is the purpose of code-behind?

To merge layout HTML and the code into one file

To separate the layout HTML and the code into two different files
(Correct Answer)

To separate different sections of a page into different files according to


function

To merge different pages of an application into one file

To discard the use of HTML

4. You are developing an application in a corporate Intranet environment. The


servers are set up with a Windows 2000 Network Load Balancing (NLB) cluster to
distribute the application's load across multiple web servers.
Referring to the scenario above, how do you cache data on the Web server?

Store the data to disk.

Use in-process Session State

Use a SQL Server 2000 database to maintain state. (Correct Answer)

Use the Cache object.

Use the RapidCache object.

RDBMS

What is RDBMS?
Relational Data Base Management Systems (RDBMS) are database management
systems that maintain data records and indices in tables. Relationships may be created
and maintained across and among the data and tables. In a relational database,
relationships between data items are expressed by means of tables. Interdependencies
among these tables are expressed by data values rather than by pointers. This allows a
high degree of data independence. An RDBMS has the capability to recombine the data
items from different files, providing powerful tools for data usage.
What is normalization?
Database normalization is a data design and organization process applied to data
structures based on rules that help build relational databases. In relational database
design, the process of organizing data to minimize redundancy. Normalization usually
involves dividing a database into two or more tables and defining relationships between
the tables. The objective is to isolate data so that additions, deletions, and modifications
of a field can be made in just one table and then propagated through the rest of the
database via the defined relationships.

What are different normalization forms?


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 value from its 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 dependent on the primary key
BCNF: Boyce-Codd Normal Form
If there are non-trivial dependencies between candidate key attributes, separate them
out into distinct tables.
4NF: Isolate Independent Multiple Relationships
No table may contain two or more 1:n or n:m relationships that are not directly related.
5NF: Isolate Semantically Related Multiple Relationships
There may be practical constrains on information that justify separating logically related
many-to-many relationships.
ONF: Optimal Normal Form
A model limited to only simple (elemental) facts, as expressed in Object Role Model
notation.
DKNF: Domain-Key Normal Form
A model free from all modification anomalies.
Remember, these normalization guidelines are cumulative. For a database to be in
3NF, it must first fulfill all the criteria of a 2NF and 1NF database.
What is Stored Procedure?
A stored procedure is a named group of SQL statements that have been previously
created and stored in the server database. Stored procedures accept input parameters
so that a single procedure can be used over the network by several clients using
different input data. And when the procedure is modified, all clients automatically get the
new version. Stored procedures reduce network traffic and improve performance.
Stored procedures can be used to help ensure the integrity of the database.
e.g. sp_helpdb, sp_renamedb, sp_depends etc.
What is Trigger?
A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE
or UPDATE) occurs. Triggers are stored in and managed by the DBMS.Triggers are
used to maintain the referential integrity of data by changing the data in a systematic
fashion. A trigger cannot be called or executed; the DBMS automatically fires the trigger
as a result of a data modification to the associated table. Triggers can be viewed as
similar to stored procedures in that both consist of procedural logic that is stored at the
database level. Stored procedures, however, are not event-drive and are not attached
to a specific table as triggers are. Stored procedures are explicitly executed by invoking
a CALL to the procedure while triggers are implicitly executed. In addition, triggers can
also execute stored procedures.
Nested Trigger: A trigger can also contain INSERT, UPDATE and DELETE logic within
itself, so when the trigger is fired because of data modification it can also cause another
data modification, thereby firing another trigger. A trigger that contains data modification
logic within itself is called a nested trigger.
What is View?
A simple view can be thought of as a subset of a table. It can be used for retrieving
data, as well as updating or deleting rows. Rows updated or deleted in the view are
updated or deleted in the table the view was created with. It should also be noted that
as data in the original table changes, so does data in the view, as views are the way to
look at part of the original table. The results of using a view are not permanently stored
in the database. The data accessed through a view is actually constructed using
standard T-SQL select command and can come from one to many different base tables
or even other views.
What is Index?
An index is a physical structure containing pointers to the data. Indices are created in an
existing table to locate rows more quickly and 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 cannot
see the indexes, they are just used to speed up queries. Effective indexes are one of
the best ways to improve performance in a database application. A table scan happens
when there is no index available to help a query. In a table scan SQL Server examines
every row in the table to satisfy the query results. Table scans are sometimes
unavoidable, but on large tables, scans have a terrific impact on performance.
Clustered indexesdefine the physical sorting of a database table’s rows in the storage
media. For this reason, each database table may 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.

What is the difference between clustered and a non-clustered index?


A clustered index is a special type of index that reorders the way records in the table
are physically stored. Therefore table can have only one clustered index. The leaf
nodes of a clustered index contain the data pages.
A nonclustered index is a special type of index in which the logical order of the index
does not match the physical stored order of the rows on disk. The leaf node of a
nonclustered index does not consist of the data pages. Instead, the leaf nodes contain
index rows.
What are the different index configurations a table can have?
A table can have one of the following index configurations:
No indexes
A clustered index
A clustered index and many nonclustered indexes
A nonclustered index
Many nonclustered indexes
What is cursors?
Cursor is a database object used by applications to manipulate data in a set on a row-
by-row basis, instead of the typical SQL commands that operate on all the rows in the
set at one time.
In order to work with a cursor we need to perform some steps in the following order:
Declare cursor
Open cursor
Fetch row from the cursor
Process fetched row
Close cursor
Deallocate cursor
What is the use of DBCC commands?
DBCC stands for database consistency checker. We use these commands to check the
consistency of the databases, i.e., maintenance, validation task and status checks.
E.g. DBCC CHECKDB – Ensures that tables in the db and the indexes are correctly
linked.
DBCC CHECKALLOC – To check that all pages in a db are correctly allocated.
DBCC CHECKFILEGROUP – Checks all tables file group for any damage.
What is a Linked Server?
Linked Servers is a concept in SQL Server by which we can add other SQL Server to a
Group and query both the SQL Server dbs using T-SQL Statements. With a linked
server, you can create very clean, easy to follow, SQL statements that allow remote
data to be retrieved, joined and combined with local data.
Storped Procedure sp_addlinkedserver, sp_addlinkedsrvlogin will be used add new
Linked Server.
What is Collation?
Collation refers to a set of rules that determine how data is sorted and compared.
Character data is sorted using rules that define the correct character sequence, with
options for specifying case-sensitivity, accent marks, kana character types and
character width.
What are different type of Collation Sensitivity?
Case sensitivity
A and a, B and b, etc.
Accent sensitivity
a and á, o and ó, etc.
Kana Sensitivity
When Japanese kana characters Hiragana and Katakana are treated differently, it is
called Kana sensitive.
Width sensitivity
When a single-byte character (half-width) and the same character when represented as
a double-byte character (full-width) are treated differently then it is width sensitive.
What’s the difference between a primary key and a unique key?
Both primary key and unique enforce uniqueness of the column on which they are
defined. But by default primary key creates a clustered index on the column, where are
unique creates a nonclustered index by default. Another major difference is that,
primary key doesn’t allow NULLs, but unique key allows one NULL only.
How to implement one-to-one, one-to-many and many-to-many relationships
while designing tables?
One-to-One relationship can be implemented as a single table and rarely as two tables
with primary and foreign key relationships.
One-to-Many relationships are implemented by splitting the data into two tables with
primary key and foreign key relationships.
Many-to-Many relationships are implemented using a junction table with the keys from
both the tables forming the composite primary key of the junction table.

What is a NOLOCK?
Using the NOLOCK query optimiser hint is generally considered good practice in order
to improve concurrency on a busy system. When the NOLOCK hint is included in a
SELECT statement, no locks are taken when data is read. The result is a Dirty Read,
which means that another process could be updating the data at the exact time you are
reading it. There are no guarantees that your query will retrieve the most recent data.
The advantage to performance is that your reading of data will not block updates from
taking place, and updates will not block your reading of data. SELECT statements take
Shared (Read) locks. This means that multiple SELECT statements are allowed
simultaneous access, but other processes are blocked from modifying the data. The
updates will queue until all the reads have completed, and reads requested after the
update will wait for the updates to complete. The result to your system is
delay(blocking).
What is difference between DELETE & TRUNCATE commands?
Delete command removes the rows from a table based on the condition that we provide
with a WHERE clause. Truncate will actually remove all the rows from a table and there
will be no data in the table after we run the truncate command.

What are the properties of the Relational tables?


Relational tables have six properties:
 Values are atomic.
 Column values are of the same kind.
 Each row is unique.
 The sequence of columns is insignificant.
 The sequence of rows is insignificant.
 Each column must have a unique name.
What is De-normalization?
De-normalization is the process of attempting to optimize the performance of a database by
adding redundant data. It is sometimes necessary because current DBMSs implement the
relational model poorly. A true relational DBMS would allow for a fully normalized database at
the logical level, while providing physical storage of data that is tuned for high performance. De-
normalization is a technique to move from higher to lower normal forms of database modeling in
order to speed up database access.
How to get @@error and @@rowcount at the same time?
If @@Rowcount is checked after Error checking statement then it will have 0 as the value of
@@Recordcount as it would have been reset.
And if @@Recordcount is checked before the error-checking statement then @@Error would
get reset. To get @@error and @@rowcount at the same time do both in same statement and
store them in local variable. SELECT @RC = @@ROWCOUNT, @ER = @@ERROR
What is Identity?
Identity (or AutoNumber) is a column that automatically generates numeric values. A start and
increment value can be set, but most DBA leave these at 1. A GUID column also generates
numbers, the value of this cannot be controled. Identity/GUID columns do not need to be
indexed.
What is a Scheduled Jobs or What is a Scheduled Tasks?
Scheduled tasks let user automate processes that run on regular or predictable cycles. User can
schedule administrative tasks, such as cube processing, to run during times of slow business
activity. User can also determine the order in which tasks run by creating job steps within a SQL
Server Agent job. E.g. Back up database, Update Stats of Tables. Job steps give user control over
flow of execution. If one job fails, user can configure SQL Server Agent to continue to run the
remaining tasks or to stop execution.
What is a table called, if it does not have neither Cluster nor Non-cluster Index? What is it
used for?
Unindexed table or Heap. Microsoft Press Books and Book On Line (BOL) refers it as Heap.
A heap is a table that does not have a clustered index and, therefore, the pages are not linked by
pointers. The IAM pages are the only structures that link the pages in a table together.
Unindexed tables are good for fast storing of data. Many times it is better to drop all indexes
from table and than do bulk of inserts and to restore those indexes after that.
What is BCP? When does it used?
BulkCopy is a tool used to copy huge amount of data from tables and views. BCP does not copy
the structures same as source to destination.
What is DataWarehousing?
 Subject-oriented, meaning that the data in the database is organized so that all the data
elements relating to the same real-world event or object are linked together;
 Time-variant, meaning that the changes to the data in the database are tracked and
recorded so that reports can be produced showing changes over time;
 Non-volatile, meaning that data in the database is never over-written or deleted, once
committed, the data is static, read-only, but retained for future reporting;
 Integrated, meaning that the database contains data from most or all of an organization’s
operational applications, and that this data is made consistent.
What is OLTP(OnLine Transaction Processing)?
In OLTP – online transaction processing systems relational database design use the discipline of
data modeling and generally follow the Codd rules of data normalization in order to ensure
absolute data integrity. Using these rules complex information is broken down into its most
simple structures (a table) where all of the individual atomic level elements relate to each other
and satisfy the normalization rules.

ASP.Net

1. Which of the following technologies supports object pooling


a)COM+ b)Remoting c)Webservice

2. Which of the following state management will not work in a WebFarm environment
a) Session b) Cache c) ViewState

3. Which of the following type of control which can be dynamically added by end user to a web page.
a) Custom control b) User Control c) WebPart

4. Which of the following providers supports MARS ?


a) SqlClient b) OleDb c) OracleClient

5. The server control used to update the Cached page and respond
a) Label b) Substitution c) HiddenTextBox

6. The new data binding technique which facilitates no coding sometimes is possible through
a) DataSet b) DataBind c) DataSource

Answers:
1 a)
2 a)
3 c)
4 a)
5 b)
6 c)

You might also like