Sei sulla pagina 1di 51

INTERVIEW QUESTION

Personal Interview –
Q1. Tell me about yourself?
Ans.:
Well, it’s my pleasure to introduce myself. My name is Prashant
Ramshakal Vishwakarma.
I am 26, single, staying in Andheri-E.
Talking about my family, I belong to a lower middle class
family. My father is a carpenter, my mother is a house maker.I have two
younger brother and I am the elder one.
Coming towards my education, I graduated in Computer
Science from Nirmala Memorial Foundation College. I have done a
Course in Asp.net and MVC from Aptech Institute.
I am fresher in IT industry. Though I made few project like
Rupaiya Bazaar a Finance Website, using Asp.net, HTML, CSS,
JAVASCRIPT, and also made a simple wep page name kirti classes using
HTML, CSS and JAVASCRIPT.
My strength are I am Hardworking, Innovative, belive in Smart
Work, and I have the ability to work in Team.
Finally I would like to thank you for giving me an opportunity. I
want to be a part of your organisation, I want to learn
And Grow new skills while working with you.
Thank You!!

Q2. Why you left Indiabulls?


Ans.:
Well, I am thank full to my previous organisation who provided
me such an opportunity.
While working there I improved my communication skill, Time
Management skill, working under pressure, coordinating with your
team, management and clients.
INTERVIEW QUESTION

But, in Those days I had some financial issues. Since my father


was carpenter. So his income was not enough to fulfil our needs and
expenses. I took the responsibility of my education and home expense
as well. I started doing job. But now things are pretty stable.

And I always had a good knowledge in programming languages.


So I decided to do a course in Aptech to improve it even more. And now
it is a good time& opportunity to comeback in IT Industry.

Dictionary –

Entity: a thing with distinct and independent existence.

Try to Answer Interview Question in these order –


INTERVIEW QUESTION

C#
Interview Question asked in HR mantra Company.
Q1. RELATION OF CLASS AND OBJECT?
ANS.:
i. Class - Wrapping up of data and function into a single unit is
called as Class. Class provides protection to its member from
outside world. A Class is a Blueprint of an object.
E.g. – If I say a car, you make a picture of car in your mind, you
make a blueprint of a car. An actual car is an object. You can make
as many car you want using the blueprint of the car. Class is a
logical entity.
[p-]
ii. Object – Object is a physical entity. We can see and interact with
an object. Speed, Brakes, Car Name is an object.
Attributes and behaviour of object are defined by class.

Q2.WHAT IS OOPS?
ANS.: [scis]

OOPS stands for object oriented programming. It is a


concept that is inspired by the real world entities. Basically, it simplifies
software development and maintenance.
[cof]

OOPS Concept is based on class and object and its four


pillars encapsulation, abstraction, inheritance and polymorphism.
[wpbl]

iii. Class - Wrapping up of data and function into a single unit is


called as Class. Class provides protection to its member from
outside world. A Class is a Blueprint of an object.
E.g. – If I say a car, you make a picture of car in your mind, you
make a blueprint of a car. An actual car is an object. You can make
as many car you want using the blueprint of the car. Class is a
logical entity.
[p-]
INTERVIEW QUESTION

iv. Object – Object is a physical entity. We can see and interact with
an object. Speed, Brakes, Car Name is an object.Attributes and
behaviour of object are defined by class.
The four pillar of OOPS is Encapsulation, Abstraction, Inheritance,
Polymorphism.
[wdmpo]

v. Encapsulation – Wrapping up of data and function into a single


unit called as Encapsulation. Class provide encapsulation. All
member of class are by default private. Encapsulation provide
protection to its member from outside world. Take a real world
E.g. a bag stores items like book, pen, pencil, perfumes…etc. A bag
is a class, items are its member.
vi. Abstraction -
Abstraction hides implementation details from user and
show only functionalities. A real world e.g. is a software
application where we can see UI, but we cannot see its internal
process. Abstraction simplifies complexity.
E.g. RGB color, you can combine three color to make different
color.
[rna-bsu]
vii. Inheritance –
Inheritance allows reusability of class and object.
Inheritance enables a new object to acquire properties of old
object. E.g. Father& Son relation. Son acquire a property of Father.
Here, father is a base class and Son is sub class.
Amitabh bachan is an actor so his son abhisek bachan is also an
actor.
Raj Kapoor belongs to Bollywood, so him fellow family members
also belongs to Bollywood. Some family member are actor some
are directors.
viii. Polymorphism –
Polymorphism means one to many form. E.g. A
calculator that can perform addition, subtraction,
multiplication…and so on.
Or responsibilities of men like husband, do a job, nuture kids.
Protect his family. Or chameleon.
INTERVIEW QUESTION

Q2. Override?
Ans.:
Override provide new implementation to a base method in sub class.
Override is used in sub class.
See this below code -
Class AreaCalculator //base class
{
Public virtual void area(); //contains base method
}
Class Shape: AreaCalculator //another class name shapes that inherits base class calculator
{
Public override area(); //area base method calculate areas of shapes
{
//rectangle;
}
Public override area();
{
//circle;
}
Public override area();
{
//triangle;
}
}
Take e.g. of program contains a base class name AreaCalculator that
contains base method area(). Another class Shape is a sub class(derived
class).
To reuse base method in derived class we use override method. Override
provide new implementation to base method.
E.g. public override area()
Using override we can create many copies of same area() method. One to
find area of shape rectangle, another for circle, square, triangle...so on.
Override add polymorphism and abstraction to your application. Basically, it is extend functionality of
your application.
Always remember, base method is always created using abstract and virtual keyword.
INTERVIEW QUESTION

Q3. What is new keyword?


Ans.:
It hides base method to eliminate warning message.

 Base Class A has a


base method Y, while Sub
class B has a public
method Y. Sub class use
new keyword to hide the
base method Y.

 And it replace an old implementation (functionality) of a method


new one.
 Basically, It implement polymorphism to your code.

Q4. Sealed Class in C#?


Ans.:
Sealed class are used to restrict a class to use inheritance feature of
oops.
Q5. Properties –
Ans.:
 Definition: Properties are member (get& set) that reads and write
values
To& from private fields.
 Get = ReadOnly & Set = WriteOnly
 Set catch a value from user and assign that value to the fields and
