Blog Home  Home Feed your aggregator (RSS 2.0)  
Software Code Help - InterviewQuestionNet
Blog
 
# Friday, January 22, 2010

a) PRE JIT : It Compiles complete source code to native caode In a single Compilation.

b) ECONO JIT : It compiles only those methods that are called at Runtime.

c) NORMAL JIT : It compiles only those methods that are called at Runtime and are stored in cache.

Friday, January 22, 2010 5:48:19 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

Association represents the ability of one instance to send a message to another instance. This is typically implemented with a pointer or reference instance variable, although it might also be implemented as a method argument, or the creation of a local variable.

Aggregation is the typical whole/part relationship. This is exactly the same as an association with the exception that instances cannot have cyclic aggregation relationships (i.e. a part cannot contain its whole).
The fact that this is aggregation means that the instances of Node cannot form a cycle. Thus, this is a Tree of Nodes not a graph of Nodes.


Composition is exactly like Aggregation except that the lifetime of the 'part' is controlled by the 'whole'. This control may be direct or transitive. That is, the 'whole' may take direct responsibility for creating or destroying the 'part', or it may accept an already created part, and later pass it on to some other whole that assumes responsibility for it.

Friday, January 22, 2010 5:45:21 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 
# Wednesday, January 20, 2010

In software engineering (or computer science), a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Algorithms are not thought of as design patterns, since they solve computational problems rather than design problems.

 

Design patterns can be classified in terms of the underlying problem they solve.

 

 

  Creational Patterns -- concern the process of object creation.

  Abstract Factory

Provide an interface for creating families of related or dependent objects without specifying their concrete classes.

 

 

  Builder

 Separates the construction of a complex object from its representation so that several different representations can be created, depending on the needs of the program.

 

  Factory Method

Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation

 

  Prototype

The Prototype pattern starts with an instantiated class and copies or clones it to make new instances. These instances can then be further tailored using their public methods.

 

  Singleton

The Singleton pattern is a class of which there can be no more than one instance. It provides a single global point of access to that instance.

 

 

  Structural Patterns -- describe how classes and objects can be combined to form larger structures.

  Adapter

Convert the interface of a class into another interface clients expect.

Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.

 

  Bridge

Decouple an abstraction from its implementation so that the two can vary independently.

 

  Composite

Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and Compositions of objects uniformly.

 

  Decorator

Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.

 

  Facade

Provide a unified interface to a set of interfaces in a subsystem. Façade defines a higher-level interface that makes the subsystem easier to use.

 

  Flyweight

Use sharing to support large numbers of fine-grained objects efficiently.

  Proxy

Provide a surrogate or placeholder for another object to control access

to it.

 

  Behavioral Patterns -- characterize the ways in which classes or objects interact and distribute responsibility

  Chain of Resp.

Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.

 

  Command

Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.

 

  Interpreter

Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.

 

  Iterator

Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.

 

  Mediator

Define an object that encapsulates how a set of objects interact.

Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.

 

  Memento

Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later.

 

  Observer

Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

 

  State

Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.

 

  Strategy

Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.

 

  Template Method

  Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.

 

  Visitor

  Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.

 

 

Wednesday, January 20, 2010 6:48:52 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 
# Thursday, January 14, 2010

There are three levels of data modeling. They are conceptual, logical, and physical. This section will explain the difference among the three, the order with which each one is created, and how to go from one level to the other.

Conceptual Data Model

Features of conceptual data model include:

  • Includes the important entities and the relationships among them.
  • No attribute is specified.
  • No primary key is specified.

At this level, the data modeler attempts to identify the highest-level relationships among the different entities.

Logical Data Model

Features of logical data model include:

  • Includes all entities and relationships among them.
  • All attributes for each entity are specified.
  • The primary key for each entity specified.
  • Foreign keys (keys identifying the relationship between different entities) are specified.
  • Normalization occurs at this level.

At this level, the data modeler attempts to describe the data in as much detail as possible, without regard to how they will be physically implemented in the database.

In data warehousing, it is common for the conceptual data model and the logical data model to be combined into a single step (deliverable).

The steps for designing the logical data model are as follows:

  1. Identify all entities.
  2. Specify primary keys for all entities.
  3. Find the relationships between different entities.
  4. Find all attributes for each entity.
  5. Resolve many-to-many relationships.
  6. Normalization.

Physical Data Model

Features of physical data model include:

  • Specification all tables and columns.
  • Foreign keys are used to identify relationships between tables.
  • Denormalization may occur based on user requirements.
  • Physical considerations may cause the physical data model to be quite different from the logical data model.

