Monday, August 19, 2013

C# .Net Interview Questions Volume-II


1.      What is GAC? What are the steps to create an assembly and add it to the GAC?

2.      The global assembly cache (GAC) is a machine-wide code cache that stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to.

3.      Steps

4.      - Create a strong name using sn.exe tool eg: sn -k mykey.snk

5.      - in AssemblyInfo.cs, add the strong name eg: [assembly: AssemblyKeyFile("mykey.snk")]

6.      - recompile project, and then install it to GAC in two ways :

7.               drag & drop it to assembly folder (C:\WINDOWS\assembly OR C:\WINNT\assembly) (shfusion.dll tool)

8.               gacutil -i abc.dll

9.      What is the caspol.exe tool used for?

10.  The caspol tool grants and modifies permissions to code groups at the user policy, machine policy, and enterprise policy levels.

11.  What is a garbage collector?

12.  A garbage collector performs periodic checks on the managed heap to identify objects that are no longer required by the program and removes them from memory.

13.  What are generations and how are they used by the garbage collector?

14.  Generations are the division of objects on the managed heap used by the garbage collector. This mechanism allows the garbage collector to perform highly optimized garbage collection. The unreachable objects are placed in generation 0, the reachable objects are placed in generation 1, and the objects that survive the collection process are promoted to higher generations.

15.  What is Ilasm.exe used for?

16.  Ilasm.exe is a tool that generates PE files from MSIL code. You can run the resulting executable to determine whether the MSIL code performs as expected.

17.  What is Ildasm.exe used for?

18.  Ildasm.exe is a tool that takes a PE file containing the MSIL code as a parameter and creates a text file that contains managed code.

19.  What is the ResGen.exe tool used for?

20.  ResGen.exe is a tool that is used to convert resource files in the form of .txt or .resx files to common language runtime binary .resources files that can be compiled into satellite assemblies.

General .NET Interview Questions

21.  Rating: 108 user(s) have rated this article Average rating: 4.5
Posted by:
Suprotim Agarwal, on 8/12/2007, in category "Interview Questions"
Views: this article has been read 126298 times

22.  Abstract: The General .NET Interview Questions consists the most frequently asked questions in .NET. This list of 100+ questions guage your familiarity with the .NET platform. The q&a have been collected over a period of time using MSDN and other similar sites.

23.  What is an application server?

24.  As defined in Wikipedia, an application server is a software engine that delivers applications to client computers or devices. The application server runs your server code. Some well known application servers are IIS (Microsoft), WebLogic Server (BEA), JBoss (Red Hat), WebSphere (IBM).

25.  Compare C# and VB.NET

26.  A detailed comparison can be found over here.

27.  What is a base class and derived class?

28.  A class is a template for creating an object. The class from which other classes derive fundamental functionality is called a base class. For e.g. If Class Y derives from Class X, then Class X is a base class.

29.   

30.  The class which derives functionality from a base class is called a derived class. If Class Y derives from Class X, then Class Y is a derived class.

31.  What is an extender class?

32.  An extender class allows you to extend the functionality of an existing control. It is used in Windows forms applications to add properties to controls.

33.  A demonstration of extender classes can be found over here.

34.  What is inheritance?

35.  Inheritance represents the relationship between two classes where one type derives functionality from a second type and then extends it by adding new methods, properties, events, fields and constants.

36.   

37.  C# support two types of inheritance:

38.           Implementation inheritance

39.           Interface inheritance

40.  What is implementation and interface inheritance?

41.  When a class (type) is derived from another class(type) such that it inherits all the members of the base type it is Implementation Inheritance.

42.  When a type (class or a struct) inherits only the signatures of the functions from another type it is Interface Inheritance.

43.  In general Classes can be derived from another class, hence support Implementation inheritance. At the same time Classes can also be derived from one or more interfaces. Hence they support Interface inheritance.

44.  Source: Exforsys.

45.  What is inheritance hierarchy?

46.  The class which derives functionality from a base class is called a derived class. A derived class can also act as a base class for another class. Thus it is possible to create a tree-like structure that illustrates the relationship between all related classes. This structure is known as the inheritance hierarchy.

47.  How do you prevent a class from being inherited?

48.  In VB.NET you use the NotInheritable modifier to prevent programmers from using the class as a base class. In C#, use the sealed keyword.

49.  When should you use inheritance?

50.  Read this.

51.  Define Overriding?

52.  Overriding is a concept where a method in a derived class uses the same name, return type, and arguments as a method in its base class. In other words, if the derived class contains its own implementation of the method rather than using the method in the base class, the process is called overriding.

53.  Can you use multiple inheritance in .NET?