Get return a value or you can say throws a value or say display that
value.
INTERVIEW QUESTION

ASP.NET
Q1. Difference between Response.Redirect and
Server.Transfer?
Sr. Response.Redirect Server.Transfer
no.
Response.Redirect is used to redirect Server.Transfer is used to redirect
1 user from one page to other page on user from one page to other page
same server as well as different only on same server.
server.
2 Redirection done on browser. Redirection done on server.
The url changes is reflected in url box. The url does not changes, so the url
3 changes is not reflected in url box.

4 Response.Redirect is slower as it has In Server.Transfer, is faster as it has


multiple request and response cycle. one request and response cycle.
It is less efficient. It is more efficient.
5 Response.Redirect do not preserve Server.Transfer preserve values of
values of One webpage (webform1) to One webpage (webform1) to Second
Second Webpage (webform2). Webpage (webform2).

Q2. What is SERVER EXECUTE?


Ans.:
i. Server Execute and Server Transfer both are similar.
ii. But the only difference is, that the server, transfer terminates the
execution of current page, and its brings user to a new page. Whereas
Server.Execute process the web form and display the result on the
same page.
iii. In server.Transfer user is redirected from one page to another page.
But in server.Execute user is not redirect to another page, however
the result is displayed on same page.

Q3. WHAT IS ViewState?


Ans.:
View State is the variable to hold the Value of the Page and Controls
within the page.
INTERVIEW QUESTION

Q4. What is Session Page?


Ans.:
Session Page is the variable to hold the Value of the Page and Controls
through the page on same server as well as different server.
Q5. What is Application State?
Ans.:
Application State is the holds the values of different application on same
browser.
E.g. Gmail – In one browser you can open one Gmail account.
Q6. What are the different validators in ASP.NET?
Ans.:
There are six validator is asp.net:
R3C2V
i. RequiredFieldValidator.
E.g. If you do not enter value in Textbox, or if you do no select an option in
radio button then it will gives an error.
ii. RangeValidator.
E.g. You had to enter age between 18 to 60, otherwise it will give error.
iii. RegularExpressionValidator.
E.g. Enter an email id or Mobile No
iv. CompareValidator.
E.g. Use in login system like New Password and Confirm Password
v. CustomValidator.
vi. ValidationSummary.
List the error. If(IsValid) is false

Q8. Page Life Cycle?


Ans.:
i. preinit –
ii. init –
iii. initComplete –

iv. OnPreLoad –
v. Load –
vi. Control PostBackEvent(s) -
vii. LoadComplete –
INTERVIEW QUESTION

viii. OnPreRender
ix. OnSaveStateComplete –
x. RenderMethod –
xi. UnLoad -

MVC
Q1. MVC Life Cycle?
Ans.:
Routing Examples –

1 Enter Url -
User enters a URL in format of ControllerName/ActionName
2 In UrlRouting Module –
A. Global.asax -
a) In Global.asax file RegisterRoute takes the request.
b) RegisterRoute is a collection of Route
c) RegisterRoute invokes RouteConfig
INTERVIEW QUESTION

C. RouteConfig –
a) RouteConfig Contains a method called as
MapRoute.
b) MapRoute contains all the routes.
D. Compare –
a) If User URL pattern matches with Url in
RouteTable.
3. Controller -
A. If match found, controller executes ControllerActionInvoker.
4. ControllerActionInvoker –
A. The ControllerActoinInvoker has a list of ActionResult and
ActionSelector is applied on each ActionResult.
B. ActionSelector property invokes a actionResult request by User.
C. Process the request and passed it to View.
5. View –
A. View renders the request on browser screen.

Q2. FILTER IN MVC?


Ans.:
i. Filter add extra processing logic in MVC life cycle.
ii. Filter add pre-processing and post-processing logic for actions and
controllers.
iii. There are four various types of filter
I. Authorization filter
II. Action filter
III. Result filter
IV. Exception filter

I. Authorization –
 Execute specific action when user authentication is
successful.
 Here we use authorize key before ActionResult.
 Authorization has two filter attribute –
INTERVIEW QUESTION

1. Users
 separate list of users with comma to access action
method.

2. Roles
 separate list of roles with comma to to access action
method.
[Authorize(Users="user1")]
public ActionResult Index()
{
return View();
}

II. ActionFilter –
 Execute specific action functionality before or after
executing an action method.
 Action filters implements the IActionFilter interface.
 Output Cache is an example of Action filters –
 OnAction Executing define functionality that execute
specific functionality before executing an action method.
 OnAction Executed define functionalities that execute
specific functionalities after executing an action.
III. ResultFilter –
 Defines functionality which executes after the action
result is returned by action method.
 ResultFilter implement IResultFilter interface.
 OnResultExecuting executes before the action result
executes.
 OnResultExecuted executes after the action result
execution.

IV. Exception filter:


 We use exception filters to handle exceptions.
 To Handle ArgumentNullException HandleError is used.
 HandleError has two attributes –
ExceptionType and View (view to render for
unhandled exception).
INTERVIEW QUESTION

Q3. Data Annotation in MVC?


Ans.:
 DataAnnotation attributes provide client and server validation.
 It is used to configure model class.
 It is with Entity Data Model, Linq to Sql or other model.

 System.ComponentModel.DataAnnotations includes the


following attributes that impacts the nullability or size of the
column.
 Key -
It adds Primary key to fields in model class and SQL.
PrimaryKey reflects in SqlServer also.
 Required -
Required annotation forced user to provide value to fields.
 MaxLength and MinLength -
MaxLength, MinLength annotation set size of column.
Length provide in ModelClass will reflect in SQL SERVER.
 StringLength -
StringLength anntation set size of column. Length
provides in ModelClass will reflect in SQL SERVER. If
user enter a value more than StringLength that an error is
thrown.

 System.ComponentModel.DataAnnotations.Schema
namespace includes the following attributes that impacts the schema
of the database.

 Table -
TableAnnotation specifies a tablename. The change is
reflected in SqlServer.You can Specify Schema. E.g.
Schema as Admin.
 Column -
ColumnAnnotation specifies a Columnname. The change
is reflected in SqlServer.
 Index -
IndexAnnotation specifies an IndexName. The change is
reflected in SqlServer.
INTERVIEW QUESTION

 ForeignKey -