At this level, the data modeler will specify how the logical data model will be realized in the database schema.

The steps for physical data model design are as follows:

  1. Convert entities into tables.
  2. Convert relationships into foreign keys.
  3. Convert attributes into columns.
  4. Modify the physical data model based on physical constraints / requirements.
Thursday, January 14, 2010 5:56:21 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 
# Monday, January 04, 2010

A private constructor is a special instance constructor. It is commonly used in classes that contain static members only. If a class has one or more private constructors and no public constructors, then other classes (except nested classes) are not allowed to create instances of this class.

Monday, January 04, 2010 5:43:02 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 
# Tuesday, December 29, 2009

Serialization is the process of converting an object into a stream of bytes. Deserialization is the opposite process of creating an object from a stream of bytes. Serialization/Deserialization is mostly used to transport objects (e.g. during remoting), or to persist objects (e.g. to a file or database).

There are two separate mechanisms provided by the .NET class library - XmlSerializer and SoapFormatter/BinaryFormatter. Microsoft uses XmlSerializer for Web Services, and uses SoapFormatter/BinaryFormatter for remoting. Both are available for use in your own code.

Tuesday, December 29, 2009 11:06:42 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

An AppDomain can be thought of as a lightweight process. Multiple AppDomains can exist inside a Win32 process. The primary purpose of the AppDomain is to isolate an application from other applications.

Win32 processes provide isolation by having distinct memory address spaces. This is effective, but it is expensive and doesn't scale well. The .NET runtime enforces AppDomain isolation by keeping control over the use of memory - all memory in the AppDomain is managed by the .NET runtime, so the runtime can ensure that AppDomains do not access each other's memory.

Tuesday, December 29, 2009 11:05:06 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 
  • ASP.NET based Web services can only be accessed over HTTP. .NET Remoting can be used across any protocol.
  • Web services work in a stateless environment where each request results in a new object created to service the request. .NET Remoting supports state management options and can correlate multiple calls from the same client and support callbacks.
  • Web services serialize objects through XML contained in the SOAP messages and can thus only handle items that can be fully expressed in XML. .NET Remoting relies on the existence of the common language runtime assemblies that contain information about data types. This limits the information that must be passed about an object and allows objects to be passed by value or by reference.
  • Web services support interoperability across platforms and are good for heterogeneous environments. .NET Remoting requires the clients be built using .NET, or another framework that supports .NET Remoting, which means a homogeneous environment.
Tuesday, December 29, 2009 9:28:24 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

Multithreading also comes with disadvantages. The biggest is that it can lead to vastly more complex programs. Having multiple threads does not in itself create complexity; it's the interaction between the threads that creates complexity. This applies whether or not the interaction is intentional, and can result long development cycles, as well as an ongoing susceptibility to intermittent and non-reproducable bugs. For this reason, it pays to keep such interaction in a multi-threaded design simple – or not use multithreading at all – unless you have a peculiar penchant for re-writing and debugging!

Multithreading also comes with a resource and CPU cost in allocating and switching threads if used excessively. In particular, when heavy disk I/O is involved, it can be faster to have just one or two workers thread performing tasks in sequence, rather than having a multitude of threads each executing a task at the same time. Later we describe how to implement a Producer/Consumer queue, which provides just this functionality.

Tuesday, December 29, 2009 4:33:30 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

All threads within a single application are logically contained within a process – the operating system unit in which an application runs.

Threads have certain similarities to processes – for instance, processes are typically time-sliced with other processes running on the computer in much the same way as threads within a single C# application. The key difference is that processes are fully isolated from each other; threads share (heap) memory with other threads running in the same application. This is what makes threads useful: one thread can be fetching data in the background, while another thread is
displaying the data as it arrives.

Tuesday, December 29, 2009 3:56:31 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

Multithreading is managed internally by a thread scheduler, a function the CLR typically delegates to the operating system. A thread scheduler ensures all active threads are allocated appropriate execution time, and that threads that are waiting or blocked – for instance – on an exclusive lock, or on user input – do not consume CPU time.

On a single-processor computer, a thread scheduler performs time-slicing – rapidly switching execution between each of the active threads.

On a multi-processor computer, multithreading is implemented with a mixture of time-slicing and genuine concurrency – where different threads run code simultaneously on different CPUs. It's almost certain there will still be some time-slicing, because of the operating system's need to service its own threads – as well as those of other applications.

A thread is said to be preempted when its execution is interrupted due to an external factor such as time-slicing. In most situations, a thread has no control over when and where it's preempted.

