Monday, February 28, 2011

Intw Questions Part1


WCF
.Net 3.5

Safe/Unsafe code
=================
Unsafe code logic [Using unsafe keyword, C# code that makes low-level API calls, pointer arithmetic]
  • CLR is responsible for managing the execution of code compiled for the .NET platform. The code that satisfies the CLR at runtime in order to execute is reffered as Managed Code.
  • C# does not support pointers when creating managed code. Pointers are however both useful and necessary for some types of programming (such as system-level utilities) and C# does allow you to create and use pointers.
    • All pointer operations must be marked as unsafe since they execute outside the managed context.
 
Safe code logic [Fixed Keyword]- Prevent GC to move certain objects


Union All, Union, Minus in SQL
==============================

Sealed class
============
Prevent inheritance

Static Constructors
===================
A static constructor is used to initialize any static data. General constructors are termed as Instance constructors

Impersonation
=============
The term "Impersonation" in a programming context refers to a technique that executes the code under another user context than the user who originally started an application, i.e. the user context is temporarily changed once or multiple times during the execution of an application.

Service Contract and Operation Contract
=======================================
Operation contract is the name of the attribute which is applied to a method inside the interface of a WCF service

Service contract is the name of the attribute which is applied to an interface in a WCF service


Page life cycle
================
Preinit
init
load
loadPre-render
Unload

What’s a satellite assembly?
============================
 When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.

What’s the difference between System.String and System.StringBuilder classes?
==============================================================================
 System.String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed

Every time you use one of the methods in the System.String class, you create a new string object in memory, which requires a new allocation of space for that new object. In situations where you need to perform repeated modifications to a string, the overhead associated with creating a new String object can be costly. The System.Text.StringBuilder class can be used when you want to modify a string without creating a new object. For example, using the StringBuilder class can boost performance when concatenating many strings together in a loop

When you use a normal string and change it, the .net framework will destroy the current string in memory and create a new one somewhere else in the memory. With a stringbuilder the object isn't destr
oyed each time it's adapted

SingletonClass
================
The Singleton is class which only allows a single instance of itself to be created and usually gives access to the instace.

Access Specifier in C#
==================
1. Public: Any member declared public can be accessed from 
outside the class.

2. Private: it allows a class to hide its member variables 
and member functions from other class objects and function. 
Therefore, the private member of a class is not visible 
outside a class. if a member is declared private, only the 
functions of that class access the member.

3. Protected: This also allows a class to hide its member 
var. and member func. from other class objects and 
function, except the child class. it becomes important 
while implementing inheritance.

4. Internal: Internal member can be expose to other 
function and objects. it can be accessed from any class or 
method defined within the application in which the member 
is defined

5. Protected Internal: it's similar to Protected access 
specifier, it also allows a class to hide its member 
variables and member function to be accessed from other 
class objects and function, excepts child class, within the 
application. used while implementing inheritance.
 
Structure and class
====================
The only difference between a structure and a 
class is that all members in a class are private by default whereas they
 are public in a structure.