ForeignKeyAnnotation specifies a ForeignKey. The change
is reflected in SqlServer.

Q4. Difference ViewBag and ViewObject?


Ans.:
ViewBag ViewObject
ViewBag is a dynamic property ViewData is an object derived from
derived from ViewDataDictionary class

ViewBag doesn’t require typecasting for1. ViewData requires typecasting for


complex data type. complex data type and check
for null values to avoid error.

IN CONTROLLER IN CONTROLLER
public ActionResult Index() public ActionResult Index()
{ {
ViewBag.Name = "Monjurul Habib"; ViewData["Name"] = "Monjurul Habib";
return View(); return View();
} }

IN VIEW IN VIEW
@ViewData["Name"]
@ViewBag.Name

Syntax Syntax
ViewBag.PropertyName = ViewData[“KeyName”] = value/Object/List;
value/Object/List;
ViewData[“Name”] = “Prashant”;
ViewBag.Name = “Prashant”;

Q5. TempData –
Ans.:
i. Like ViewData, TempData is also a Dictionary that is derived from
TempDataDictionary Class.
ii. It has short life, like session.
iii. TempData transfers data from the Controller to the View.
iv. One of the major disadvantages of both ViewData and ViewBag is
that the lifecycle is limited to one HTTP request. On redirection,
they lose the data.
v. TempData works with HTTP redirection.
INTERVIEW QUESTION

Q6. StronglyType –

Ans.:

Strongly Type provide two features –


i. Intellisense –
 Show suggestion box while write code.
 Suggest developer what to write.

ii. Compile-time error checking.


 Handle execption and error

iii. Handles Complex data.


Q8.Events in Entity Framework?
Ans.:
Create New Edit Delete
Q9. CRUD OPERATION with entity framework?

JAVASCRIPT
Q1. Transfer data from Asp.net Control to JavaScript?

SQL
Q1. Change a column id data type from int to varchar?
Ans.:
Alter table employee
Alter column id varchar (20)