54.  .NET supports only single inheritance. However the purpose is accomplished using multiple interfaces.

55.  Why don’t we have multiple inheritance in .NET?

56.  There are several reasons for this. In simple words, the efforts are more, benefits are less. Different languages have different implementation requirements of multiple inheritance. So in order to implement multiple inheritance, we need to study the implementation aspects of all the languages that are CLR compliant and then implement a common methodology of implementing it. This is too much of efforts. Moreover multiple interface inheritance very much covers the benefits that multiple inheritance has.

57.  What is an Interface?

58.  An interface is a standard or contract that contains only the signatures of methods or events. The implementation is done in the class that inherits from this interface. Interfaces are primarily used to set a common standard or contract.

59.  When should you use abstract class vs interface or What is the difference between an abstract class and interface?

60.  I would suggest you to read this. There is a good comparison given over here.

61.  What are events and delegates?

62.  An event is a message sent by a control to notify the occurrence of an action. However it is not known which object receives the event. For this reason, .NET provides a special type called Delegate which acts as an intermediary between the sender object and receiver object.

63.  What is business logic?

64.  It is the functionality which handles the exchange of information between database and a user interface.

65.  What is a component?

66.  Component is a group of logically related classes and methods. A component is a class that implements the IComponent interface or uses a class that implements IComponent interface.

67.  What is a control?

68.  A control is a component that provides user-interface (UI) capabilities.

69.  What are the differences between a control and a component?

70.  The differences can be studied over here.

71.  What are design patterns?

72.  Design patterns are common solutions to common design problems.

73.  What is a connection pool?

74.  A connection pool is a ‘collection of connections’ which are shared between the clients requesting one. Once the connection is closed, it returns back to the pool. This allows the connections to be reused.

75.  What is a flat file?

76.  A flat file is the name given to text, which can be read or written only sequentially.

77.  What are functional and non-functional requirements?

78.  Functional requirements defines the behavior of a system whereas non-functional requirements specify how the system should behave; in other words they specify the quality requirements and judge the behavior of a system.

79.  E.g.

80.  Functional - Display a chart which shows the maximum number of products sold in a region.

81.  Non-functional – The data presented in the chart must be updated every 5 minutes.

82.  What is the global assembly cache (GAC)?

83.  GAC is a machine-wide cache of assemblies that allows .NET applications to share libraries. GAC solves some of the problems associated with dll’s (DLL Hell).

84.  What is a stack? What is a heap? Give the differences between the two?

85.  Stack is a place in the memory where value types are stored. Heap is a place in the memory where the reference types are stored.

86.   

87.  Check this link for the differences.

88.  What is instrumentation?

89.  It is the ability to monitor an application so that information about the application’s progress, performance and status can be captured and reported.

90.  What is code review?

91.  The process of  examining the source code generally through a peer, to verify it against best practices.

92.  What is logging?

93.  Logging is the process of persisting information about the status of an application.

94.  What are mock-ups?

95.  Mock-ups are a set of designs in the form of screens, diagrams, snapshots etc., that helps verify the design and acquire feedback about the application’s requirements and use cases, at an early stage of the design process.

96.  What is a Form?

97.  A form is a representation of any window displayed in your application. Form can be used to create standard, borderless, floating, modal windows.

98.  What is a multiple-document interface(MDI)?

99.  A user interface container that enables a user to work with more than one document at a time. E.g. Microsoft Excel.

100.                      What is a single-document interface (SDI) ?

101.                      A user interface that is created to manage graphical user interfaces and controls into single windows. E.g. Microsoft Word

102.                      What is BLOB ?

103.                      A BLOB (binary large object) is a large item such as an image or an exe  represented in binary form.

104.                      What is ClickOnce?

105.                      ClickOnce is a new deployment technology that allows you to create and publish self-updating applications that can be installed and run with minimal user interaction.

106.                      What is object role modeling (ORM) ?

107.                      It is a logical model for designing and querying database models. There are various ORM tools in the market like CaseTalk, Microsoft Visio for Enterprise Architects, Infagon etc.

108.                      What is a private assembly?

109.                      A private assembly is local to the installation directory of an application and is used only by that application.

110.                      What is a shared assembly?

111.                      A shared assembly is kept in the global assembly cache (GAC) and can be used by one or more applications on a machine.

112.                      What is the difference between user and custom controls?

113.                      User controls are easier to create whereas custom controls require extra effort.

114.                      User controls are used when the layout is static whereas custom controls are used in dynamic layouts.

115.                      A user control cannot be added to the toolbox whereas a custom control can be.

