Chapter 1: MS-SQL Server
Q1. What is Relation in RDBMS?
Ans A table in a database is called as
relation.
Q2. What is Tuple?
Ans A Row of a table in database is
called as tuple.
Q3. What is RDBMS?
Ans1:DBMS is a layer of abstraction between application and database.2:Application
interact with the Database via DBMS using Structure Query Language(SQL).3 :If the database is logically in the
form of tables i.e., relation then we call this DBMS as RDBMS.
Q4. What is Primary Key?
1: Primary Key is
a column of a table which is used to identity a row uniquely. 2: Primary Key cannot have NULL values.3:Primary Key cannot have duplicate values.
Q5. What is Unique Key?
● Unique Key is
a column in a table which does not allow duplicate values like primary key. 2: It allows one and only one NULL
values.3:A table can
have one and only one primary key. 4: A table can have one or more unique keys.
Q6. What is Foreign key?
Ans Foreign key is a column of one table
which refers to the Primary Key column of another table. It allows NULL values.
It allows Duplicate values.
Q7. What is use of Group by clause?
● Group by
clause is used to display data by combining or grouping one or more columns.
● Group by
clause is always is used in combination with Aggregate Functions.
● Basically
Group By clause comes after Where Clause and before Having Clause.
● The typical
order of clauses in a query is WGHO (W-Where, G-Group By, Having-Order By) in
most of the queries
Q8. What is Having Clause?
● Having clause
is similar to where clause.
● Having clause
is used to filter the column generated by aggregate functions.
● As where
clause cannot be used with aggregate functions.
Q9. What is the use of DateDiff and DateAdd Functions
?
● DateDiff Function
is used to find the difference between two dates in terms of
years or months or days or hours or minutes or seconds or
milliseconds.
● DateAdd
Function is used to generate a new date from a specific date by adding or
subtracting years or months or days or hours or minutes or seconds or
milliseconds.
What is a Trigger?
A database trigger is a stored procedure that is invoked
automatically when a predefined event occurs. If a trigger event occurs, the
trigger's function is called at the appropriate time to handle the event.
Q10. What is Join?
● Join is a
Clause used to extract the data from two or more tables based on a
specific columns or Primary - Foreign Key relationship
● There are
various Joins like Inner Join, Left Outer Join, Right Outer Join, Full
Outer Join,Self Join.
Q11. What is Inner Join ?
● Inner join is
a join to get data based on matched rows from left table and
matched rows from right table.
Q12. What is Left Outer Join?
● Left Outer
join is a join to get all the rows from left table and matched rows from right
table.
Q13. What is Right Outer Join?
● Right Outer
join is a join to get matched rows from left table and all rows from right
table.
Q14. What is Full Outer Join ?
● Full Outer
join is Join to get all rows from left table and all rows from right table.
Q15. What is Self Join ?
● Self join is
Join which is applied on same table.
● Joining a
table with itself with different table aliasing.
Q16. What is Stored Procedure ?
● Stored
Procedure is precompiled set of one or more SQL statements which
performs some specific task.
● Store
Procedure should be executed stand alone using EXEC.
● Store
Procedure can return multiple parameters.
● Store
Procedure can be used to implement transaction.
Q17. What is Functions?
● A Functions is
a section of code that performs an independent task.
● Function
cannot be executed stand alone, it is always used in a query like with select
clause.
● Functions can
return one and only one parameter.
● We cannot
implement transaction using functions.
Q18. What is Transaction?
● Transaction is
a set of operation (SQL Queries) which must be executed as a
group.
● If at all a
single operation is failed then all the previous operation of that group must
be rolled back i.e., undone.
Q19. What is Scope_Identity() function?
● Scope_Identity
function returns the recent generated identity value (that is auto incremented
values) for that particular scope i.e., user.
Chapter 2: MS.Net Framework
Q20. What is dotnet framework?
● Dotnet
framework is a language neutral platform which is used to develop any
kind of application like web application, windows application,
mobile application,
web services, etc.,
● It is called
as language neutral because multiple programming languages uses the same class
library which is called as frame class library or base class library.
● Latest version
of .Net as on DEC 2013 is 4.5
Q21. What is CLR ?
● CLR stands for
common language runtime and it provides a runtime environment for dotnet
applications.
● It supports
memory management, exception management, type safety, code
Management(Loading and Execution), MSIL to native code
conversion.
Q22. What is MSIL or assembly or component?
● MSIL stands
for Microsoft Intermediate Language.
● The compiled
version of c# code is called as assembly or MSIL or IL or
component.
Q23. What is the difference between exe and dll ?
● .exe and dll
are the compiled version of c# code which are also called as
assemblies.
● .exe is a
stand alone executable file, which means it can executed directly.
● .dll is a
reusable component which cannot be executed directly and it requires
other programs to execute it.
Q24. What is JIT compiler?
● JIT stands for
just in time compiler.
● It is major
component of CLR which is responsible for converting MSIL (microsoft intermediate
language) to native code.
● Native code is
basically is a binary code which is understood by windows
operating system.
Q25. what is CLS ?
● CLS stands for
common language specification.
● It is a set of
rules followed by a programming language which allow them to use dotnet
framework class library or base class library or class library.
Q26.what is CTS ?
● CTS stands for
common type system.
● These are
standard data types defined for all the programming language
supported by dotnet framework It is subset of CLS.
Q27.What is GC ?
● GC stands for
garbage collection.
● It is the
program or part of a program called thread that runs in background of the
application to free the memory occupied by the unused objects.
● It is also a
major component of CLR.
Chapter 3: C#.Net
Q28. What is object?
● Any real time
entity is called as an object.
● Every object
consist of state (look and feel) and behavior (what is does).
● States are
called as fields and behaviors are called as methods.
Q29. What is a class ?
● Class is a
blueprint of an object.
● It consist of
fields which are not allowed to access from outside the class.
● It also consist of methods which are allowed to access from
outside the class.
Q: What are constant?
Q: What are constant?
Constants
in C# are immutable values which are known at compile time and do not change for the life
of the program. Constants are declared using the const keyword. Constants must
be initialized as they are declared. You cannot assign a value to a constant
after it is declared.
Q30. What are access modifiers ?
● Access
modifiers are the modifiers given to fields or methods to implement access restrictions.
● If a member of
a class (fields or methods) is declared as public it can be accessed from
outside of the class.
● If a member of
a class(fields or methods) is declared as private it can not be
accessed from outside the class.
Q31. What is the difference between value type and
reference type ?
● Value type are
the data type variables for which the memory is allocated at
compile time.
● This concept
is also called as early binding or static binding.
● Reference type
are the data type variable for which the memory is allocated atruntime.
● This concept
is also called as late binding or dynamic binding
·
Value types are stored on the stack where as reference
types are stored on the managed heap.
Q: What is GAC
·
The Global Assembly Cache (GAC) is a folder in Windows directory
to store the .NET assemblies that are specifically designated to be shared by
all applications executed on a system.
Q: What are assemblies? Describe the types of assemblies.
Assembly is a compiled output of program which are used for easy deployment
of an application. They are executables in the form of exe or dll. It also is a
collection of resources that were used while building the application and is
responsible for all the logical functioning.
Types of assemblies:
a. Private Assemblies: are accessible by a single application. They reside
within the application folder and are unique by name. They can be directly
used by copying and pasting them to the bin folder.
b. Shared Assemblies: are shared between multiple applications to ensure
reusability. They are placed in GAC.
C.Satellite Assemblies: are the assemblies to provide the support for
multiple languages based on different cultures. These are kept in
different modules based on the different categories available.
Q32. What is constructor?
● Constructor is
a special method which has same name as class name.
● It does not
have return type, but can have parameters.
● It should be
public; in some situations it can be private.
● Default
Constructor of a class is without any parameters.
● Constructor is
invoked automatically when we create an object.
● You cannot
invoke constructor explicitly.
Q34. What is the use of constructor?
● Constructor is
used to initialize the object.
Q35: What is constructor overloading?
● If we have
more than one constructor in a class with different parameters then we called
it as constructor overloading.
Q: What is Copy constructor.
A constructor that contains a parameter of same class type
is called as copy constructor. In simple words a copy constructor means a
constructor which copies data of one object into another object
Q: What is Private constructor.
Private constructor a constructor with "private"
access modifier in a class.
A class with private constructor cannot be inherited.
We cannot create an object of the class which has private constructor.
A long with private constructor we can also have public constructor (overloaded constructor).
To access the methods or properties in a class with private constructor we need to assign methods or properties with "static" keyword.
A class with private constructor cannot be inherited.
We cannot create an object of the class which has private constructor.
A long with private constructor we can also have public constructor (overloaded constructor).
To access the methods or properties in a class with private constructor we need to assign methods or properties with "static" keyword.
Q36: What is Method overloading?
● If in a class
there is more than one method, with the same name but different
parameters then we call this as method overloading.
Q37. What is compile time or static polymorphism?
● In method
Overloading the code for the method is generated at compile time
itself. Hence it is called as static polymorphism.
Q38. What is this keyword?
● this keyword
is a default object of current class.
● In what ever
class we use “this” keyword it acts like its object
Q39. What is the use of this keyword?
● ‘this’ keyword
has two uses.
● ‘this’ keyword
is used to refer the members of same class.
● It is also used to invoke a constructor from another constructor
of the same class.
Q40. What is static variable?
● Static
variable is a variable which is declared by static keyword.
● Static
variable is global for all the objects of that class in which it is declared.
● Memory for
static variable is allocated at compile time and it is allocated only
once.
● All the o bjects
of that class can access that variable or same memory location.
● Static
variable cannot be access with the object we can access static variable
directly with the class name.
Q41. What is static constructor?
● Static
constructor is a constructor which is declared with the keyword as static.
● Static
constructor is use to initialize static variables (private).
● Static
constructor does not have any access modifiers (i.e,Public,Private).
● Static
constructor is parameter less.
● There can be
one and only one static constructor in a class.
● Static
Constructor is invoked before creation of any object.
Q42. What is static method?
● Static method
is a method which is declared with the keyword static.
● There can be n
number of static methods in a class.
● Static methods
can access only static variables.
● Static method
can access by Class name.
Q43. What is static class?
● Static class
is a class which is declared with static keyword.
● Static class
should contain only static methods.
● Static class
does not allow creation of class reference or object
Q44. What is a property?
● Properties are
special kind of methods to access any field in a secured way.
● It contains
two kind of methods i.e., getter and setter
● Getter method
is to read the value of the private field
● Setter method
is to write the value of the private field
● It looks like
we are accessing the fields directly. But, internally it works as
methods where we can perform some kind of validations
Q45. What is Namespace?
● Namespaces are
logical group of classes and namespaces.
● It is used for
avoiding name clashes between two sets of code.
Q46. What is inheritance?
● Deriving a new
class from an existing class is called Inheritance
● The class from
which other classes derive fundamental functionality is called a
● base class.
● The class
which derives functionality from a base class is called a derived class.
Q47. What is single inheritance?
● If a derived
class has a single base class then it is called as single inheritance
● i.e., A(Base) → B (Derived)
Q48. What is multi level inheritance?
● If a class is
derived from a class which is already a derived class then it is calledas multi
level inheritance.
● i.e., A(Base) → B (Derived) → C(Derived)
Q49. What is multiple inheritance?
● If a class is
derived from more than one class then it is called as which is as multiple
inheritance.
● i.e., A(Base) → B (Derived) → C(Derived)
● C# does not
support multiple inheritance using classes.
Q50. What is base keyword?
● base keyword
is a default object of its base class.
● In what ever
class we use “base” keyword it acts like an object of its base class.
Q51: What is the use of base Keyword?
● base keyword
has two uses
● base keyword
is used to invoke a constructor of base class from the constructor of derived
class. It is also called as constructor chaining.
● It is also
used to refer the members of base class from derived class.
* If a base class does not offer a
default constructor, the derived class must make an explicit call to a base
constructor by using base keyword.
Q: Constructor Chaining
Constructor Chaining is an approach where a constructor
calls another constructor in the same or base class.
Q52: What is method overriding?
● If a method in the derived class has the same signature
as that of in the base class with different implementation then we say that
method in the derived class overrides the method of base class. This process is
called as Method Overriding.
● The method of the base class should be declared as
virtual and method in derived class should be declared as override.
Q53: What is a virtual method?
● A virtual method is the method which is declared with
the keyword virtual and it can be overridden by the derived class method by
using override keyword.
● Its unto the derived class weather to override it or
not.
Q54: What is a sealed method?
● A sealed method is a method which is declared with the
keyword sealed and it
can not be overridden by the derived class.
● But we can invoke this method.
● Sealed keyword is always used in combination with
override keyword.
Q55: What is a sealed class?
● A sealed class is the class which is declared with the
keyword sealed and it cannot be derived by other classes.But we can create the
objects of sealed class.
Q56: What is method hiding?
● If a method in the derived class has the same signature
as that of in the base
class with different implementation then we say that
method in the derived class hides the method of base class. This process is
called as Method Hiding.
● The method of the base class should be not be declared
as virtual and method inderived class should be declared as new.
● We cannot implement runtime polymorphism using method
Hiding.
Q57: What is abstract method?
● An abstract method is a method which is declared with
the keyword abstract.
● It does not have body. Abstract methods are methods that
only the declaration of the method and no implementation.
● It should be implemented by the derived class.
● If a method is abstract then the class should be
abstract.
Q58: What is abstract class?
An abstract class is an incomplete class and must be
implemented in a derived class.
● It is the blue print of the problem.
● It says what to do but not how to do.
● An abstract class is the class which is declared with
the keyword abstract.
● Basically it contains at least one abstract method.
● It’s object cannot be created.
● But it’s reference can be created.
● It is used to implement runtime polymorphism.
Q59: What is runtime or dynamic polymorphism?
● Deriving the abstract class by one or more classes and
overriding all the abstract methods.
● Creating the reference of abstract class and making it
an object of derived class based on user’s input.
● And calling the method of abstract class.
● The method’s code gets generated from derived class at
runtime based on user’sinput.
● This complete process is called as runtime
polymorphisms.
Q60: What is interface?
● An interface is a pure abstract class.
● It is a reference type and it contains only abstract
members.
● Interface's members can be
○ Events,Methods,
Properties, Indexers.
● Any implementation must be placed in class that
implements them.
● The interface can't contain
○ Constants, Data
fields, Constructors, Destructors,Static members.
● All the member declarations inside interface are
implicitly public and abstract.
● We can implement multiple inheritance using interfaces.
Q61: What is a namespace?
● Namespaces are logical segregation of classes and
namespaces.
● Namespaces allows you to organize your classes.
● They also provide assistance in avoiding name clashes
between two sets of code.
Q: coupling" and "cohesion
Basically "coupling" and "cohesion"
are part of maintenance.
"coupling" means to make intralinking between different components within a system. The highly coupled system is considered as not good because it is hard to make changes in a system which is strongly coupled.
Where as "cohesion" means to have intra linking between sub components or modules within a component. How strong is the bonding or linkages between sub modules or sub components of a large component. Are they working indepedently or are working as single unit.
Cohesion should be high, because if cohesion will be weak, then the changes in the software system will be difficult.
Coupling in a software system must be low because when you need to make any changes in a component, it will not effect other component and maintaince will be possible.
Pls note that in SDLC, software spends most of the time in maintaince phase, as the software enters the operation, after delivery and acceptance, you need to keep its maintaince in view and this is only possible if coupling is low and cohesion is high.
"coupling" means to make intralinking between different components within a system. The highly coupled system is considered as not good because it is hard to make changes in a system which is strongly coupled.
Where as "cohesion" means to have intra linking between sub components or modules within a component. How strong is the bonding or linkages between sub modules or sub components of a large component. Are they working indepedently or are working as single unit.
Cohesion should be high, because if cohesion will be weak, then the changes in the software system will be difficult.
Coupling in a software system must be low because when you need to make any changes in a component, it will not effect other component and maintaince will be possible.
Pls note that in SDLC, software spends most of the time in maintaince phase, as the software enters the operation, after delivery and acceptance, you need to keep its maintaince in view and this is only possible if coupling is low and cohesion is high.
Q62: What is a partial class?
● Partial class is a class which is declared with partial
keyword.
● Its implementation can be spread over multiple files
i.e., multiple classes prefixed with partial keyword with same name and
different methods in different files, acts as a single class with all the
methods.
Q63: What is a collections?
● To store multiple fixed number of
elements or objects we use arrays.
● Collection is an alternate way of storing multiple variable
number of elements or objects.
● Like Stack, Queue, List , etc., are collection classes
present in System.Collection namespace
● There is no type safety in collection classes i.e., in a
collection object of a Queue we can store few integers and few strings.
● We need to type cast the elements while accessing it.
Q64: What is generic collection class?
● Generic collection is an alternate way of storing
multiple variable number of
elements or objects.
● Like Stack, Queue, List , etc., are generic collection
classes present in
System.Collection.Generic namespace
● There is type safety in generic collection classes i.e.,
in a generic collection object of a Queue we cannot store few integers and few
strings. Hence it is strongly typed.
● We need not to type cast the elements while accessing
it.
Q65: What is exception and how do we handle it?
● Runtime error is called as an exception.
● Exception handling is an in built mechanism in .NET
framework to detect and
handle runtime errors.
● C# provides three keywords try, catch and finally to do
exception handling.
● The try encloses the statements that might throw an
exception.
● The catch handles an exception if one exists.
● The finally can be used for doing any clean up process.
Q66: What is delegate?
● A reference to a method is called as delegate.
A delegate is a type safe function
pointer. Using delegates you can pass methods as parameters. To pass a method
as a parameter, to a delegate, the signature of the method must match the
signature of the delegate. This is why, delegates are called type safe function
pointers.
Q67: What is event?
● Any action performed is called as event.
● Events are handled with the help of delegates.
Chapter 4: ASP.Net
Q68: What is Asp.Net page lifecycle?
● When we request an ASP.NET page, the page goes through a
life cycle in which it performs a series of processing steps.
○ Page
request → Checks whether
a cached version of the page can be sent
in response without running the page.
○ Start
→ Sets the page
properties such as Request, Response, IsPostBack
And UI Culture.
○ Initialization
→ Each control's
UniqueID property is set. A master page
and themes are also applied to the page if applicable.
○ Load
→ During load,
if the current request is a postback, control properties
are loaded with information recovered from viewstate and
control state.
○ Postback
event handling → If the request
is a postback, control event
handlers are called.
○ Rendering→ Before rendering, view state is saved
for the page and all
controls. During the rendering stage, the page calls the
Render method for
each control.
○ Unload
→ The Unload
event is raised after the page has been fully
rendered and page properties such as Response and Request
are unloaded
and cleanup is performed.
● We have various events that a page undergoes during the
above processing steps
likePreInit, Init, InitComplete, PreLoad, Load, etc.,
Q69: What is IsPostBack property?
● It is a property which tells us whether the page is
being loaded for the first time or is being loaded in due to a postback.
● i.e.,if IsPostBack is false then it is being loaded for
the first time else it is being loaded due to a postback
Q70: What is server control?
● Any control with runat attribute set
to “server” is a server control.
● Basically it is the job of asp.net web server to convert
server control into its
equivalent html control.
Q71: What is a validation control?
● Any control which is used to validate the fields of the
form is called as a validation control.
● i.e., RequiredFieldValidator, RangeValidater, etc.,
Q72: What is the validation control used to
validate date?
● Compare Validator by setting type property to “Date”.
● We can also achieve this at client side by setting the
TextMode of a textbox to
“Date” which is an HTML5 feature.
Q73: What is authentication?
● Checking the genuinity of a user is called as
authentication.
● Like asking username and password
Q74: What is windows authentication?
● Checking the genuinity of a user using the login
credentials of windows OS is
called as windows authentication.
● i.e., there will no separate window for username and
password.
● By default our web apps are set to windows
authentication.
Q75: What is forms authentication?
● Checking the genuinity of a user using separate login
credentials is called as
forms authentication.
● i.e., there will be a separate form for username and
password.
● We can set forms authentication by setting the mode
attribute of Authentication
tag in web.config
● i.e.,<system.web><authentication
mode="Forms" /></system.web>
Q76: What is authorization?
● Giving access rights to a user after authentication is
called Authorization.
● It is basically achieved with the help of roles.
Q77: What is gridview and can we perform insert
operation in a gridview?
● It is visual representation of a table on web page where
each column represents a
field and each row represents a record.
● The GridView control enables you to select, sort, delete
and edit these items.
● It does not provide Insert operation.
Q78: What is the process or the event used to
display sum of a column in a
grid footer?
● We can perform the sum while gridview is loading by
writing the code in
RowDataBound event.
● GridView.RowDataBoundevent occurs when every row is bound to gridview.
Q79: What is the process of adding dropdown list
in a gridview column?
● Gridview allows us to add template columns and we can
use that to add dropdownlist, textbox, radio button list or any server control
as column.
● Or we can also convert an existing column into a
template column and change itto drop down list.
Q80: What is a user control?
● Some time you may need functionality in a control that
is not provided by the
built-in ASP.NET Web server controls.
● In this case you can create your own controls called as
User controls.
● User controls are combination of various Web server
controls and some code
implemented for it.
● You can then treat the user control as new control and
use on any page by
dragging and dropping it from project folder.
Q81: What is a master page?
● A single page which contains the common content of all
the pages or group of
pages.
● Like header, menu and footer is common on all the pages
and can go into masterpage.
Q82: What is state management?
● HTTP is a stateless protocol i.e., Server will not maintain
the state of the client.
● In simple terms we cannot carry any value or data from
one post back to anotherpost back on same page or different pages by default.
● To achieve this we follow some techniques called as
state management
techniques.
Q83: What is client side state management?
● To carry any value or data from one post back to another
post back on same pageor different pages we store that data on client machine
or computer.
● To achieve this we follow some techniques called as
client side state managementtechniques.
● Following are client side state management techniques
Cookies, QueryStrings
(URL), Hidden fields and View State.
Q84: What is a cookie variable?
● A cookie is a small piece of text stored on user's
computer. Usually, information isstored as name-value pairs.
● Can be used to carry the value throughout the
application.
● If you want to store information use the below code
○ Response.Cookies["UserId"].Value=username;
● If you want to retrieve information use the below code
○ string username
= Request.Cookies["UserId"].Value;
Q85: What advantages and disadvantages does a
cookie variable has?
● Advantages:
○ Simplicity
● Disadvantages:
○ Cookies can be
disabled on user browsers.
○ Cookies are
transmitted for each HTTP request/response causing overhead
on bandwidth
○ Inappropriate for sensitive data
Q86: What is query string?
● A query string is the part of a URL that contains data
to be passed from one page to another page.
● Can be used to carry the value from one page to another
page.
● They are passed along with URL in clear text which can
be encrypted.
● If you want to pass data using query string use the
below code
○ Response.Redirect(“productdetails.aspx?productid=4”)
● If you want to retrieve data from query string use the
below code
○ productid=Request.Params["productid"];
Q87: What advantages and disadvantages does a
Query string has?
● Advantages:
○ Simple to
Implement
● Disadvantages:
○ Human Readable
○ Client browser
limit on URL length
○ Easily
modified by end user
Q88: What is hidden field?
● Hidden field is just like a standard control for which
you can set its properties.
● Whenever a page is submitted to server, hidden fields
values are also posted to server along with other controls on the page.
● Can be used to carry the value on the same page between
different postbacks.
● As its name says, these fields are not visible on the
page.
Q89: What advantages and disadvantages does a
hidden field has?
● Advantages:
○ Simple to
implement for a page specific data
○ Can store
small amount of data so they take less size.
● Disadvantages:
○ Inappropriate
for sensitive data
○ Hidden field
values can be intercepted(clearly visible) when passed over a
network
Q90: What is viewstate variable?
● View State is the default feature of Asp.net server
controls.
● Can be used to carry the value or data on the same page
between different
postbacks.
● If you want to store data in ViewState use below code
○ ViewState["myviewstate"]
= myValue;
● If you want to read data from ViewState use below code
○ Response.Write(ViewState["myviewstate"]);
Q91: What advantages and disadvantages does a
viewstate variable has?
Advantages:
● Simple for page level data
● Encrypted
● Can be set at the control level
Disadvantages: –
● Overhead in encoding ViewState values
● Makes a page heavy
Q92: What is server side state management?
● To carry any value or data from one post back to another
post back on same page
or different pages we store that data on server machine or
computer.
● To achieve this we follow some techniques called as
server side state
management techniques.
● Following are server side state management techniques
Session Variables,
Application Variables.
Q93: What is session state variable?
● ASP.NET session state enables you to store and retrieve
values for a user.
● Can be used to carry the value throughout the
application.
● If you want to store data in Session State use below
code
○ Session["mydata"]
= myValue;
● If you want to read data from ViewState use below code
○ Response.Write(Session["mydata"]);
Q94: What advantages and disadvantages does a
session variable has?
● Advantages:
○ Fastest mode
○ Simple
configuration
● Disadvantages:
○ Session data
will be lost if the worker process or application domain
recycles.
Q95: What is Application state variable or
Application object?
● Application state variable is used to store data which
is visible across entire
application and shared across multiple users.
● Data which needs to be persisted for entire life of
application should be stored inapplication object.
● It's a great place to store data which does not changes
frequently.
● We should write to application variable only in
Application_Start event.
● If you want to store data in Application variable use
below code
○ Application.Lock();
○ Application["mydata"]="mydata";
○ Application.UnLock();
● If you want to read data from Application variable use
below code
○ Response.Write(Application["mydata"]);
Q96: What advantages and disadvantages does an
application variable has?
● Advantages of using application state are:
○ Simple
implementation.
○ A single copy
of the information for all users to access.
● Disadvantages of using application state are:
○ Application
state will be lost if the Web server process containing it is crash,
upgrade, or shutdown.
○ Application
state requires server memory, which can affect the performance
of the server.
Q97: What is global application class?
● It is a class which contains global events of the
application like Application_Start,Application_End, Application_Error,
Session_Start, Session_End, etc.,
● We can perform some specific tasks in those events.
● We can have one and only one global application class in
a web application.
Q98: What is web.config file?
● It is an xml file which contains the configuration settings
of the web applicationlike target framework version, connection string,
authentication type, providers,smtp settings, etc.,
● We can have multiple web.config files in a web
application i.e., one for each folderto give access rights to that folder.
● We need not compile the complete project if we want the
changes of web.configfile to reflect in the application.
Chapter 5: ADO.Net
Q99: What is Ado.Net?
● Ado stands for Active Data Objects.
● It is a data access component for .Net application.
● i.e., It contains a set of class that can be used to
access data from the databaselike SqlConnection, SqlCommand, etc.,
Q100: What is connection string?
● A connection string is a string used to connect to the
database.
● The major parts of connection string are
○ Data Source
(i.e.,Sql Server Name)
○ Initial
Catalog (i.e.,Database Name)
○ Security
■ Integrated
(Uses windows authentication)
■ Sql Server
(Separate User ID and Password)
Q101: What is ADO.Net data provider?
● The ADO.NET Data Provider model provides an interface in
the .NET Framework for accessing data from various data bases.
○ For SQL Server
provider is System.Data.SqlClient (Inbuilt)
○ For Oracle
provider is System.Data.OracleClient (Third Party)
○ For MySql
provider is System.Data.MySqlClient (Third Party) , etc.,
Q102: What is connected architectural data access?
● The architecture in which as long as we perform the
operations on the database we keep the connection open and once operations are
done then the connection is close. Such architecture is called as connected
architecture.
● SqlDataReader works on connected architecture.
Q103: What is SqlDataReader?
● SqlDataReader is a class which works on connected
architecture.
● It is used to read the data from database after
executing the command.
● It reads one row after the other in the form of stream
of bytes (0s and 1s)
● It is read only (You cannot edit the record which is in
datareader)
● It is forward only (You cannot read the data once it is
used)
Q104: What is disconnected architectural data
access?
● The architecture in which we open the connection
initially then load the data in an object(Dataset) and close the connection.
(Achieved with the help of
SqlDataAdapter).
● Now we can perform the CRUD operations on the object
which is not connected to database.
● Finally we update the object to the database after
performing
operations.(Achieved with the help of SqlDataAdapter)
● Such architecture is called as disconnected
architecture.
● Dataset works on connected architecture.
Q105: What is DataSet?
● Dataset is collection on datatables and xml files.
● Tables and xml files in dataset are stored in the form
of an array.
● We can perform insert, update, Delete and select
operations on dataset.
● Dataset works on disconnected architecture.
Q106: What is SqlDataAdapter?
● SqlDataAdapter is a class which is responsible for
opening the connection and
loading the data in an object(Dataset) and close the
connection (i.e.,Filling the
dataset).
● It is also responsible for updating the dataset to the
database after performing operations.
● SqlDataAdapter falls under connected architecture and
used for implementation disconnected architecture.
Q107: What is untypedDataSet?
● When dataset is filled with datatable only data and
table structured is copied but constraints are not applied on it. i.e., unique
key, primary key, foreign key, etc.,
● If you want you can create the constraints manually.
● Such a dataset is called as untyped dataset.
Q108: What is typed DataSet?
● A dataset which has all the constraints(i.e., unique
key, primary key, foreign key,etc.,) defined on it with the help of xml file
i.e., xsd (xml schema definition) iscalled as typed dataset.
● In other words a dataset with xsd file is called as typed
dataset.
Q109: What is transaction and how do we implement
transaction in Ado.net?
● Transaction is
a set of operation(SQL Queries) which must be executed as a
group.
● If at all a
single operation is failed then all the previous operation of that groupmust be
rolled back i.e.,undone.
● We can
implement transactions in ado.net using SqlTransaction class by calling BeginTransaction
on the SqlConnection object.
● Committing or
aborting the transactions are performed on the SqlTransaction
object.
Comments
Post a Comment