CSS
Q1. How to create shadow for text?
Ans:
h1 {
text-shadow: 2px 2px #ff0000;
INTERVIEW QUESTION

Q2. @fontface Rule –


Ans.:
@font-face {
font-family: myFirstFont;
src: url (sansation_light.woff);
}

INTERVIEW QUESTION ASKED IN SWASTIK


CHEMBERS in KURLA
C/C++
Q1. What is difference between C and C++?

C#
Q1. OOPS?
Q2. CODE:
public class Company
{
public void employee()
{
….
}
}
public class branch: company
{
public void employee()
{
….
}
}
psvm(….)
{
Company comp = new Comp();
Comp.employee();
}
Which method will be called? The Superclass one or Its Sub Class?
INTERVIEW QUESTION

Q3. Does C# support multiple inheritance?


Ans.:
i. C++ Support Multiple and Multilevel Inheritance. But C# support
multilevel Inheritance.
ii. But Interface is a better alternative for Multiple Inheritance. See
e.g. below -
iii. Take an E.g. –
class A
{
m1();
}

class B
{
m2();
}

class C : A, B
{
m1();
m2();
}

It is not possible to create multiple Inheritance.


ii. Better alternative is to use Interface.
class A
{
m1();
}

interface IB
{
m2();
}

class B : IB
{
m2();
}

class C : A, IB
{
B BObject;
m1();
m2()
{
BObject.m2();
}
}

Q5. What is Inheritance?


Ans.:
INTERVIEW QUESTION

Inheritance is the process of inheriting properties of objects of one


class by objects of another class.
Q4. What is Multiple and Multilevel?
Ans.:
 What is multiple inheritance?
 Defination:
Multiple inheritance in which a child class
can inherit multiple parent class.
 E.g. –
Class father { //super class 1
}
Class mother { //super class 2
}
Class Child: Mother, Father //Subclass
{
//Access Members Superclass 1 and Superclass2
}

 What is multilevel inheritance?


 Multilevel Inheritance -
Multilevel Inheritance in which a class is
itself derived from another class in multilevel
inheritance.
 E.g. –
Class father { //super class 1
}
Class mother: father { //super class 2
}
Class Child: mother //Subclass
{
//Access Members Superclass 2 through
Superclass1
}
Q5. What is Interface?
Ans.:
 Interface provide 100% abstraction or complete
Abstraction.
INTERVIEW QUESTION

Complete Abstraction means that it only contains


Abstract method in its Body.
 Interface class is a super class. You can inherit
Interface to another class.
 C# does not support multiple inheritance and
multilevel inheritance is not supported by C#. Interface
in better alternative for using Inheritance.
 But, it is always compulsory to implement each method
of interface into its Subclass.
 You cannot define concrete method i.e. if you create a
method with implementation then error will occur.
E.g. – Men take responsibility of Women after
marriage using interface.
interface women
{
void beauty();
void kids();
void shopping();
}
public class men:women
{
void beauty();
void kids();
void shopping();

}
psvm(…)
{
men responsibility = new men();
men.beauty();
men.kid();
men.shopping();
}

Q6. What is Abstract class?


Ans.:
i. Abstraction is a process of hiding the implementation and
functionalities from user.
ii. Abstract class is Super Class.
INTERVIEW QUESTION

iii. Abstract class provide 50% abstraction. Interface provide 100%


abstraction.
So you can create Concrete and Abstract method both in your class.
iv. We can inherits Abstract Class in another class. We can use
method defined in Abstract class using override method.
v. Abstract method do not contains implementations.
vi. Advantage –
 Reduce complexity.
 Provide Security
Q9. What are Array?
Ans.:
i. We knew that a single variable can store a single value. What if we
have hundred, thousand of values to store? In this case we need to
create hundreds and thousands of variable. But C# has better
alternative to store these large nos. of data, by using Arrays.
ii. Array is an Object. It allocates memory on heap. It’s a reference
type that stores memory address of actual data.
iii. It stores data of same data type.
iv. Syntax
int[] myarr = new int[];
 We use new keyword, new keyword allocates space in
memory.
 E.g. – int[] myarray = new int{10,20,30,40}  DATA
ARRAY POSITION  0, 1, 2, 3  INDEX
Index Data
0 10
1 20
2 30
3 40

v. Array store values in two ways –


 Fixed length array
 int[] myfixarray = new int[5];
 Here length of array is 5
 Dynamic Length array
 int[] dynarray ;
 dynamic arrays size increases
automatically
INTERVIEW QUESTION

 Object Array –
 Object array allows you to store
values of different data type.
vi. THREE TYPES OF ARRAY –
a. SINGLE DIMENSIONAL ARRAY
 These are simplest forms of array.
 They contains one row to store array.
 It use Single bracket.
 E.g.
string[] Books = new string[5];
Books[0] = "C#";
Books[1] = "JAVA";
Books[2] = "VB";
Books[3] = "C++";
Books[4] = "C";

STORE DATA IN A ROWS -

b. MULTIDIMENSIONAL ARRAY –
 They store data in tabular format that
containing rows and columns.
 It use Single bracket but with
multiple values that shows multi-
dimensional array.
 It can be 2D, 3D, 4D …etc.
 E.g. –
 Two Dimensional Array -
string [,] names;

 Three Dimensional Array -


int [ , , ] m;

c. JAGGED ARRAY
 Jagged array is an arrays of array.
 It use multiple brackets.
INTERVIEW QUESTION

 We knew that an array variable store


multiple values, But jagged array
store array itself.
 Take a real world example of Movie
Ticket Counter as jagged array.
We knew nos. of Movie Ticket Counter, but we do not knew the
nos. of people standing on queue.
 Let us Suppose

 Store values of MovieCounter -


string[][] MovieCounter = new string[4][]{
new string[]{"Rocky", "Sam", "Alex"},
new string[]{"Peter", "Sonia", "Prety", "Ronnie", "Dino"},
new string[]{"Yomi", "John", "Sandra", "Alex", "Tim", "Shaun"
},
new string[]{"Teena", "Mathew", "Arnold", "Stallone", "Goddy"
, "Samson", "Linda"},
};

Q10. Collection in C#?


Ans.:
i. Collection is introduced first in Microsoft.
ii. It is similar to array.
iii. It allows us to store group of Object.
iv. There are two types of Collection
a. Non-Generic-
INTERVIEW QUESTION

b. Generic-
 Different types of collections in Generic and Non-
Generic:-
Sr. no. Non-Generic Generic
1 Array List List
2 Hash Table Dictionary
3 Sorted List Sorted List
4 Stack Stack
5 Queue Queue
1 Array List –
 ArrayList is a class. We create object for ArrayList
class.
 We use Add() method to store values in ArrayList
Object
E.g. -
ArrayList list = new ArrayList();
list.Add("One");
list.Add("Two");
list.Add("Three");
 Array List can stores any nos of Elements
INTERVIEW QUESTION

ASP.NET
Q1. WHAT IS ISPOSTBACK?
Ans.
 It is a page level property.
 It is a mechanism that enables a roundtrip of the page
between client and a server in request-response model.
 It determines whether page is loaded in response to
client postback, or its is being loaded for first time.
 It is a Boolean property.
o IsPostBack will be false –
 If page loaded at beginning, value of
IsPostBack will be false. And Compiler will
not execute the Postback.
o IsPostBack will be true –
 If page is reloaded then IsPostBack
property is set to be true. Code inside
postback block will run.
Q2. What are ViewState?
Ans.:
 View State is the method to preserve the Value of the controls.
Q3. What are the different validators in ASP.NET?
Ans.:
i. RequiredFieldValidator:
E.g. If you do not enter value in Textbox, or if you do no select an option
in radio button then it will gives an error.
ii. RangeValidator:
E.g. You had to enter age between 18 to 60, otherwise it will give error.
iii. CompareValidator:
E.g. Use in login system like New Password and Confirm Password
iv. RegularExpressionValidator:
E.g. Enter an email id or Mobile No
v. CustomValidator:
vi. ValidationSummary:
List the error. If(IsValid) is false
INTERVIEW QUESTION

Q4. QueryString?
Ans.:
i. It is a Common way to send data through one webform to another.
ii. Query String are appended to the page URL.
iii. ? (Question Mark) indicates beginning of query string,
& (Ampersand) indicates appended string values to the URL.
iv. There are similarities between Query String and Get
functionalities.
v. QueryString are similar to name/value collection pairs.
vi. Similarities between Query String and Get.
o Like Get QueryString can send limited amount of data.
o GET and Query String both are not secure as it display all the
form control values in url box. Both of them are not secure,
for sending confidential data like Credit card nos., password.
vii. E.g.
Webpage Design

CODE BEHIND -
protected void Page_Load(object sender, EventArgs e)
{
nameLabel.Text = Request.QueryString["Name"];
emailLabel.Text = Request.QueryString["Email"];
}

protected void SendButton_Click(object sender, EventArgs e)


{
Response.Redirect("~/webform2.aspx?Name="+NameTextBox.Text+
"&Email="+EmailTextBox.Text);
}

O/p –
INTERVIEW QUESTION

Q5. PAGE LIFE CYCLE OF ASP.NET? In Short


Ans.:
Steps involved in Page Life Cycle –
SHORT HAND-
R SILVER
PSIL PRU U
Page Client request a page on bro wser.
Request

Set Response and Request


Start

Default page and Default value


Initialization

Execute po stBac k,
Load enables viewstate

POSTBACK Control event handler are called,


EVENT IsValid property ,
HANDLING

Control event handler,


Render Render asp.net contro ls to Bro wser.

Unload all Respone and R equest


Unload

i. As we know, Client sends a request to server, Server process the


request and generates Http Response which is send back to Client.

ii. Let see all the steps involved in Life Cycle:-


I. Page Request:
 Page life cycle Begin.
 Client enter url on url_box of the browser
 Url is an http request sended to the server.
INTERVIEW QUESTION

II. Start:
 At this stage Http Response, Http Request and
IsPostBack are set.
 At this stage, PreInit Method –
o Default Themes, Default masterpage and Default
values are set.
 At these stage, postback determine if user entered the
page for first time or if page is reloaded.
o If page loaded at beginning, value of IsPostBack
will be false. And Compiler will not execute the
Postback.
o If page is reloaded then IsPostBack property is
set to be true. Code inside postback block will
run.
III. Initialization:
 Initialization Stage are divided into three method –
o Init –
 At initialize stage Asp.net Controls and page
property –
 Are initialized.
 Gets its unique id
o InitComplete –
 At initComplete stage Asp.net Controls and page
property –
o All the initialization of control and page are
raised and set.
o Initialised values are available to the code.
o ViewState are not loaded until stage is
called. ViewState is defined at this stage.
o PreLoad –
 At PreLoad stage –
 ViewState are loaded or applied to
controls.
 PostBack are loaded or applied to
webpage.
IV. Load:

 At Load Stage,
INTERVIEW QUESTION

o If page loaded at beginning, value of IsPostBack will


be false. And Compiler will not execute the
Postback.
o If page is reloaded then IsPostBack property is set to
be true. Code inside postback block will run.
o Db connection is established
o Asp.net control are loaded with information,
retrieve from its –
 ViewState property
 Default value

V. VALIDATION –
 If asp.net control requires validation, then they are
validated.
 IsValid() property validate all asp.net controls.

VI. POSTBACK EVENT HANDLING –


 Event like Click or SelectedIndexChanged are applied to
your server control.
 LoadComplete –
o Raised at EventHandling stage.
o All asp.net control are loaded to webpage.
 PreRender –
o Raised after PostBack event is called.
o PreRender event occur for each asp.net control on
the page.
o ViewState are saved for the page and controls. A
 SaveState Complete -

VII. Render -
 Render is not an event. It is a method.
 Page object call this method on each asp.net controls.
 It renders HTML page and asp.net control on browser.
It generates Output on browser screen.

VIII. Unload -
INTERVIEW QUESTION

 The Unload event is raised after the page has been fully
rendered, then it is sent to the client,
 Unload all Respone and Request.
 Cleanup routines such as db connection, open
filestream…etc.
Q6. Page Life Cycle Event of ASP.NET?
Ans.
When client send a request to a webserver. At the
server end, the page is invoked and then the page goes through
series of event, before webpage created.
PreInt, Init, InitComplete
PreLoad, Load, Control PostBack Event, LoadComplete
OnPreRender, OnSaveStateComplete, Render,
UnLoad
1 PreInt –
 At preinitialize stage,
 Theme AND master page are sets to webpage
dynamically.
 At this stage the postback property determine which
page to load if user just entered the page or page is
reloaded.
2 Init –
 At initialize stage Asp.net Controls and page property –
 Are initialized.
 Gets its unique id
3 InitComplete –
 At initComplete Stage -
 Initialization of Asp.net Controls and page
property are raised and set.
 Initialized values of asp.net Control and Page Property
are now available to the code.
 Until now viewstate are not loaded. ViewState is
defined, at this stage.
4 PreLoad –
 At PreLoad Stage,
 Viewstate is loaded (applied) to asp.controls.
INTERVIEW QUESTION

 postBack is loaded(applied) to Page Control. I.e.


Code inside PostBack section executed.
5 Load –
 At Load Stage,
 postback restore previous state of page. It
restore previous values of the pages.
 Postback determine which code to be executed
when page reloads or user enter the website for
first time.
 PostBack avoid resetting value. E.g. Postback
prevent duplicate values occur in dropdown
 IsValid() property values are Checked.
 DB Connection is established.
 We can prevent few asp.net control like dropdown from
restoring previous state of code, with the help of
postback.
6 Control PostBack Event -
 At Control PostBack Stage, events of all asp.controls
are invoked. (code inside button is invoked.)
 IsValid() validates user form and user request.

7 LoadComplete –
 Raised at event handling stage.
 Loads all the Asp.net Control on the Webpage.
 This Event signal end of LoadEvent
8 PreRender –
 PreRender Event, take place –
 after PostBack event is called.
 render on asp.net control the webpage.
 At PreRender Stage apply final change to asp.net
Control and webpage content.
 At this Stage, ViewState are Saved.
 After this Stage, Property and ViewState of asp.net
control cannot be changed.
9 SaveStateComplete -
 Before this event is called, ViewState are saved.
 In this stage, no change is possible to asp.net control
and webpage.
10 Render –
INTERVIEW QUESTION

 Render is not an event.


 Render is a method.
 At Render Stage, Asp.net calls the render method.
 It generates Output on browser screen. It renders
HTML page and asp.net control on browser.
11 Unload –
 At Unload Stage –
 All code and object are cleaned up
 Close DB Connection.
 Closed opened files.
 Exception are thrown if Response.Redirect is
called.
Q7. At which Stage of Page Life Cycle ViewState for the page is
Saved for all the ASP.Control?
Ans.: Prerender
Q8. Navigation Techniques? Describe each navigation
Techniques?
Ans.:
 Five Navigation Techniques -
i. Hyperlink Control
ii. Response.Redirect
iii. Server.Transfer
iv. Server.Execute
v. Cross-Page Posting
vi. Windows Open
 Hyperlink Control -
a) It is asp.net control available in Asp.net toolbox.
b) It allows user to navigate from one web page to
another web page on the same server as well as
different server.
c) NavigateUrl Property is used to set address of page.
d) Similar to anchor tag<a></a> in Html.
e) Hyperlink define a click event for links.

 Response.Redirect() –