116.                      A separate copy of a user control is required in every application that uses it whereas since custom controls are stored in the GAC, only a single copy can be used by all applications.

117.                      Where do custom controls reside?

118.                      In the global assembly cache (GAC).

119.                      What is a third-party control ?

120.                      A third-party control is one that is not created by the owners of a project. They are usually used to save time and resources and reuse the functionality developed by others (third-party).

121.                      What is a binary formatter?

122.                      Binary formatter is used to serialize and deserialize an object in binary format.

123.                      What is Boxing/Unboxing?

124.                      Boxing is used to convert value types to object.

125.                      E.g. int x = 1;

126.                      object obj = x ;

127.                      Unboxing is used to convert the object back to the value type.

128.                      E.g. int y = (int)obj;

129.                      Boxing/unboxing is quiet an expensive operation.

130.                      What is a COM Callable Wrapper (CCW)?

131.                      CCW is a wrapper created by the common language runtime(CLR) that enables COM components to access .NET objects.

132.                      What is a Runtime Callable Wrapper (RCW)?

133.                      RCW is a wrapper created by the common language runtime(CLR) to enable .NET components to call COM components.

134.                      What is a digital signature?

135.                      A digital signature is an electronic signature used to verify/gurantee the identity of the individual who is sending the message.

136.                      What is garbage collection?

137.                      Garbage collection is the process of managing the allocation and release of memory in your applications. Read this article for more information.

138.                      What is globalization?

139.                      Globalization is the process of customizing applications that support multiple cultures and regions.

140.                      What is localization?

141.                      Localization is the process of customizing applications that support a given culture and regions.

142.                      What is MIME?

143.                      The definition of MIME or Multipurpose Internet Mail Extensions as stated in MSDN is “MIME is a standard that can be used to include content of various types in a single message. MIME extends the Simple Mail Transfer Protocol (SMTP) format of mail messages to include multiple content, both textual and non-textual. Parts of the message may be images, audio, or text in different character sets. The MIME standard derives from RFCs such as 2821 and 2822”. Quoted from here.

Basic .NET, ASP.NET, OOPS and SQL Server Interview questions and answers.

·         What is IL code, CLR,CTS,GAC,GC?>

·         How can we do Assembly versioning?

·         can you explain how ASP.NET application life cycle and page life cycle events fire?

·         What is the problem with Functional Programming?

·         Can you define OOP and the 4 principles of OOP?

·         What are Classes and Objects?

·         What is Inheritance?

·         What is Polymorphism, overloading, overriding and virtual?

·         Can you explain encapsulation and abstraction?

·         What is an abstract class?

·         Define Interface & What is the diff. between abstract & interface?

·         What problem does Delegate Solve ?

·         What is a Multicast delegate ?

·         What are events and what's the difference between delegates and events?

·         How can we make Asynchronous method calls using delegates ?

·         What is a stack, Heap, Value types and Reference types ?

·         What is boxing and unboxing ?

·         Can you explain ASP.NET application and Page life cycle ?

·         What is Authentication, Authorization, Principal & Identity objects?

·         How can we do Inproc and outProc session management ?

·         How can we windows , forms and passport authentication and authorization in ASP.NET ?

·         In a parent child relationship which constructor fires first ?

 

WCF,WPF,Silverlight ,LINQ, Azure and EF 4.0 interview question and answers

·         What is SOA, Services and Messages ?

·         What is the difference between Service and Component?

·         What are basic steps to create a WCF service ?

·         What are endpoints, address, contracts and bindings?

·         What are various ways of hosting WCF service?

·         What is the difference of hosting a WCF service on IIS and Self hosting?

·         What is the difference between BasicHttpBinding and WsHttpBinding?

·         How can we do debugging and tracing in WCF?

·         Can you explain transactions in WCF (theory)?

·         How can we self host WCF service ?

·         What are the different ways of implementing WCF Security?

·         How can we implement SSL security on WCF(Transport Security)?

·         How can we implement transport security plus message security in WCF ?

·         How can we do WCF instancing ?

·         How Can we do WCF Concurency and throttling?

·         Can you explain the architecture of Silverlight ?

·         What are the basic things needed to make a silverlight application ?

·         How can we do transformations in SilverLight ?

·         Can you explain animation fundamentals in SilverLight?

·         What are the different layout methodologies in SilverLight?

·         Can you explain one way , two way and one time bindings?

·         How can we consume WCF service in SilverLight?

·         How can we connect databases using SilverLight?

·         What is LINQ and can you explain same with example?

·         Can you explain a simple example of LINQ to SQL?

·         How can we define relationships using LINQ to SQL?

·         How can we optimize LINQ relationships queries using ‘DataLoadOptions’?

·         Can we see a simple example of how we can do CRUD using LINQ to SQL?

·         How can we call a stored procedure using LINQ?

·         What is the need of WPF when we had GDI, GDI+ and DirectX?

·         Can you explain how we can make a simple WPF application?

·         Can you explain the three rendering modes i.e. Tier 0 , Tier 1 and Tier 2?

·         Can you explain the Architecture of WPF?

·         What is Azure?

·         Can you explain Azure Costing?

·         Can we see a simple Azure sample program?

·         What are the different steps to create a simple Worker application?

·         Can we understand Blobs in steps, Tables & Queues ?

·         Can we see a simple example for Azure tables?

·         What is Package and One click deploy(Deployment Part - 1) ?

·         What is Web.config transformation (Deployment Part-2)?

·         What is MEF and how can we implement the same?

·         How is MEF different from DIIOC?

·         Can you show us a simple implementation of MEF in Silverlight ?

Show Answers
Total Posts
Post Your Answers
Last Post
Does C# support multiple-inheritance?
1.No
2.Yes
15

jitendra kumar mpec
What is MSIL?
1.Multi Socket Interface Library 2.Microsoft Intermediate Language
3.Microsoft Interface Language
4.Microsoft Integer Long
9

praveen
Whict is true for C#?
1.C# supports interfaces.
2.C# also provides support for structs.
3.C# provides component-oriented features
4.All
5.None
6

RAJ
An assembly is>
1.A collection of files that appear to the programmer to be a single DLL or EXE.
2.properties of c#
3.events Of c#
4.declarative syntax of Java
4

jyoti
Which Of follwing is currect syntax?
1.class R4R
{
static void Main( )
{
System.Console.WriteLine("R4R");
}
}
 
2.class R4R
{
static void Main( )
{
System.out.WriteLine("R4R");
}
}
 
 
3.class R4R
{
static void Main( )
{
System.print.WriteLine("R4R");
}
}
 
 
4.class R4R
{
static void Main( )
{
System.Console.out("R4R");
}
}
 
5.class R4R
{
static void Main( )
{
System.Console.out("R4R");
}
}
6

Raja
What will output of following
 
class R4R
{
static void Main( )
{
/*
System.Console.WriteLine("R4R");
*/
}
}
1.No any output.
2.Compile time error.
3.Runtime erro
4 .None of above.
9

Navjyoti Sharma
What will output of following ?
using System.Console;
class R4R
{
static void Main( )
{
WriteLine("R4R");
}
}
 
1.            error CS0138
2.            R4R
3.            No any output
4.            None
5

Vinay Tyagi
Which of the follwing is true?
 
1.byte-->> 1(siz)-->>Byte(as int.net)-->> Unsigned (values 0-255).
2.char-->> 2-->> Char -->>Unicode-->> characters.
3.bool -->>1 -->>Boolean -->>true or false.
4.sbyte-->> 1 SByte-->> Signed -->>(values -128 to 127).
5.short-->>  2-->>  Int16-->>  Signed -->> short-->> values -32,768 to 32,767
3

Vishnu
class R4R
{
static void Main( )
{
short x;
int y = 500;
x = y;
System.Console.WriteLine("Output:{0}", x);
}
}
1.error
2.Output:500
3.Outpu:{500}
4.None
3

sarika mann
class R4R
{
static void Main( )
{
short s = 7;
System.Console.WriteLine("Initialized: {0}",s);
s = 5;
System.Console.WriteLine("After assignment: {0}",s);
}
}
1.            error
2.            2 Initialized:5
3.            After assignment:7
4.            both 2,3
5.            None
4

Vishnu
class R4R
{
static void Main( )
{
short s;
System.Console.WriteLine("Initialized: {0}",s);
s = 5;
System.Console.WriteLine("After assignment: {0}",s);
}
}
1.            error
2.            2 Initialized:5
3.            After assignment:7
4.            both 2,3
5.            None
2

sarika mann
Which of following is correct:
1. enum Day
{
Sunday= 01,
Monday= 02,
Tuesday= 03,
Wednesday=04,
Thursday= 05,
Friday= 06,
Saturday=07
}
 
2. Day enum
{
Sunday= 01,
Monday= 02,
Tuesday= 03,
Wednesday=04,
Thursday= 05,
Friday= 06,
Saturday=07
}
 
3. Day {
Sunday= 01,
Monday= 02,
Tuesday= 03,
Wednesday=04,
Thursday= 05,
Friday= 06,
Saturday=07
}
 
