My Thoughts & Views

Archive for the ‘Programming’ Category

–contain only abstract methods
–interface can’t be inherited from a class
–using interfaces we can achieve multiple inheritance
–doesn’t allow accessibility modifiers (Public/Private/Internal)
–can’t contain fields, constructors
–is must implementable & its scope is upto any level of its inheritence chain.

Abstract Class
–contain both abstract methods as well as concrete methods
–can extend another class and implement multiple interfaces
–we can’t achieve multiple inheritance
–allows accessibility modifiers
–can contain fields, constructors
–class Abstract class is must inheritable & its scope is upto derived class

Most of the web developers will know about Fiddler.

Using Fiddler u can log the HTTP traffic between your application & Webservice, here Fiddler acts as a proxy in between your application & the Webservice.

To Use with ASP.NET set the following into your web.config, it will start logging all the HTTP Traffic.

<proxy proxyaddress=”http://localhost:8888&#8243; />

Advantages of Self-Hosting:

  • Is easy to use: With only a few lines of code you have your service running.
  • Is flexible: You can easily control the lifetime of your services through the Open() and Close() methods of ServiceHost.
  • Is easy to debug: Debugging WCF services that are hosted in a self-hosted environment provides a familiar way of debugging, without having to attach to separate applications that activate your service.
  • Is easy to deploy: In general, deploying simple Windows applications is as easy as xcopy. You don’t need any complex deployment scenarios on server farms, and the like, to deploy a simple Windows application that serves as a WCF ServiceHost.
  • Supports all bindings and transports: Self-hosting doesn’t limit you to out-of-the-box bindings and transports whatsoever. On Windows XP and Windows Server 2003, IIS limits you to HTTP only.


Disadvantages of Self-Hosting:

  • Limited availability: The service is reachable only when the application is running.
  • Limited features: Self-hosted applications have limited support for high availability, easy manageability, robustness, recoverability, versioning, and deployment scenarios. These scenarios have become a standard in last few years. Such features are provided by the WAS (Windows Activation Service) which is a part of IIS7 (delivered with Vista and Win2008). This hosting mechanism allows you to host the service by using of protocols like MSMQ, HTTP and TCP. 

The DateTime class is not very exact and only can measure in milliseconds. When doing performance measuring on an application you most certainly need to be able to measure with smaller time units than that. High-resolution timers are supported in the Win32 API so following code wraps it up in a simple class:

public class PerformanceTimer
public static extern void QueryPerformanceCounter(ref long ticks);

long startTime = 0;
long stopTime = 0;

public void Start()
QueryPerformanceCounter(ref startTime);

public void Stop()
QueryPerformanceCounter(ref stopTime);

public long Time
return stopTime – startTime;

I’m sure the code is easy to understand. Here is the sample code to show how to use it.

PerformanceTimer perfoTimer = new PerformanceTimer();

// Do something


Here is the commonly used Cryptographic Algorithms. Please follow the links to see the details of each Cryptographic Algorithms.

Block Ciphers

Tiny Encryption Algorithm

Stream Ciphers

Hash Algorithms

This is second in series of Interview Questions for .NET Application developer position.


* Does C# supports multiple inheritence?
* What is a delegate?
* What are setallite assemblies?
* Differences between Namespace, Class, Assembly?
* What is the difference between managed and unmanaged code?
* What is serialization?
* What’s a bubbled event?
* What is garbage collection? How dot net handles the garbage collection?
* Can we force garbage collector to run ?
* What is concept of Boxing and Unboxing ? Do we have the same problem in c# 2.0? if no how it is resolved? What are generics?
* What happens in memory when you Box and Unbox a value-type?
* What are the ways to deploy an assembly?
* What is the difference between the value type and reference type? Do we have value type in dot net?
* What different types of JIT compliler do we have?
* What’s a multicast delegate?

C# 2.0

* What are the partial classes? Where we can use them?
* Any idea of LINQ project?
* What are generics?

C# Distributed Application

* What different option do we have for creating distributed applications in dot net?
* What is a thread? What is multithreading?
* What is deadlock? How we can elimate the risk?
* This data structure is “Thread Safe” what does that mean?
* What are locks and why we need them? When working with shared data in threading how do you implement synchronization ?
* What are sockets? What is the difference between TCP and UDP sockets?
* Any idea of Windows Communication Foundation?
* What is the difference between a thread and a process? Can a process have multiple threads?
* How we can communicate betweem two processes?
* What is the procedure of communicating between two threads?
* What’s Thread.Join() in threading ?
* What are the different states of a thread?

Following are the ASP.NET interview questions usually asked for experienced people.

* What is View State? Can you read the View State?

— It is ASP.NET State Management Technique to persist changes to the state of a Web Form across post backs. It stores the data in the form of Dictionary (i.e., in Key /Value Pair).