a) It is a method.
b) It is some what similar to hyperlink.
INTERVIEW QUESTION

c) It allows user to navigate from one web page to


another web page on the same server as well
different server (like google and so on).
d) But, Response.Redirect defines a click event for
button, labels.
 Server.Transfer() -
a) It is method.
b) It is Somewhat similar to Response.Redirect().
c) It allows user to navigate from one web page to
another web page only on same server.
d) Server.Transfer() is faster than
Response.Redirect(), just because it requires one
request/response life cycle.
e) Server.Transfer allows you to pass value from one
page to another (Page.PreviousPage).
 CrossBackPosting –
a. Cross page posting allows you to post data from one
page to another page.
b. E.g. Code -
protected void Page_Load(object sender, EventArgs e)
{
Page prevpageObj = Page.PreviousPage; //Page is a class
//
if (prevpageObj != null && PreviousPage.IsCrossPagePostBack) //if
text is null is not empty
{
Label3.Text =
((TextBox)PreviousPage.FindControl("nameTextBox")).Text;
Label4.Text =
((TextBox)PreviousPage.FindControl("emailTextBox")).Text;
}
else
{
Label5.Text = "You landed on this page";
}
}

Design

If you fill this textbox, and click on button (CrossPostBack) the data from
textbox will be transferred to another page.
Q9. Difference between Response redirect and Server
Transfer?
INTERVIEW QUESTION