4.enumeration Day
{
Sunday= 01,
Monday= 02,
Tuesday= 03,
Wednesday=04,
Thursday= 05,
Friday= 06,
Saturday=07
}
1
11.03.10
Vikas
What is output of following :
class R4R
{
enum Day
{
Sunday= 01,
Monday= 02,
Tuesday= 03,
Wednesday=04,
Thursday= 05,
Friday= 06,
Saturday=07
}
static void Main( )
{
System.Console.WriteLine("First of Weak Day: {0}",
(int) Day.Sunday);
System.Console.WriteLine("Last of Weak Day: {0}",
(int) Day.Saturday);
}
}
 
1.            First of Weak Day:01
2.            Last of Weak Day:07
3.            1,2
4.            error
5.            None
3

Vishnu
Which of the following is true for string r4r = "R4R";
 
1.r4r is an object which store string R4R.
2.string is keyword in C#.
3.This syntax is wrong string is not any keyword in c#.
4.string used to store set of characters into any string type object.
1
11.03.10
Rahul
What is output of following :
class R4R
static void Main( )
{
Int string=0;
System.Console.WriteLine("Outpt: {0}",string++);
}
}
 
1.Outpt:0
2.Outpt:1
3.1,2
4.error
5.None
2

Vinay Tyagi
How many statements are into following code?
 
int x; x = 23;int y = x;
 
1.1
2.2
3.3
4.4
5.5
1
11.03.10
Rajesh Kumar
Choose correct one
1.int x;
2 x = 23;
3 int y = x;
4 int string=10;
 
1.1,2,3,4
2.1,2,3
3.1,3
4. None
5. All
4

Vishnu
using System;
class R4R
{
static void Main( )
{
int x = 10;
int y;
y = x++;
Console.WriteLine("After postfix: {0}, {1}", x,
y);
x = 20;
y = ++x;
Console.WriteLine("After prefix: {0}, {1}", x,
valueTwo);
}
}
 
1.After postfix: 10, 10
2.After prefix: 20, 20
3 both
4 none
1
11.03.10
Rahul
using System;
class R4R
{
static void Main( )
{
int x = 10;
int y;
y = x++;
Console.WriteLine("After postfix: {0}, {1}", x,
y);
x = 20;
y = ++x;
Console.WriteLine("After prefix: {0}, {1}", x,
valueTwo);
}
}
 
1.After postfix: 11, 10
2.After prefix: 21, 21
3 both
4 none
3

ajit dubey
using System;
class R4R
{
static void Main( )
{
int x = 10;
int y;
y = x++;
int xy = x > y ? x : y;
Console.WriteLine("output: {0}, {1},{2}", x,y,xy);
}
}
 
1. output: 10, 10,10
2. output: 11, 10,10
3. output: 11,10,11
4 none
How you can change the page title by changing the  using C#
 
1.void buttonSet_Click(Object sender, EventArgs earg)
{
Header.Title :Msg.Text;
}
2.void buttonSet_Click(Object sender, EventArgs earg)
{
Msg.Text= Header.Title;
}
 
3.void buttonSet_Click(Object sender, EventArgs earg)
{
Msg.Text: Header.Title;
}
 
4.None
5
05.02.11
xyz
Which is used to add event code(on C# Code) for TextBox control in Source view ( ASP.NET)
 
1.            MsgSent.Text = Msg.Text;
2.            MsgSent.Text = Msg.Text
3.            Both
4.            None

 

  1. Describe the difference between a Thread and a Process?
  2. What is a Windows Service and how does its lifecycle differ from a “standard” EXE?
  3. What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
  4. What is the difference between an EXE and a DLL?
  5. What is strong-typing versus weak-typing? Which is preferred? Why?
  6. What’s wrong with a line like this? DateTime.Parse(myString
  7. What are PDBs? Where must they be located for debugging to work?
  8. What is cyclomatic complexity and why is it important?
  9. Write a standard lock() plus double check to create a critical section around a variable access.
  10. What is FullTrust? Do GAC’ed assemblies have FullTrust?
  11. What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?
  12. What does this do? gacutil /l | find /i “about”
  13. What does this do? sn -t foo.dll
  14. What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
  15. Contrast OOP and SOA. What are tenets of each
  16. How does the XmlSerializer work? What ACL permissions does a process using it require?
  17. Why is catch(Exception) almost always a bad idea?
  18. What is the difference between Debug.Write and Trace.Write? When should each be used?
  19. What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
  20. Does JITting occur per-assembly or per-method? How does this affect the working set?
  21. Contrast the use of an abstract base class against an interface?
  22. What is the difference between a.Equals(b) and a == b?
  23. In the context of a comparison, what is object identity versus object equivalence?
  24. How would one do a deep copy in .NET?
  25. Explain current thinking around IClonable.
  26. What is boxing?
  27. Is string a value type or a reference type?
  28. Dipal Shah

Posted 11/20/2006 at 12:55 am | Permalink

Ans-1)

Process:
*Execution Context:
1)Program COunter(PC)
2)Stack Pointer
3)Data Register
*CODE
*DATA
*STACK
*Process :Unit Of allocation(Resource,priviliges etc)
*each process have one or more threads
*Inter process communication is expensive:need to context swith
*Secure:one process can not corrupt another process