–The Control.ViewState property is associated with each server control in your web form and provides a dictionary object for retaining values between such multiple requests for the same page.

–This is the method that the page uses to preserve page and control property values between round trips.

— You can use ViewState to store any object as long as it is serializable .

— Data is stored in Base 64 Encoding

–It is not encrypted by default.

— The view state of a page is, by default, placed in a hidden form field named __VIEWSTATE.

* Can we disable the view state application wide? Can we disable it on page wide?

— Yes, in web.config file add this line

* Can we disable it for a control?

Yes, set enableViewState=false for the control.

* What is Serialization ?

— Serialization is the process of storing an object’s data and other information necessary to reconstruct the object later.
* What is the difference between encoding and encryption? Which is easy to break?

Encoding –the process of converting a digitized file into a streaming format. or the activity of converting from plain text into code or is the process of transforming information from one format into another.

Encryption— is the process of transforming information (referred to as plaintext) using an algorithm (called cipher) to make it unreadable to anyone except those possessing special knowledge, usually referred to as a key.

Encoding is easy to break.

* What are the Data Access Components provided by Microsoft?

— SqlProvider , OledbProvider, odbcProcvider, oracleProvider

* Any idea of Enterprise library?

Enterprise library is a set of tools developed by Microsoft for enterprise development using .NET.

* What is web service?

— Web Service is a software system designed to support interoperable Machine to Machine interaction over a network. Web services are frequently just Web API’s that can be accessed over a network, such as the Internet, and executed on a remote system hosting the requested services.

* What is WSDL?

— Web Services Description Language.

— is an XML-based language that provides a model for describing Web services.

* Can a web service be only developed in ASP.NET?

— No.
* Can we use multiple web services from a single application?
Yes, you can use.

* Can we call a web service asynchronously?

— Yes. Web Services support both synchronous and asynchronous communication between the client application and the server hosting the service.

* Can a web service be used from a windows application?

– Yes.
* What do we need to deploy a web service?

* What is the significance of web.config?

— It is a ASP.NET Configuration file

— File format is XML so it is stored as text and it is easy to modify.

* Can we have multiple web.config files in a sigle web project?
— Yes but not in single folder.

* Type of ASP.NET Authentications?

— Windows, Forms, Passport, Custom.
* Can we have multiple assemblies in a single web project?

— Yes.
* What is GAC?

— Global Assembly Cache

—- Shared assemblies are stored here

—- You can access it in this path C:\WINNT\assembly or C:\WINDOWS\assembly
* What is machine.config?

— It is a Machine Wide ASP.NET Configuration File.