Ans.
Sr. Response.Redirect Server.Transfer
no.
Response.Redirect is useful to Server.Transfer is useful to
1 redirect user from one page to redirect user from one page to
other page of different server. other page on same server.

2 Redirection done on browser. Redirection done on server.


The url changes is reflected in url The url does not changes, so the
3 box Thus, it is less secure. url changes is not reflected in url
box. Thus, it is more secure.

4 Response.Redirect is slower as it In Server.Transfer, is faster as it


has multiple request and has one request and response
response cycle. cycle.
It is less efficient. It is more efficient.
5 Response.Redirect do not Server.Transfer preserve
preserve values of One webpage values of One webpage
(webform1) to Second Webpage (webform1) to Second Webpage
(webform2). (webform2).
6 Response.Redirect() takes a round Server.Transfer () do not take a
trip. round trip.

Q10. Difference between Server.Transfer and Server.Execute?


Ans.:
Sr.no. Server.Transfer Server.Execute
1 Server.Transfer navigate Server.Execute does not
from one webpage to navigate to another
another webpage. webpage.
2 Server.Transfer display Server.Execute display
output on another webpage output on same
Webpage.

Extras –
Http 301 –
o 301 redirect is a permanent move of a webpage.
INTERVIEW QUESTION

o Think of like you are change your home from Mumbai to pune. You
tell all your buddies to meet at pune or send letter to pune.
o Suppose a developer develop a webpage with url name xyz.html.
Now developer want to change its location to different server with
new url name abc.html, permanently. So now client has to enter
abc.html instead of xyz.html to enter to the website.
Http 302 –
o 302 redirect is a temporary move of a webpage.
o Think of like we had gone to summer holiday for a week, and then
we will return back to original home.
o Suppose a developer develop a webpage with url name xyz.html.
Now developer want to update xyz.html. So when client enter a
website name xyz.html he will be redirect to abc.html instead of
xyz.html, until user update is completed.
Http 200 –
The HTTP 200 OK success status response code indicates that the
request has succeeded. A 200 response is cacheable by default.
The meaning of a success depends on the HTTP request method:
GET: The resource has been fetched and is transmitted in the message body.
POST: The resource describing the result of the action is transmitted in the
message body.

Q11. Round Trip in Asp.net?


Ans.:
INTERVIEW QUESTION

o Meaning from Dictionary -Round trip means a trip from one


destination to another destination and returning to starting
destination.
o A trip of webpage from client to server amd back to client from
server.
Q12. Round trip in Server.Transfer and Response.Redirect?
Ans.:
o Round trip in Server.Transfer and Response.Redirect.
http://www.c-sharpcorner.com/UploadFile/a20beb/what-does-round-trip-
mean-in-response-redirect/
o In the case of Response.Redirect(), first send the request to the
Browser with "HTTP 302 Found" code then the Browser sends the
request to the server and gets the response with "HTTP 200 Ok"
from the server.

But if I talk about Server.Transfer() that directly sends the request


to the server and gets the response with "HTTP 200 Ok" from the
server.
o E.g. –
 Consider Page1.aspx and Page2.aspx. Below code will
redirect Page1 to Page2 on PageLoad.
o public partial class Page1 : System.Web.UI.Page
o {
o protected void Page_Load(object sender, EventArgs e)
o {
o Response.Redirect("Page2.aspx");
o }
o }
 Request –
When Client send a request for a page, at first page1.aspx
is opened with “Http 302 code”
Http 302 –
o It indicates that resources requested has been
temporarily moved to another location
Response –
When server gets a request for a page, at page2.aspx is
opened with, page2.aspx Http 200
INTERVIEW QUESTION

Q12. Explain State Management?


Ans.:
o Basic Idea of Http Protocol-
 As we know, Client sends a request to server, Server process
the request and generates Http Response which is send back
to Client.
 Http has a Stateless nature.
 Stateless means this Circular nature, request-response
cycle continues until client sends a request.
 But when a Client disconnect to server, and when
connection re-establish a new connection is made.
 In Short, the connection is handles as a new connection.
 That is why each request send to a web server is unique.
 Webserver see every request as new request.
 Why Stateless?
 Stateless nature does not allows server or controls to
preserve its value.
 It does not retains states between postback. (first time
or reload)
 When you enter some value on text field, when you
revisit to that page values of text field will get
disappears.
o State Management means to preserve state of Control and Web
page. State Management allow asp.net to works as Stateful
protocols.
INTERVIEW QUESTION

Q13.State Management?
Ans.:
o Client Side –
 In client side State Management, state information will get
stored at Client side.
 There are five type -
 Hidden Field -
 It holds a value for a particular webpage.
 Result is not rendered on webpage.
 It is useful while store id information based on
which other fields are populated.
For e.g. in sql
Select * from employee where id = 1;
1 is stored in hidden field. To navigate to next
page you need increment id. At this point you do
not want to show id value to client.
 View State -
 View State preserve values between two
webpages.
 Cookies -
 Cookies is small text file store on user hard drive.
 Cookies are of two type –
o Persistent –
 Has no expiration time.
o Non-persistent –
 Has expiration time.
 But cookies are stored till the user
using the web service.
 Query String –
 It is a Common way to send data from one webpage
to another webpage.
 Query String are appended to the page URL.
 ?(Question Mark) - indicates beginning of query
string,
& (Ampersand) - indicates appended string values to
the URL.

 Control State –
INTERVIEW QUESTION

o Server Side –
 In server side State Management, state information will get
stored at server side.
 There are two type
 Session –

 Application

Q4. Query String?


Ans.:
Q5.Create Session in Asp.net?
Q6. Create a Session Variable store its value in Text Box?
Q5. What is Master Page?
Q6. When we reload a page do Whole Master Page is Reloaded
or only Content Page is Reloaded?
Ans. Yes, Whole Master Page is Reloaded.
Q6. Is it possible refresh only Content Page section of a master
page?
Q7. How to create Master page in ASP.NET?
Q8. What is Dataset?
Q9.What is SqlDataAdapter?
Q10. What is SqlDataReader?
Q11. Difference between SqlDataAdapter and SqlDataReader?
Q12. Write Insert Command for following?
INTERVIEW QUESTION