Thread:
Execution Context:
1)program counter
2)stack pointer
3)Data register
*each thread belong to one process
*Unit of execution(Pc,sp etc)
*inter thread communication is chip:can use process memory and may not need to context switch
*not secure:a thread can write the memory used by the another thread

Ans-2)

  1. Dipal Shah

Posted 11/20/2006 at 4:13 am | Permalink

Ans-2)A windows service is an application that started when windows is booted and runs in background as long as windows running.it is very close concept of unix daeomn

Windows services lifecycle is managed by “Service Control Manager” which is responsible for starting and stopping the service and the applications do not have a user interface or produce any visual output, but “Standard executable” doesn’t require Control Manager and is directly related to the visual output

  1. Dipal Shah

Posted 11/20/2006 at 4:34 am | Permalink

ans-3)Well since most people are still not using a 64 bit operating system, we are going to keep this discussion limited to a 32bit OS. In the NT Flavor of operating systems, 4GB of memory is available to each process but it is split 50/50 with with the operating system.

So each process has 2GB of memory available for its private use. The other 2GB is used by the operating system, devices, graphics cards, etc.. Keep in mind, the 4GB/2GB size is regardless of how much RAM you have installed.

This would affect system design if you are creating an application that uses very large data structures or applications like mail servers, database management servers etc.. To address the need for more memory space, you can use a /3GB switch which then splits the memory usage from 50/50 to 75/25. Allowing your application to use 3GB of the 4GB available.

  1. Dipal Shah

Posted 11/22/2006 at 5:38 am | Permalink

ans-27) String is a refrence type.Value types differ from reference types in that variables of the value types directly contain their data, whereas variables of the reference types store references to objects. With reference types, it is possible for two variables to reference the same object, and thus possible for operations on one variable to affect the object referenced by the other variable. With value types, the variables each have their own copy of the data, and it is not possible for operations on one to affect the other

  1. Dipal Shah

Posted 11/22/2006 at 5:44 am | Permalink

ans-26)convert value types into refrence types is called boxing.
two types of boxing:
1)implicit boxing
2)explicit boxing

  1. Dipal Shah

Posted 11/22/2006 at 5:53 am | Permalink

ans-25)Icionable is preferable to using copying constructors because it is standardlised ans utilised by other portion of the ,net framework to generate object copies

  1. Dipal Shah

Posted 11/22/2006 at 6:23 am | Permalink

ans-24)implement icionable interface and define yr imlementation to execute deep copies of yr subobjects.alternatively serialize the object and deserialize the another object ,but this process is very slow comparable cloning interface.

  1. Dipal Shah

Posted 11/22/2006 at 6:33 am | Permalink

ans-23)

1) two objects are identical if they share same address in memory.two objects are equivalent if they are instances of the same type and every field of the first object matches the fields of another object.

2)object identical have only same instances.object equivalent have fields are same but the different instances only type are same.

  1. Dipal Shah

Posted 11/23/2006 at 2:14 am | Permalink

Ans-22)a==b is used for assifning.to check the refrence of two objects.

a.equals(b) is used for comparision.comparing of two objects

  1. Dipal Shah

Posted 11/23/2006 at 6:20 am | Permalink

ans-21)

Absteact class provides implementation for methods and properties.
Interfaces only provides required declaration.

In simple term all methods in an interface are abstract.In abstract class some methods are abstract

  1. Dipal Shah

Posted 11/23/2006 at 6:28 am | Permalink

Does JITting occur per-assembly or per-method? How does this affect the working set?

Ans-20)Jit occuring per method.since method which are not called are not compiled at all.this reduces the working set.

  1. Dipal Shah

Posted 11/23/2006 at 6:44 am | Permalink

ans-19)

In a debug build the complete symbolic debug information is emitted to help debug application and also the code optimization is not taken into account.

while in release build symbolic debug info is not emmited and the code execution is optimised.
because of the symbolic info is not include in release build,the size of the final executable is lesser than the debug executable.

  1. Dipal Shah

Posted 11/23/2006 at 7:19 am | Permalink

ans-18)

