What are Scripting Objects?

What are Scripting Objects?
Ans)
Select from following answers:
  1. TextStream object
  2. FileSystemObject object
  3. Dictionary object
  4. All of the Above
All the above mentioned objects are said to be scripting objects

How do we check Array out of range error in C#

How do we check Array out of range error in C#
Ans)


In C# we have IndexOutOfRange exception which is used to check the index out of range exception.

Example:
try
{
------
}
catch(IndexOutOfRangeException ex)
{
Console.WriteLine("An index was out of range!");
}
catch(Exception ex)
{
Console.WriteLine("Error occured: " + ex.Message);
}

In what Software Paradigm, "Test Driven Development (TDD)" fall ?

In what Software Paradigm, "Test Driven Development (TDD)" fall ?
Ans)

Select from following answers:
  1. Agile Methodology
  2. Extreme Programming
  3. Prototype
Ans is Extreme Programming
TDD is one of the basic requirement of Extreme Programming.

Extreme Programming is based on Agile Software Development in which software quality and responsiveness is maintained to changing customer requirements. Extreme Programming enhances software development projects in 5 key ways:

Communication, simplicity, feedback, respect, and courage.

How do we read XML Schema and Data into a Dataset ?

How do we read XML Schema and Data into a Dataset ?
Ans)
We can read the XML Schema and data into Dataset using --

Dataset.ReadXml command.

example Follows :
DataSet DemoDataSet = new DataSet();
DataTable DemoDataTable = new DataTable("Table Name");
DemoDataTable .Columns.Add("Column Name", typeof(string));
DemoDataSet .Tables.Add(DemoDataTable);


string strXMLData = "Add an xml data"

System.IO.StringReader xmlSR = new System.IO.StringReader(strXMLData);

DemoDataSet .ReadXml(xmlSR, XmlReadMode.IgnoreSchema);

What is the use of Assembly Manifest ?

What is the use of Assembly Manifest ?
Ans)
Generally assembly contains a collection of data where it describes the relation between different elements in the assembly which relate to each other. This assembly manifest contains the assembly metadata. Assembly manifest can be stored in either executable file like an .exe file or .dll file with MSIL. Assembly Manifest has below mentioned information:
Assembly Name
Culture Type
Reference Information
Information on referenced Assemblies
Version Culture List of all the files in the Assembly

What is the need for Hash Table and Serialization in .Net ?

What is the need for Hash Table and Serialization in .Net ?

Ans)
The Hashtable object contains items in key/value pairs. The keys are used as indexes. We can search value by using their corresponding key.
In .NET, the class that implements a hash table is the Hashtable class.

By using Add Method we can add elements to the Hashtable as shown below:
----------
private Hashtable table = new Hashtable();

public void AddEntry(BookEntry entry)
{
table.Add( entry.GetPerson(), entry );
}
-----------
Once the Hashtable gets populated,you can search and retrieve data in it by calling the indexer for the Hashtable class as shown below:
-----------------------------
public BookEntry GetEntry(Person key)
{
return (BookEntry) table[key];
}
----------------------------------

You can also remove the records from the Hashtable by calling the Remove Method which takes a key identifying the element you want to remove as shown below:
-------------------------------------
public void DeleteEntry(Person key)
{
table.Remove( key );
}
---------------------------------------
The data populated from the Hashtable can be saved using Serialization process.
Serialization is a process where the object gets converted into a linear sequence of Bytes for storage or transmission to another location.
This process can be done by using BinaryFormater class which serializes Hashtable object to file stream.
--------------------------
public void Save()
{
Stream s = File.Open("Phone.bin", FileMode.Create, FileAccess.ReadWrite);
BinaryFormatter b = new BinaryFormatter();
b.Serialize(s, table);
s.Close();
}
-----------------------------

By using the Deserialize method, you can get back the recovered Hashtable object as shown below:
--------------------
s = File.Open("Phone.bin", FileMode.Open, FileAccess.Read);
BinaryFormatter b = new BinaryFormatter();
table = (Hashtable) b.Deserialize(s);
--------------------------

WCF Interview Questions Part_2

Previous Questions                                                                                 Next Questions

4)      What are the main components of WCF?
Ans)
            The main components of WCF are

1. Service class
2. Hosting environment
3. End point
----------------------------------------------------
5)      Can you explain how End points, Contract, Address and Bindings are done in WCF?
Ans)
All communication with a Windows Communication Foundation (WCF) service occurs through the endpoints of the service. Endpoints provide clients access to the functionality offered by a WCF service.
            Each endpoint consists of four properties:
ñ An address that indicates where the endpoint can be found.
ñ A binding that specifies how a client can communicate with the endpoint.
ñ A contract that identifies the operations available.
ñ A set of behaviors that specify local implementation details of the endpoint.
Example for Create EndPoints:
This example we explain with TCP Binding  binding type & class for this one is NetTcpBinding
string urlService=  “HostName”;
NetTcpBinding tcpBinding = new NetTcpBinding();
tcpBinding.TransactionFlow = false;
tcpBinding.Security.Transport.ProtectionLevel =                             System.Net.Security.ProtectionLevel.EncryptAndSign;
tcpBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;
tcpBinding.Security.Mode = SecurityMode.None; // <- Very crucial
                
 // Add a endpoint
syntax :: host.AddServiceEndpoint(contract,Binding,Address)
host.AddServiceEndpoint(typeof(Method or class for access your service), tcpBinding, urlService);

-------------------------------------
6)What is a service class?
Ans) Service class means a .cs file, it contains the Servicecontract,DataContract & Operationcontract.
Service class is contains Endpoints.


Previous Questions                                                            Next Questions

WCF Interview Questions Part_1

1)What is WCF?

First let us give a short answer to this: - “WCF (Indigo was the code name for WCF) is a unification of .NET framework communication technologies “.WCF is a unification technology, which unites the following technologies:-
• NET remoting
• MSMQ
• Web services
• COM+.
Below figure depicts WCF fundamentals pictorially.


---------------------------------------------------------------------

2)What are bindings?
Ans)
Bindings specify how a Windows Communication Foundation (WCF) service endpoint communicates with other endpoints. At its most basic, a binding must specify the transport (for example, HTTP or TCP) to use. You can also set other characteristics, such as security and transaction support, through bindings.
Here we have 9 types of binidings and this binding classes are under the
System.ServiceModel namespase
Binding type
Class name under  “System.ServiceModel” namespase

Basic Binding

BasicHttpBinding

TCP Binding

NetTcpBinding

Peer Network Binding

NetPeerTcpBinding 

IPC Binding

NetNamedPipeBinding

Web Service (WS)  Binding

WSHttpBinding

Federated WS Binding

WSFederationHttpBinding

Duplex WS Binding

WSDualHttpBinding

MSMQ Binding

NetMsmqBinding

MSMQ Integration Binding

MsmqIntegrationBinding



-------------------------------------------------------------------------------------------------------

3)      Which specifications does WCF follow?
Ans)

WCF supports specifications defined by WS-* specifications. WS-* specifications are defined together by Microsoft, IBM, SUN and many other big companies so that they can expose there service through a common protocol. WCF supports all specifications defined we will understand them one by one.

1.Messaging (WS-Addressing):- SOAP is the fundamental protocol for web services. WS Addressing defines some extra additions to SOAP headers, which makes SOAP free from underlying transport protocol. One of the good things about Message transmission is MTOM, also termed as Message Transmission Optimization Mechanism. They optimize transmission format for SOAP messages in XML-Binary formant using XML optimized packaging (XOP). Because the data will sent in binary and optimized format, it will give us huge performance gain.

2.Security (WS-Security, WS-Trust, and WS-Secure Conversation): - All the three WS- define authentication, security, data integrity and privacy features for a service.

3.Reliability (WS-Reliable Messaging): - This specification ensures end-to-end communication when we want SOAP messages to be traversed back and forth many times.

4.Transactions (WS-Coordination and WS-Atomic Transaction): - These two specifications enable transaction with SOAP messages.

5.Metadata (WS-Policy and WS-Metadata exchange): - WSDL is a implementation of WS-Metadata Exchange protocol. WS-Policy defines more dynamic features of a service, which cannot be expressed by WSDL.
We have stressed on the WS-* specification as it is a specification which a service has to follow to be compatible with other languages. Because WCF follows WS-* specifications other languages like JAVA , C++ can also exploit features like Messaging , Security , Reliability and transactions written in C# or VB.NET. This is the biggest achievement of WCF to integrate the above features with other languages. 

Dot Net Interview Questions




What is .NET 3.0 ?




What are the main components of WCF?
Can you explain how End points, Contract, Address and Bindings are done in WCF?
What is a service class?
What is a service contract, operation contract and Data Contract?
What are the various ways of hosting a WCF service?
What are the major differences between services and Web services?
What is the difference WCF and Web services?
What are different bindings supported by WCF?
Which are the various programming approaches for WCF?
What is one way operation?
Can you explain duplex contracts in WCF?
How can we host a service on two different protocols on a single server?
How can we use MSMQ bindings in WCF?
Can you explain transactions in WCF?
What different transaction isolation levels provided in WCF?
Can we do transactions using MSMQ?
Can we have two way communications in MSMQ?
What are Volatile queues?
What are Dead letter queues?
What is a poison message?
WPF Interview questions What is WPF?
What is XAML?
What are dependency properties?
Are XAML file compiled or built on runtime?

Can you explain how we can separate code and XAML?
How can we access XAML objects in behind code?
What are the kind of documents are supported in WPF?
Windows workflow foundation(Vista series)
What is Windows Workflow Foundation?
What is a Workflow?.
What are different types of Workflow in Windows Workflow foundation?
When should we use a sequential workflow and when should we use state machiHow
do we create workflows using designer?
How do we specify conditions in Work flow?
How do you handle exceptions in workflow?
What is the use of XOML files?
Twist: - How can we serialize workflows?
How can we pass parameters to workflow?
AJAX Interview questions
What problem does Ajax solve?
What is Ajax?
What is the basic fundamental behind Ajax?
What is JSON?
How do we use XMLHttpRequest object in JavaScript?
How do we do asynchronous processing using Ajax?
What are the various states in XMLHttpRequest and how do we check the same?
How can we get response text?
How can we create XMLHttpRequest component?
How can we create a class in JavaScript using Atlas?
How do we do inheritance using Atlas?
How do we define interfaces using Atlas?
How do we reference HTML controls using Atlas?
Can you explain server controls in Atlas?
Can you explain ScriptManager control?
What is the importance of UpdatePanel Control?
Can you explain update progress control?
Can you explain control extenders?
How can we data binding in Atlas?
Can you explain AtlasUIGlitz library?
I want to create a project like Google maps how can we do that with Atlas?
How can we integrate Atlas with Web services?
How can implement drag and drop using Atlas?
How do we do authentications using Atlas?
How can we access profiles using Atlas?
How can we access dataset in Atlas?

SQL Server Interview Questions

1) What is the difference between CAST and CONVERT in SQL?
Ans)
You can use either CAST or CONVERT. Because CAST and CONVERT provide similar functionality.
The difference is CASE is more ANSI standard and use this only if you are writing a program which you will need to use in many database platforms. Where CONVERT is Microsoft specific and more powerful.
---------------------------------------------------------------------------------
2) Which of the following are the limitations of VIEWS?
Ans)

Select from following answers:
  1. Views cannot be relied on Temporary tables
  2. If TOP or FOR XMl are used then using OrderBy Clause is invalid
  3. We cannot pass parameters to VIEWS
  4. All of the Above

All the above mentioned sentences are the limitations of VIEW.

Sample VIEW example :
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition

Interview Questions on Asp.net,C#.net & Sql Server


Interview Questions on Asp.net,C#.net & Sql Server Part -I

Interview Questions on Asp.net,C#.net & Sql Server Part -II

Interview Questions on Asp.net,C#.net & Sql Server Part -III


Latest Interview Questions

1) How can you assign page specific attributes in an ASP.NET application?
Ans)

Select from following answers:
  1. @Page
  2. "scrip" attribute
  3. %page%


The @Page directive is responsible for this.
-------------------------------------------------------------------------

Dot Net Interview questions for 3+ years of experience - Part-2




1)In MVC Framework, who decides what to render in the VIEW ?

Ans)
Select from following answers:
Model
Controller
View

Controller decides what to render in the VIEW.

Only job of the VIEW in MVC is " how to render".
-------------------------------------------------------
2)Whats is the difference between API and WebServices?

Ans)

A)Web Services gives the output in the form of XML or JSON.Where as API return the output in the form of void,
scalar or generic type
B)We need to add web references for web-services and add references for API
----------------------------------------------------------

3) Singleton is also called as Anti-Pattern, why ?
Ans)

It's very hard to create a subclass, or to create a mock object for a Singleton class.
Singleton makes the unit testing harder. Singleton hide the dependencies and make the classes tightly coupled with
each other.

For the above reasons, Singletons are called as Anti-Pattern.
---------------------------------------------------------
4) Why should a Singleton class be serialized only once ?
Ans)
If a Singleton class is serialized and then De-serialized multiple times,
there will be multiple objects which will violate the principles of Singleton pattern.
Therefore it should be serialized and De-serialized only once !
-----------------------------------------------------------
5)How many design patterns can be created ?
Ans)
There is no limit in creating a design pattern. Design patterns are based on re-usability,
object creation and communication. Design patterns can be created in any language.
-----------------------------------------------------------
6) How can we trace our view state information?
Ans)
We can trace View State of our application by placing this tag at Page Directive.