Tuesday, December 29, 2009 3:55:04 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 
# Tuesday, December 22, 2009

In an interface class, all methods are abstract - there is no implementation. 

In an abstract class some methods can be concrete.  In an interface class, no accessibility modifiers are allowed. 

An abstract class may have accessibility modifiers. 
 

Tuesday, December 22, 2009 5:54:55 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

Yes.  .NET does support multiple interfaces. 

Tuesday, December 22, 2009 5:53:27 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

They all must be public, and are therefore public by default. 

Tuesday, December 22, 2009 5:53:01 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes. 

Tuesday, December 22, 2009 5:52:30 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

A class that cannot be instantiated.  An abstract class is a class that must be inherited and have the methods overridden.  An abstract class is essentially a blueprint for a class  with or without implementation. 

Tuesday, December 22, 2009 5:50:36 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

Yes.  Just leave the class public and make the method sealed. 

Tuesday, December 22, 2009 5:49:19 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

Yes.  The keyword “sealed” will prevent the class from being inherited. 

Tuesday, December 22, 2009 5:48:26 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

The data value may not be changed.  Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory. 

System.String is immutable.  System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed. 

Tuesday, December 22, 2009 5:47:19 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

It is available to classes that are within the same assembly and derived from the specified base class. 

Tuesday, December 22, 2009 5:45:42 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

Yes, but they are not accessible.  Although they are not visible or accessible via the class interface, they are inherited. 

Tuesday, December 22, 2009 5:44:40 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

No

Tuesday, December 22, 2009 5:43:27 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array.  The CopyTo() method copies the elements into another existing array.  Both perform a shallow copy.  A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array.  A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object.

Tuesday, December 22, 2009 5:42:04 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

Channels represent the objects that transfer the other serialized objects from one application domain to another and from one computer to another, as well as one process to another on the same box. A channel must exist before an object can be transferred. 

A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end. 

Tuesday, December 22, 2009 5:39:09 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

It’s a fake copy of the server object that resides on the client side and behaves as if it was the server. It handles the communication between real server object and the client object. This process is also known as marshaling

Tuesday, December 22, 2009 5:38:02 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

Remoting is a more efficient communication exchange when you can control both ends of the application involved in the communication process.  Web Services provide an open-protocol-based exchange of informaion. 

Web Services are best when you need to communicate with an external organization or another (non-.NET) technology.

Tuesday, December 22, 2009 5:36:45 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 
# Monday, December 21, 2009

It’s an application that’s running and had been allocated memory.

A process is an instance of a running application. An application is an executable on the hard drive or network. There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application. 

Monday, December 21, 2009 5:35:37 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 
# Wednesday, December 02, 2009

Pascal casing means that the first letter of each word in a name is capitalized: EmployeeSalary, OrderDetails, PassengerName.

Camel casing is similar to Pascal casing, except that the first letter of the first word in the name is not capitalized:

Wednesday, December 02, 2009 9:35:06 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

The statements that allow us to jump immediately to another line in the program.

There are four jump statement.

  1. Goto
  2. Continue
  3. Break
  4. Return
Wednesday, December 02, 2009 9:17:33 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

constant is a variable whose value cannot be changed throughout its lifetime:

const int abc = 5; // This value cannot be changed

Constants have the following characteristics:

  1. They must be initialized when they are declared, and once a value has been assigned, it can never be overwritten.
  2. The value of a constant must be computable at compile time. Therefore, we can’t initialize a constant with a value taken from a variable. If you need to do this, you will need to use a readonly field.
  3. Constants are always implicitly static. However, notice that we don’t have to include the static modifier in the constant declaration.
Wednesday, December 02, 2009 9:14:20 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

The scope of a variable is the region of code from which the variable can be accessed. In general, the scope is determined by the following rules:

  • A field (also known as a member variable) of a class is in scope for as long as its containing class is in scope (this is the same as for C++, Java, and VB).
  • local variable is in scope until a closing brace indicates the end of the block statement or method in which it was declared.
  • A local variable that is declared in a for, while, or similar statement is in scope in the body of that loop.

Wednesday, December 02, 2009 9:07:39 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

An assembly is the logical unit that contains compiled code targeted at the .NET Framework.

An assembly is completely self-describing, and is a logical rather than a physical unit, which means that it can be stored across more than one file (indeed dynamic assemblies are stored in memory, not on file at all). If an assembly is stored in more than one file, then there will be one main file that contains the entry point and describes the other files in the assembly.