debug.write call would not be compiled when the debugsymbol is not defined.trace.write can be compiled.debug.write is for only yr debug builds.trace.write is for when you want it in release buildas well.

  1. Dipal Shah

Posted 11/25/2006 at 12:18 am | Permalink

Why is catch(Exception) almost always a bad idea?

ans-17)It’s a question of how your program is going to recover. Some exceptions are the fault of the program, which generally means the program should log the details and shut down.

Others are due to unexpected user input, connection problems, files not where expected and your program may be able to recover, for example ask the user where the missing file is.

It’s generally best to put a exception handler round the whole program, and every thread which may want to catch not just Exceptions but errors (like NullPointerException) and log the details. This is to field the unrecoverable

  1. kavitha reddy

Posted 11/16/2006 at 4:49 am | Permalink

how to display graph charts for polling results?

  1. kavitha reddy

Posted 11/16/2006 at 4:54 am | Permalink

Difference Between Machine.config and Web.config:

Machine.config->Configuration file for all the applications in the system.

Web.config->Config file for single application.

  1. Jay Bahuguna

Posted 11/17/2006 at 7:47 am | Permalink

The IClonable interface is needed when you want to provide clonable
functionality for a bunch of classes and don’t care what actually
implements the class.

1.      Clarifications: on the response to thread vs. process above. While not entirely incorrect, this answer is inadequate. Threads exist within a process. A process can contain multiple threads. The operating system contains multiple processes. A process is associated with a specific job object; this object is used to define the data structures required for a process to become executable. A process is executable because one of the threads that it contains is executable. When the process is selected for execution, the data structures are mapped for the CPU and execution begins on the executable thread.
The advantage of using threads is that slower operations, like network activity or disk I/O, can run in the background, while an event interface like the user interface can still be responsive for user commands.

  1. Praveen

Posted 1/8/2007 at 1:42 am | Permalink

what is web.config in .NET?, and what’s the main usage of it?

It is a configuration file for asp.net web applications. It is written in xml.

Inisde web.config file one can have:

Database connections
Session states
Error handling code
Security can also be enforced.

  1. Baliram Suryawanshi

Posted 1/20/2007 at 3:00 pm | Permalink

AS EJB technology enables rapid and simplified development of distributed, transactional, secure and portable applications based on Java technology
which technology is available in .Net?

  1. suneel-sunny

Posted 2/6/2007 at 6:23 am | Permalink

Hi,
Q) How can u say string as reference type?
A) The explanation comes here..

string one = “suneel”;
string two = one;
one = “sunny”;

Now both strings one and two having the same value i.e. sunny.

int x = 5;
int y = x;
x = 7;
Now integer x having the value of 7.Where as integer y having the value of 5.

Summary:
Reference Type: Another copy of data will be created. A reference will be added to the existing one.
Value type: Another copy of data will be created.

  1. sona Jha

Posted 2/23/2007 at 12:20 am | Permalink

Hi radhakrishnan,
Machine config:it sets the base configuration for all the .net assemblies running on the server
web config:This sets the base config for all the web app and override settings in machine configuration

  1. Chaud

Posted 4/12/2007 at 6:04 pm | Permalink

Q12:

gacutil /l searches the GAC for all items.

The “|” pipes the output of that command to the next command.

find /i “about” searches all files for the word “about” without regard to case.

The result is all items in the GAC are searched (case-insensitively) for the word “about”.

  1. Chaud

Posted 4/12/2007 at 6:59 pm | Permalink

13. What does this do? sn -t foo.dll

Displays the public key token of foo.dll. foo.dll must be strong-named.

Additionally, if -tp is used then the public key itself is also displayed.

  1. Srinivas Kolluru

Posted 5/4/2007 at 10:28 am | Permalink

Answer for 21. Wether to Choose VB.NET/C#.
Both the languages ar using same classes and namespaces. Once it compile and generates MSIL, there is no meaning of which language it was written.

But i observed that the no of lines in MSIL for the same code of C# is lesser compared to VB.net.

So in my opinion C3 might be faster than vb.net, as the no execution line will be less in C# for the same functionality

  1. Vandana

Posted 5/27/2007 at 12:20 pm | Permalink

What is FullTrust? Do GAC’ed assemblies have FullTrust?

When we write a code and place it any location, and run it from our local computer, the first thing the system does it to check in which zone the application is placed like Internet, Intranet, local etc. All zones receive certain trust levels. The permissions to run any assembly is based on its trust level. Under Full Trust level all assemblies can be run successfuly. All GAC asemblies have Full Trust as ever strong named assembly is Full Trust assembly.

  1. Sivakumar

Posted 6/5/2007 at 10:54 pm | Permalink