Name

Age

INSERT

Q13. Different Ways to display data? Explain Each


Q14. Difference between GridView and GridView?
Q14. How to bind gridview to database using dataset?

MVC
Q1.Difference between ViewResult and ActionResult?
Q2.Can I create two button in form?
Q3.Transfer data from view to controller?
Q4.Difference between ViewBag and ViewData?

JAVASCRIPT
Q1. How to call a javascript function event on from asp.net
button click?
Ans.:
i. You can use document.getElementById -
document.getElementById('<%= txt_id.ClientID %>').value;
ii. Call the asp.net textbox using document.getByElementById

SQL
Q1. Joins

TIZZY WEB SERVICES PRIVATE LIMITED AND SQUAD


INFOTECH
INTERVIEW QUESTION

APTITUDE –

From a group of 7 men and 6 women, five persons are to


be selected to form a committee so that at least 3 men are
there on the committee. In how many ways can it be
done?
https://www.quora.com/From-a-group-of-7-men-and-6-women-five-persons-are-to-be-selected-to-form-a-
committee-so-that-at-least-3-men-are-there-on-the-committee-In-how-many-ways-can-it-be-done

C#
Q. Interface stores
Method, properties, Event,
Q. Interface are?
Q. Do structure implement Interface?
Q. Do class implement interface
Q.
Q. String s1, s2;
S1 =abc;
S2=pqr;
Does S1 and S2 requires new
How many object required

Q. What is the difference between string s="abc" and string s =new


string("abc").

Q. How many Object are created ?In the declaration of strings, String
s1="abc"; String s2="xyz"; String s3=new String("abcd");totally how
many objects will be created?
A=1, B=11, C=10 or D=2
 A new object is created if you create a string using new
keyword. So, S3 is an Object.
INTERVIEW QUESTION

 The System.String data type is used to represent a


string in .Net. A String in C# is an Object of type
System.String
 What is String?
 String is a class. As usual String class
contains some methods and
properties.
 That mean s1 and s2 are object of
class String.
 String is immutable
Strings are reference type and also strings are immutable means the contents of string cannot be
changed, every time when a new instance or object gets created. Here s1, s2 points to the same
object.
What is immutable?

In object-oriented, an immutable object is an object whose state cannot be modified after it


is created. This is in contrast to a mutable object, which can be modified after it is created.
Use of immutable object –

Consider an example –
Object Memory
Suppose, Location
String s1=”One”; S1 004
S2 004
String s2=”One”; S3 005
String s3=”Two”;
S1 and S2 values are same. 004 is a memory location contains value One.
So, S1 and S2 share same memory.
Now, before moving forward lets understand what is String Pool?
INTERVIEW QUESTION

String pool -
The string intern pool is a table that contains a single reference to each
unique literal string declared or created programmatically in your
application.
E.g.1 -

E.g.2 –
string x = "ab";
string y = "ab";
Value ab reside in same string pool. x and y shares the same pool.
Lets check the Object Memory Location
INTERVIEW QUESTION

S1 and S2 share same memory location. Both use shares same pool.
S1 and S2 will create only one Object
What if adding code as S1 = “prashant”? Will previous value S1=”One”
get changes and will it going to create new Object?
Since, String is immutable? Meaning once string is defined its value
cannot be removed from memory? So S1 value will changed to prashant.
Object Memory Value Object Memor
Location placed in Change value of s1 = Prashant Locatio
memory S1 remove
S1 004 One
S2 004 One A new Object S1
S2 004
S3 005 Two is created old is S3 005
deleted S1 006
Immutable string cannot be changed once declared and defined. In a simple word, if we
declare a string for example, string s1 = “One”, a memory will be allocated for it and “one”
string will be placed in the memory.
If we try to change the string pointed by s1 variable e.g. s1 = “ Prashant”, an another new
memory will be created and “Prashant” string will be placed in it. Now, s1 variable will no
longer point the memory where string “One” was placed and old memory will be destroyed
by GC.

Q. Which of the following statements are true about the C#.NET code
snippet given below?
String s1, s2;
s1 = "Hi";
s2 = "Hi";
1. String objects cannot be created without using new.
2. Only one object will get created.
3. s1 and s2 both will refer to the same object.
4. S1, s2 are stored in stack.
Hi stored in Heap.
5. Two objects will get created, one pointed to by s1 and another pointed to
by s2.
s1 and s2 are references to the same object.

[A]. 1, 2, 4
[B]. 2, 4, 3, 5
[C]. 3, 4
[D]. 2, 5
INTERVIEW QUESTION

Q. Explain Comparision?
Ans.
int s1 = 10;
int s2 = 10;
s1=s2;
//Illegal use of Operator

s1 == s2
//Compare Reference type (it will return true if both point to same object)

s1.Equals(s2)
//Perform value comparision

ReferenceEquals(s1,s2)
//object.ReferenceEquals method compares references.
// The object.ReferenceEquals method gives you the ability to determine if // two
objects are in the same memory location.
E.G. 1 -

StringBuilder s1 = new StringBuilder("fred");


StringBuilder s2 = new StringBuilder("fred");
Console.WriteLine( s1 == s2 );
Console.WriteLine( s1.Equals(s2) );

will display:
False //Both use different object
True //values are true
s1 and s2 are different objects (hence == returns false), but they are equivalent (hence
Equals() returns true)

E.G. 2 -
using System;
using System.Text;

class Program
{
static void Main()
{
//Testobject.ReferenceEquals.
StringBuilder builder1 = new
StringBuilder();
StringBuilder builder2 = new
StringBuilder();
//Compare two object
INTERVIEW QUESTION
Console.WriteLine(object.ReferenceEq
uals(builder1, builder2)); //return
false
builder1 = builder2;

//Compare two object after assign


value of builder1 to builder2
Console.WriteLine(object.ReferenceEq
uals(builder1, builder2));
// Test object.ReferenceEquals on
string literals.
//value a is stored in string pool
string literal1 = "a";
string literal2 = "a";

Console.WriteLine(object.ReferenceEq
uals(literal1, literal2));
//return true bcaz both object
literal1 and //literal2 share same
memory location since its values
are same.

literal1 = literal2;
Console.WriteLine(object.ReferenceEq
uals(literal1, literal2));
//return true
}
}

Output

False
True
True
True

Q. Array, Heap and Stack relation


ASP.NET -
Q. DataBind with dropdown
Q. Do asp.net have multiple web.config file?
Ans.:
Yes, But then how the compiler will check the connection string?
You can create App.Config file and Db.config for Application and
Database respectively.
Also, you can have multiple web.config files in sub directories. Settings
will be override automatically by asp.net.
INTERVIEW QUESTION

For example if you have a application which has two modules lets say
accounts and sales. You will create both these modules in a separate
folder with each folder having separate config files.

Refer to this website

https://www.codeproject.com/Articles/11034/Working-with-more-than-one-Web-config-
file

Q. Custom Control
SQL –
Q.

MACHINE ROUND

Q insert update delete


Q Previous Next
Q Dropdown bind control
Q Use of transfer data from one form to another

INTERVIEW QUESTION ASK TO RAHUL SONI IN


GOREGAON-W
C#
Q1. OOP’S?
Q2.When to use abstract method?
Q3.What is abstract method?
INTERVIEW QUESTION

Q4.difference between abstract method and interface?


ASP.NET
Q1. Do asp.net has multiple Webconfig?
MVC
Q1. MVC ARCHITECTURE?
Q2.MVC life cycle?
Q3. Filter config?
Q4.

SQL
Q1. JOINS
Q2.DB OBJECT?
Q3. Trigger? Three type of trigger?
Q4.Index? Two type of Index?
Q5.Sql Language? DDL, DML, DCL, TCL?
Q6.Difference between procedure and function?
Q7. Stored Procedure
Q8. View? Type of View?
Q9. Primary key, Candidate key and Composite key difference?
Q10. Having and Where Difference?
Q11. OrderBy and GroupBy Difference?
Q12. What is ASCII?
Ans.
 It is a Binary Coding System and it is a language
translation Program.
 ASCII stands for American Standard Code for
Information Interchange. It is a Binary Coding scheme
for alphabets {A-Z} and Symbol ‘ ’(space) , @, #...etc .
 ASCII Stores 128 Characters
INTERVIEW QUESTION

 Check this Binary format for ascii code.

 e.g.
char x = ‘a’;
x is variable store alphabet a in memory.
So actually computer stores alphabets a in 0& 1 format
in memory.
ASCII Code for character ‘a’ is 97
Binary number for 97 is
0 1 1 0 0 0 0 1

 While Binary Coding Scheme for number {0-9} is


called as EBCDIC – Extended Binary Code Decimal.
E.g. – 8 Digit Binary Number for number
1 0000 0001
2 0000 0010
3 0000 0011
4 0000 0100
5 0000 0101
6 0000 0110
7 0000 0111
INTERVIEW QUESTION

8 0000 1111
9 0000 1001
10 0000 1010
11 0000 1011
12 0000 1100
13 0000 1101
14 0000 1110
15 0000 1111

Q14. What is difference between ASCII and UNICODE?


Ans.:
 ASCII defines 128 characters, which map to the
numbers 0–127.
 Unicode defines 221characters
Unicode is Superset of ASCII.

 ASCII Stores only made for English Language Since


center of computer language is USA.
 Unicode store alphabets used in different languages
like Hindi, Arab, Latin, Greek. …etc
 We already know ASCII used 8 bit binary sytem
encoding. But, Unicode characters don't generally fit
into one 8-bit byte.
 There are numerous ways of storing Unicode
characters in byte sequences, such as UTF-32 and UTF-
8.
INTERVIEW QUESTION

Q. Difference between Varchar and NVarchar?


Ans.:
1. Nvarchar stores UNICODE data. If you have requirements to store
UNICODE or multilingual data, nvarchar is the choice. Varchar
stores ASCII data and should be your data type of choice for normal
use.
2. That means NVarchar character of different Hindi, Arab, Greek,
Latin…etc
3. Regarding memory usage, nvarchar uses 2 bytes per character,
whereas varchar uses 1.
4. Way of writing code using varchar and ncvarchar are same. There is
no difference between the way they are written.
Q. What is Identity?
Ans.:
 The MS SQL Server uses the IDENTITY keyword to
perform an auto-increment feature.
 What is a difference between auto-increment and
identity;-
 Both perform same operation.
 Identity is MSSQL and auto increment is used
is MYSQL.
Interview Question asked in GrantRoad-W ?
Q. Finalize?
Ans.:
 Finalise is a method.
See the declaration by C# -
protected virtual void Finalize()
 As you can see the finalize method is created using virtual
keyword. So, the finalise method is overided in child class. So
finalize method should be protected.
 Finalize method deallocated the resources held by the object before
it is destroyed by garbage collector.
 Finalize method is used to perform cleanup operation on
unmanaged resources.
INTERVIEW QUESTION

Sr.no. Finalize Dispose


1 We should avoid writing a
Finalize method (destructor)
unless our object controls some
unmanaged resource (such as
file handles, window handles,
or database connections) other
than managed memory. If our
object merely has references to
other managed code objects,
garbage collector will take care
of freeing all the memory and
other objects correctly.
2 The reason to avoid finalizers,
unless you absolutely need
them, is
3 Objects with finalizers take much
longer to garbage collected than
do objects without, so don't
override Finalize “just to be safe.”
4 Before the object that has a
finalize method can be garbage
collected, CLR will do a lot of
time consuming work on this.
So think twice before you use
the finalize method, as
finalizing objects can
needlessly hurt your program's
performance.
5 We cannot really predict when
the finalize method will be
called. It will be called during
garbage collection, and time to
collect the garbage is decided
by the .net runtime by using
optimization algorithms.
6 To surpass the disadvantage of
finalizers another method is
provided in .net framework i.e.
Dispose. Using Dispose will not
hurt your programs
performance or kill the
runtime time
INTERVIEW QUESTION

Q. Collection?
Q. Difference between Collection and Array?
Q. Generic?
Q. Non Generic?
Q. Difference between Generic and Non Generic?
Q. Restful Web-Services?
Q. Structure?
Q. Enum
Q.Difference Structure vs Enum?