<%@ Page Language="C#" AutoEventWireUp="true" Trace="True"
-------------------------------------------------------------
7) Which of the following tool is useful to see all the methods which are used in the class file of our application ?
Ans)
Select from following answers:
  1. Object Browser
  2. Object Explorer
  3. Class Viewer
  4. Class Explorer

The Object Browser allows us to examine and
discover objects (namespaces, classes, structures, interfaces, types, enums, and so on..) and
their members (properties, methods, events, variables, constants, enum items, and so on..)
from different components. Hence we can use Object Browser to locate our methods in a class file.

ASP.Net Interview questions part_2


1)In MVC Framework, who decides what to render in the VIEW ?

Ans)
Select from following answers:
Model
Controller
View

Controller decides what to render in the VIEW.

Only job of the VIEW in MVC is " how to render".
------------------------------------------------------------------
2)Whats is the difference between API and WebServices?

Ans)

A)Web Services gives the output in the form of XML or JSON.Where as API return the output in the form of void,scalar or generic type
B)We need to add web references for web-services and add references for API

In MVC Framework, who decides what to render in the VIEW ?

In MVC Framework, who decides what to render in the VIEW ?

Ans)

Select from following answers:
  1. Model
  2. Controller
  3. View

Controller decides what to render in the VIEW.

Only job of the VIEW in MVC is " how to render".

how to caputure user control button click event in aspx page


Answer:

in ascx page

-------------------------------------------------------  ascx page start -----------------
using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;



public partial class WebUserControl : System.Web.UI.UserControl

{

public event EventHandler obj;





public string st

{

get

{

return this.TextBox1.Text;

}



}

protected void Page_Load(object sender, EventArgs e)

{



}

protected void Button1_Click(object sender, EventArgs e)

{

obj(sender, e);

}

}
-------------------------------------------------------  ascx page end-----------------


In aspx page 
-------------------------------------------------------  aspx page start -----------------


protected void Page_Load(object sender, EventArgs e)

{

WebUserControl1.obj += new EventHandler(Button1_Click);

}



protected void Button1_Click(object sender, EventArgs e)

{

Label1.Text = WebUserControl1.st;



}
-------------------------------------------------------  ascx page end----------------- 

Tags :how to caputure user control button click event in aspx page,ascx page,aspx page

What is LINQ?


Full form of LINQ is,

LINQ - Language-Integrated Query which is available with .net version 3.5 and greater

Tags :linq,.net 3.5

What is difference between "String" and "string" ?


Answer:

"string" is an alias for System.String . So technically, there is no difference between them. It's like int vs. System.Int32
 
Very Simple

string is a type in c# while String is a type in .Net CLR.
Ultimately c# type is converted into .net type.


Tags : .net clr,difference between string & String in.net

What is the basic difference between "var" keyword in Javascript and C# ?

Answer:

In C#, we have "dynamic" keyword. This dynamic keyword is somewhat similar to javascript's "var" . Here, both create a variable whose type will not be known until runtime, and whose misuse will not be discovered until runtime. C#'s var creates a variable whose type is known at compile time.

For example:-

dynamic dt= new DateTime();

dt.bar();


//compiles fine but gives an error at runtime

Tags : var keyword in c#,Jquery

Static members are 'eagerly initialized' ?


Select from following answers:

 a.   True
  b.  False
  c.  No Idea

Ans)
True.

Static members are 'eagerly initialized' because it is initialized immediately when a class is loaded for the first time.

Example :-

static int NumberOfTyres = 20;

The above static variable will be initialized as soon as the class is loaded.

Is it good to load jquery from CDN(Content delivery network)

Answer: Yes, it is always good to load your jquery from content delivery network. It provides some benefits like :-
 (1) Caching - It means that if any previously visited site by user is using jQuery from Google CDN then the cached version will be used. It will not be downloaded again.
 (2) Reduces load - It reduces the load on your web server as it downloads from Google server's.
 Example :-
<script  type="text/javascript"

    src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">

</script>

What is DataGrid in SilverLight?

DataGrid

DataGrid control is one of the most important control in Silverlight to develop Line-of-Business (As per Wiki - Line of business (LOB) is a general term which often refers to a set of one or more highly related products which service a particular customer transaction or business need.) applications and is mostly used to List the records in tabular format.
Apart from listing the records, it also provides option to sort, re-arrange columns, resize columns, edit data etc.

How to list the records in the DataGrid?
    *** Code ***