— It is stored in C:\WINNT\Microsoft.NET\Franework\[Framework Version\CONFIG or C:\windows\Microsoft.NET\Franework\[Framework Version\CONFIG

* What different types of session state Management we have in

— InProc, StateServer, SQLServer
* What are cookies?

— It is a small text file stored in Browser Cache.

—- cookies are used for authenticating, tracking, and maintaining specific information about users, such as site preferences or the contents of their electronic shopping carts.

* What is Cache?

— A web browser or web server feature which stores copies of web pages on a computer’s hard disk.

* What is AJAX?

— Asynchronous JavaScript and XML

— It is a Set of interrelated Technologies mainly consisted of xHTML, JavaScript, XML,
* Is
AJAX a language?

— No, it is a set of interrelated technologies.
* What is an Assembly?

— Single Deployable unit

— EXE or DLL.

— Unit of Execution

— is a partially compiled code library for use in deployment, versioning and security.

— It can consist of one or more files.
* Can an assembly contain more then one class?

— Yes
* What is strong name?

— A strong name consists of the assembly’s identity—its simple text name, version number, and culture information (if provided)—plus a public key.

* What is the difference b/w client and server side?

Client Side :Code is executed in Client Machine

— Server Side: Code is executed at Server Side.

* What is the purpose of IIS?

— IIS is a Web Server, which handles HTTP Requests and helps in authentication.
* Difference between http and https?

— HTTP is not secured HTTPS is secured.
* What is purpose of aspnet_wp.exe?

— aspnet_wp.exe is a ASP.NET worker process whose role is to process requests, such as processing requests to return a ASP.NET page, invoking an ISAPI extension or filter.

* What do you mean by HTTP Handler?

— They are used to handle different types of page extensions.
* What is the purpose of Global.asax?

— It is used to handle application wide events.

* What is the difference between the inline and code behind?

— inline: You can write your server side code and UI in same file.

— code behind: Contains logic of the application.

* What is side by side execution?

— You can run two versions of application simultaneously.
* Can we have two different versions of dot net frameworks running on the same machine?
— Yes.

* What is CLR?

— Common Language Runtime

— It is .NET Run time environment, which has features such as Automatic Memory Management, Garbage Collection, Versioning, Security.
* What is CLI?

— Common Language Infrastructure

— It is an open specification (published under ECMA-335 and ISO/IEC 23271) developed by Microsoft that describes the executable code and runtime environment that form the core of a number of runtimes including the Microsoft .NET Framework, Mono, and Portable.NET.
* What is CTS?

— Common Type System

— CTS cover the range of topics related to type handling. These topics include type safety, cross-language sharing of typed data, type behavior and features, and performance.

* What is .resx file meant for?

This is a Resource File.

It is an XML based file, with key value pair.

— It is used in Localization and Globalization
* Any idea of aspnet_regiis?

— It is a ASP.NET registration

* Any idea of
ASP NET State Service?

— It is an Out of Process Session State management.

— Session state is stored in separate process (i.e, aspnet_state.exe).

* What is the difference between stroed procedure and stored function in SQL?
— Both functions and stored procedures can be custom defined and part of any application. Functions, on the other hand, are designed to send their output to a query or T-SQL statement. For example, User Defined Functions (UDFs) can run an executable file from SQL SELECT or an action query, while Stored Procedures (SPROC) use EXECUTE or EXEC to run.

Stored procedures are designed to return its output to the application. A UDF returns table variables, while a SPROC can’t return a table variable although it can create a table. Another significant difference between them is that UDFs can’t change the server environment or your operating system environment, while a SPROC can. Operationally, when T-SQL encounters an error the function stops, while T-SQL will ignore an error in a SPROC and proceed to the next statement in your code (provided you’ve included error handling support).

If you have an operation such as a query with a FROM clause that requires a rowset be drawn from a table or set of tables, then a function will be your appropriate choice. However, when you want to use that same rowset in your application the better choice would be a stored procedure.

* Can we have an updateable view in SQL?

— Views in SQL Server are usually thought of as read-only select statements; however it is actually possible to build a view to be updatable as well. This allows you to modify the data in the tables the view is based on through insert, update and delete statements on the view. Normal views provide the ability to abstract the physical data model (table) into a logical data model (view); updatable views take this one step further by allowing all CRUD data access to be done though one interface (updatable view).

* What is connection pooling? how can we acheive that in
— Connection pooling behavior is controlled by the connection string parameters. The following are four parameters that control most of the connection pooling behavior:

* Connect Timeout – controls the wait period in seconds when a new connection is requested, if this timeout expires, an exception will be thrown. Default is 15 seconds.

* Max Pool Size – specifies the maximum size of your connection pool. Default is 100. Most Web sites do not use more than 40 connections under the heaviest load but it depends on how long your database operations take to complete.

* Min Pool Size – initial number of connections that will be added to the pool upon its creation. Default is zero; however, you may chose to set this to a small number such as 5 if your application needs consistent response times even after it was idle for hours. In this case the first user requests won’t have to wait for those database connections to establish.

* Pooling – controls if your connection pooling on or off. Default as you may’ve guessed is true.

* What is DataSet?

— is an in-memory cache of data retrieved from a data source,

— is a major component of the ADO.NET architecture.

* What is the difference between typed and untyped dataset?

* What is the difference bewteen accessing the data throgh the dataset and datareader?
— Data Reader is forward only, read only access method and it is faster compared to dataset.

— Dataset is a in memory representation of Database, accessing it is slower compared to dataset.

I request those who read this to send the interview questions which they feel should be included. And also request all to add good answers to the questions.

Keywords to find this page from Google: .net interview questions,.net interview multiple choice,.net experinced interview questions,c# interview questions, interview questions, session interview questions,c# . net + interview questions for experienced hand,c# generics interview question,c# interview questions box unbox,c# software developer interview questions,c# web interview,common it interview question .net,dot net interview questions

new ActiveXObject(Microsoft.XMLHTTP)
This constructor is for Internet Explorer.

new XMLHttpRequest()
This constructor is for any other browser including Firefox.

An anonymous function is assigned to the event indicator.

http.readyState == 4
The 4 state means for the response is ready and sent by the server.

http.status == 200
This status means ok, otherwise some error code is returned, 404 for example. “POST”, “data.xml”, true);
URL of the script to execute.
true for asynchronous (false for synchronous).

http.setRequestHeader(“Content-Type”, “application/x-www-form-urlencoded”);
This is for POST only.

Send data to the server. Data comes from the “TYPEDTEXT” variable filled

throught the form by the user.

How it Works?

Ajax uses a programming model with display and events. These events are user

actions, they call functions associated to elements of the web page.
Interactivity is achieved with forms and buttons. DOM allows to link elements of

the page with actions and also to extract data from XML files provided by the


To get data on the server, XMLHttpRequest provides two methods:
– open: create a connection.
– send: send a request to the server.
Data furnished by the server will be found in the attributes of the XMLHttpRequest

– responseXml for an XML file or
– responseText for a plain text.

Note:a new XMLHttpRequest object has to be created for each new file to load.

We have to wait for the data to be available to process it, and in this purpose,

the state of availability of data is given by the readyState attribute of


States of readyState follow (only the last one is really useful):
0: not initialized.
1: connection established.
2: request received.
3: answer in process.
4: finished.

Famous Set of Techonologies make AJAX a hot topic.AJAX has changed the way

Web apps are developed and used.AJAX is used to build fast, dynamic websites, and

also to save resources.

AJAX- Asynchronous Javascript And XML

Asynchronous- means that the response of the server while be processed when

available, without to wait and to freeze the display of the page.

Ajax is a set of following technologies

1. HTML –for formatting
2. Javascript –client side processing
3. XMLHttpRequest
4. CSS –for styling
5. DOM –to access data inside the page or to access elements of XML file read on

the server (with the getElementByTagName method for example)

other than this some of the optional technologies

* The DomParser class
* PHP,ASP,ASP.NET,JSP and other programming language on the server side.
* XML and XSLT to process the data if returned in XML form.
* SOAP may be used to dialog with the server.

Inside u r Head Tag in HTML Page u insert the following code

function IsNumeric(strString)
// check for valid numeric strings
var strValidChars = “0123456789.-“;
var strChar;
var blnResult = true;

if (strString.length == 0) return false;

// test strString consists of valid characters listed above
for (i = 0; i < strString.length && blnResult == true; i++)
strChar = strString.charAt(i);
if (strValidChars.indexOf(strChar) == -1)
blnResult = false;
return blnResult;

And to check whether the input box has numerals or not use follwing code

alert(“Enter Mobile Number.”)
else if(IsNumeric(document.frmReg.MNumber.value)==false)
alert(“Enter Only 10 Digit Mobile Number.”)

A prime number (or prime integer, often simply called a “prime” for short) is a positive integer 1″ border=”0″ height=”15″ width=”33″> that has no positive integer divisors other than 1 and p itself. (More concisely, a prime number p is a positive integer having exactly one positive divisor other than 1.) For example, the only divisors of 13 are 1 and 13, making 13 a prime number, while the number 24 has divisors 1, 2, 3, 4, 6, 8, 12, and 24 (corresponding to the factorization 24==2^3.3), making 24 not a prime number. Positive integers other than 1 which are not prime are called composite numbers.

Prime numbers are therefore numbers that cannot be factored or, more precisely, are numbers n whose divisors are trivial and given by exactly 1 and n.

The number 1 is a special case which is considered neither prime nor composite (Wells 1986, p. 31). Although the number 1 used to be considered a prime (Goldbach 1742; Lehmer 1909; Lehmer 1914; Hardy and Wright 1979, p. 11; Gardner 1984, pp. 86-87; Sloane and Plouffe 1995, p. 33; Hardy 1999, p. 46), it requires special treatment in so many definitions and applications involving primes greater than or equal to 2 that it is usually placed into a class of its own. A good reason not to call 1 a prime number is that if 1 were prime, then the statement of the fundamental theorem of arithmetic would have to be modified since “in exactly one way” would be false because any n==n.1. In other words, unique factorization into a product of primes would fail if the primes included 1. A slightly less illuminating but mathematically correct reason is noted by Tietze (1965, p. 2), who states “Why is the number 1 made an exception? This is a problem that schoolboys often argue about, but since it is a question of definition, it is not arguable.” As more simply noted by Derbyshire (2004, p. 33), “2 pays its way [as a prime] on balance; 1 doesn’t.”

With 1 excluded, the smallest prime is therefore 2. However, since 2 is the only even prime (which, ironically, in some sense makes it the “oddest” prime), it is also somewhat special, and the set of all primes excluding 2 is therefore called the “odd primes.” Note also that while 2 is considered a prime today, at one time it was not (Tietze 1965, p. 18; Tropfke 1921, p. 96).

The nth prime number is commonly denoted p_n, so p_1==2, p_2==3, and so on.

The first few primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, …
A mnemonic for remembering the first seven primes is, “In the early morning, astronomers spiritualized nonmathematicians”

In the Season 1 episode “Prime Suspect” (2005) of the television crime drama NUMB3RS, math genius Charlie Eppes realized that character Ethan’s daughter has been kidnapped because he is close to solving the Riemann hypothesis, which allegedly would allow the perpetrators to break essentially all internet security by factoring large numbers.

The numbers of decimal digits in p_(10^n) for n==0, 1, … is given by 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, …

Source :

Blog Stats

  • 71,043 hits
August 2020

Top Clicks

  • None