what is Boxing and Unboxing?
Boxing is an implicit conversion of a value type to the type object
int i = 123; // A value type
Object box = i // Boxing
——————————————————————————–
Unboxing is an explicit conversion from the type object to a value type
int i = 123; // A value type
Object box = i; // Boxing
int j = (int)box; // Unboxing


  1. H.Ashok

Posted 8/6/2007 at 9:47 am | Permalink

Diff -> Equals(), ==

Please see this example:-
using System;
class test
{
public static void Main()
{
string str1=”Microsoft”;
string str2=”Micorsoft”;
Console.WriteLine(”Equals() Method=” + str1.Equals(str2));
Console.WriteLine(”== Operator=” + str1==str2);
}
}

  1. Swati M

Posted 9/25/2007 at 12:44 pm | Permalink

What is the difference between a.Equals(b) and a == b?

a.Equals(b) is generally used to compare objects,reference type.
So a.Equals(b) gives a boolean result True if

  1. Pradeep

Posted 10/17/2007 at 3:40 am | Permalink

22. What is the difference between a.Equals(b) and a == b?

a.Equals(b) -> equality is defined as object equality; that is, whether the references refer to the same object.

a == b -> equality is defined as bitwise equality. The ValueType class supports value types.

ref:http://msdn2.microsoft.com/en-us/library/aa329861(VS.71).aspx

  1. Manju

Posted 12/3/2007 at 9:16 am | Permalink

what will happen if i remove web.config from my application. what action is not possible to perform if web.config is removed.

  1. Afzal Aziz

Posted 12/16/2007 at 10:44 am | Permalink

q (6) What’s wrong with a line like this? DateTime.Parse(myString)

Exactly there is nothing wrong with the above statement and can be especially when try validate whether the string is a valid Date.

But the above DateTime.Parse(myString), will even convert invalid date like 45-nov-77 into date of the previous century so validating whether the string is a valid Date using DateTime.Parse(myStrin) is not recommended. Use DateTime.ParseExact() instead.

  1. Ashutosh MAlvade

Posted 1/18/2008 at 4:55 am | Permalink

What is the difference between a.Equals(b) and a == b?

Dim a As Boolean = True
Dim c As Integer = 1
Dim s As String = “1″
s.Equals(c) check for type as well as value of variables and follwing condition fail
If s.Equals(c) Then
s = “ok”
End If
s=c not check for type of variables and execute follwing condotion
If s = c Then
s = “ok”
End If
If s.Equals(a) Then
s = “ok”
End If

  1. shiv

Posted 2/26/2008 at 12:31 pm | Permalink

TO change from “value type” to “reference type” is known as “Boxing”

  1. padma

Posted 4/22/2008 at 1:28 am | Permalink

What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?

The maximum amount of mem any single process on windows can address 4GB, 2 GB fo r the thread and & gb for the application.

What is the difference between an EXE and a DLL?

An EXE is portable and executable with a entry point but dll is not portable and executable since it has no entry point

What is strong-typing versus weak-typing? Which is preferred? Why?

strongly typed is nothing but the method that should support with the equal parametres ,ex, delegates

What is boxing?
converting value type into refernce type.

  1. Naresh Prakash

Posted 6/27/2008 at 9:54 pm | Permalink

24. Deep copy meaning that copy schema with data..

  1. Minhaj Mansuri

Posted 7/2/2008 at 12:49 am | Permalink

What is HashTable

  1. Minhaj Mansuri

Posted 7/2/2008 at 12:50 am | Permalink

What Is GAC

  1. Naresh Prakash

Posted 7/2/2008 at 2:00 pm | Permalink

HashTable, Collection of values with keys, in hashtable value not duplicate, find with values or with keys or with index… HastTable is very useful.

  1. Naresh Prakash

Posted 7/2/2008 at 2:06 pm | Permalink

GAC: Global assembly cache contains shared assemblies that are globally accessible to all .net application on the machine. Shared assembly is installed in the GAC.

  1. prasad

Posted 7/25/2008 at 1:16 pm | Permalink

What is the difference between a.Equals(b) and a == b?

Both are used for comparison..but a.Equals(b) will work even if data type of a and b is different..

To use a==b , you have to use same data type of a and b.

  1. rajendra

Posted 1/20/2009 at 4:31 am | Permalink

1)A process is an OS-level task or service. A thread runs “inside” a process and may be virtual or simulated. Generally speaking, threads share resources like memory, where processes each have their own separate memory area, and need to take more elaborate steps to share resources.
Another name for thread is “lightweight process” to distinguish it from the “heavyweight” system processes.

No comments:

Post a Comment