Note that the same assembly structure is used for both executable code and library code. The only real difference is that an executable assembly contains a main program entry point, whereas a library assembly doesn’t.

Assemblies come in two types: shared and private assemblies.


Private Assembly :
------------------
Private assemblies are the simplest type. They normally ship with software and are intended to be used only with that software.

The system guarantees that private assemblies will not be used by other software, because an application may only load private assemblies that are located in the same folder that the main executable is loaded in, or in a subfolder of it.

Shared Assembly :
-----------------
Shared assemblies are intended to be common libraries that any other application can use. Because any other software can access a shared assembly, more precautions need to be taken against the following risks:

  •  Name collisions, where another company’s shared assembly implements types that have the same names as those in your shared assembly. Because client code can theoretically have access to both assemblies simultaneously, this could be a serious problem.
  • The risk of an assembly being overwritten by a different version of the same assembly—the new version being incompatible with some existing client code.
Wednesday, December 02, 2009 8:44:44 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 

Language Interoperability is that classes written in one language should be able to talk directly to classes written in another language.

  • A class written in one language can inherit from a class written in another language.

  • The class can contain an instance of another class, no matter what the languages of the two classes are.

  • An object can directly call methods against another object written in another language.

  • Objects (or references to objects) can be passed around between methods.

  • When calling methods between languages we can step between the method calls in the debugger, even when this means stepping between source code written in different languages.

 

Wednesday, December 02, 2009 5:57:15 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 
# Wednesday, November 11, 2009

STA (Single Threaded Apartment) is basically the concept that only one thread will interact with your code at a time. Calls into your apartment are marshaled via windows messages (using a non-visible) window. This allows calls to be queued and wait for operations to complete.

MTA (Multi Threaded Apartment) is where many threads can all operate at the same time and the onus is on you as the developer to handle the thread security.

Wednesday, November 11, 2009 4:34:46 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Interview Question .Net  | 
# Tuesday, October 20, 2009

The .NET Framework uses role-based security and code-based security mechanisms for protecting resources and code from unauthorized use. Click each security mechanism to learn more:

Role Based Security
--------------------
A role-based security model uses authenticated identity information about the user to determine which computing resources the user is authorized to use. The authenticated identity information typically consists of the user’s logon and the roles that are associated with the user. Role-based security in the .NET Framework also allows developers to use Microsoft Windows® user and group information, or to perform custom authentication and authorization by using generic principals and identities.

A role defines a group of related users of an application. For example, a banking application may impose limits on the withdrawal amounts that can be transacted, based on role. In this scenario, tellers may be authorized to process withdrawals that are less than a specified amount, whereas managers may be allowed to process withdrawals above the amount specified. Role-based security in the .NET Framework extensively uses two concepts: identities and principals.

An identity encapsulates the user’s logon name.
A principal encapsulates the membership information of the user’s role.
The runtime provides functionality to perform authorization checks by using identity and principal-related objects directly, or by using imperative or declarative permission checks. .NET Framework role-based security supports authorization by making information about the user, which is constructed from an associated identity, available to the current thread. The identity can be based on a Windows account, or it can be a custom identity unrelated to a Windows account.

Code based Security
-------------------
Code access security is a mechanism provided by the CLR to examine and enforce permissions granted by security policy. To prevent unintended code paths from exposing a security vulnerability, all callers on the call stack must be granted the necessary permissions.

Every application that targets the CLR must interact with its security system. When an application runs, it is automatically evaluated and given a set of permissions by the CLR. Depending on the permissions that the application receives, it either runs properly or generates a security exception. The local security settings on a particular computer ultimately decide which permissions the code receives.

 

Tuesday, October 20, 2009 7:37:22 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question .Net  | 
# Wednesday, October 07, 2009

A shallow copy creates a new instance of the same type as the original object, and then copies the non-static fields of the original object. If the field is a value type, a bit-by-bit copy of the field is performed. If the field is a reference type, the reference is copied but the referred object is not; therefore, the reference in the original object and the reference in the clone point to the same object.

A deep copy of an object duplicates everything directly or indirectly referenced by the fields in the object

Wednesday, October 07, 2009 7:19:22 AM (GMT Daylight Time, UTC+01:00)  #    Comments [1]   C# | Interview Question .Net  | 
# Wednesday, July 08, 2009

It define a set of feature that all .net compatible languages should support.

Wednesday, July 08, 2009 7:41:02 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question .Net  | 
Copyright © 2010 SoftwareCodeHelp. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: