Interview Question LATEST
Interview Question LATEST
Interview Question LATEST
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!!
Dictionary –
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]
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]
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
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.
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.
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.
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.
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.:
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
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
class B
{
m2();
}
class C : A, B
{
m1();
m2();
}
interface IB
{
m2();
}
class B : IB
{
m2();
}
class C : A, IB
{
B BObject;
m1();
m2()
{
BObject.m2();
}
}
}
psvm(…)
{
men responsibility = new men();
men.beauty();
men.kid();
men.shopping();
}
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";
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;
c. JAGGED ARRAY
Jagged array is an arrays of array.
It use multiple brackets.
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"];
}
O/p –
INTERVIEW QUESTION
Execute po stBac k,
Load enables viewstate
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
V. VALIDATION –
If asp.net control requires validation, then they are
validated.
IsValid() property validate all asp.net controls.
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
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
Response.Redirect() –
a) It is a method.
b) It is some what similar to hyperlink.
INTERVIEW QUESTION
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.
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.
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
Name
Age
INSERT
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
APTITUDE –
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. 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
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 -
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;
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
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.
https://www.codeproject.com/Articles/11034/Working-with-more-than-one-Web-config-
file
Q. Custom Control
SQL –
Q.
MACHINE ROUND
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
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
8 0000 1111
9 0000 1001
10 0000 1010
11 0000 1011
12 0000 1100
13 0000 1101
14 0000 1110
15 0000 1111
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?