<grid x:name="LayoutRoot" background="White">
<StackPanel>
<Button x:Name="Button1" Content="FillData" Click="Button1_Click" Height="30" Width="75" Margin="20, 10, 0, 20"/>
<sdk:DataGrid x:Name="DataGrid1" AutoGenerateColumns="True" />
</StackPanel>
</grid>

In the above code, we have a Button control; on click of the button we are executing Button1_Click server side method.
Next, we have DataGrid control with AutoGenerateColumns attribute set to true that automatically generates the columns based on the properties found in the data source.


Code behind
private void Button1_Click(object sender, RoutedEventArgs e)
{
FillData();
}
private void FillData()
{
IList<Person> list = new List<Person>();
Person p = new Person
{
Age = 1,
FirstName = "Joe",
LastName = "Elan",
IsActive = true
};
Person p1 = new Person
{
Age = 15,
FirstName = "Mike",
LastName = "Bull",
IsActive = true
};
Person p2 = new Person
{
Age = 51,
FirstName = "Mukul",
LastName = "Alwa",
IsActive = true
};
Person p3 = new Person
{
Age = 31,
FirstName = "Sheo",
LastName = "Narayan",
IsActive = true
};
list.Add(p);
list.Add(p1);
list.Add(p2);
list.Add(p3);
}
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
public bool IsActive { get; set; }
}

In the above code snippet, in the Button1_Click method we are calling FillData method. In the FillData method, we have instantiated the Person class and set its value and added to the Generic collection.
At last we have set the ItemsSource of the DataGrid to the generic list collection.

Output



 

How to customize the DataGrid’s columns data?

DataGrid has several column types to customize the look and feel of the DataGrid columns.
DataGridTextColumn
It allows keeping the text field type value in the DataGrid. Sorting of this column is inherited out of the box.
DataGridCheckBoxColumn
It allows keeping the Boolean field type value in the DataGrid. Sorting of this column is inherited out of the box.
DataGridTemplateColumn
It allows keeping type of data that can’t be kept in above two column type, eg. Images, it also allows keeping custom data along with other field type value in the DataGrid. Sorting of this column is NOT inherited out of the box, you need to write your own logic to support sorting of this column.
Code
<sdk:datagrid x:name="DataGrid1" autogeneratecolumns="False" margin="10 10 10 10">
<sdk:DataGrid.Columns>
<sdk:DataGridTemplateColumn Header="Full Name">
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding FirstName}" x:Name="t1"/>
<TextBlock Text="{Binding LastName}" x:Name="t2"/>
</StackPanel>
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
<sdk:DataGridTextColumn Header="Age" Binding="{Binding Age}"/>
<sdk:DataGridCheckBoxColumn Header="Is Active?" Binding="{Binding IsActive}"/>
</sdk:DataGrid.Columns>
</sdk:datagrid>





In the above code snippet, we have set DataGrid’s AutoGenerateColumns property to false so its column will not be automatically generated based on the properties of the DataSource.
We have used DataGridTemplateColumn with its CellTemplate that let us specify the template for the data in read only mode. We will see how to specify template for edit mode later on. In the CellTemplate, we have specified the DataTemplate for FirstName and LastName (TextBlocks in the StackPanel, you can’t keep TextBlock directly inside the DataTemplate.
To display the Age data, we have specified DataGridTextColumn and to display Active data we have specified DataGridCheckBoxColumn column type.
Code behind
public DataGridCustomColumn()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(DataGridCustomColumn_Loaded);
}
void DataGridCustomColumn_Loaded(object sender, RoutedEventArgs e)
{
FillData();
}
private void FillData()
{
IList<Person> list = new List<Person>();
Person p = new Person
{
Age = 1,
FirstName = "Joe",
LastName = "Elan",
IsActive = true
};
Person p1 = new Person
{
Age = 15,
FirstName = "Mike",
LastName = "Bull",
IsActive = true
};
Person p2 = new Person
{
Age = 51,
FirstName = "Mukul",
LastName = "Alwa",
IsActive = true
};
Person p3 = new Person
{
Age = 31,
FirstName = "Sheo",
LastName = "Narayan",
IsActive = true
};
list.Add(p);
list.Add(p1);
list.Add(p2);
list.Add(p3);
DataGrid1.ItemsSource = list;
}
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
public bool IsActive { get; set; }
} 
In the above code snippet, we have attached DataGridCustomColumn_Loaded method to the Loaded event of the page. In this method we have called FillData.
In the FillData method, we have created a Generic list collection and added Person object and then set the ItemSource property of the DataGrid to the generic list collection.

Output