Prizes & Awards
My Profile
Active Members
TodayLast 7 Days
more...
|
Resources » Articles » .NET Framework »
Few more sample interview questions
|
How big is the datatype int in .NET? 32 bits. How big is the char? 16 bits (Unicode). How do you initiate a string without escaping each backslash? Put an @ sign in front of the double-quoted string. What are valid signatures for the Main function? public static void Main() public static int Main() public static void Main( string[] args ) public static int Main(string[] args ) Does Main() always have to be public? No. How do you initialize a two-dimensional array that you don’t know the dimensions of? int [, ] myArray; //declaration myArray= new int [5, 8]; //actual initialization What’s the access level of the visibility type internal? Current assembly. What’s the difference between struct and class in C#? Structs cannot be inherited. Structs are passed by value, not by reference. Struct is stored on the stack, not the heap. Explain encapsulation. The implementation is hidden, the interface is exposed. What data type should you use if you want an 8-bit value that’s signed? sbyte. Speaking of Boolean data types, what’s different between C# and C/C++? There’s no conversion between 0 and false, as well as any other number and true, like in C/C++. Where are the value-type variables allocated in the computer RAM? Stack. Where do the reference-type variables go in the RAM? The references go on the stack, while the objects themselves go on the heap. However, in reality things are more elaborate. What is the difference between the value-type variables and reference-type variables in terms of garbage collection? The value-type variables are not garbage-collected, they just fall off the stack when they fall out of scope, the reference-type objects are picked up by GC when their references go null. How do you convert a string into an integer in .NET? Int32.Parse(string), Convert.ToInt32() How do you box a primitive data type variable? Initialize an object with its value, pass an object, cast it to an object Why do you need to box a primitive variable? To pass it by reference or apply a method that an object supports, but primitive doesn’t. What’s the difference between Java and .NET garbage collectors? Sun left the implementation of a specific garbage collector up to the JRE developer, so their performance varies widely, depending on whose JRE you’re using. Microsoft standardized on their garbage collection. How do you enforce garbage collection in .NET? System.GC.Collect(); Can you declare a C++ type destructor in C# like ~MyClass()? Yes, but what’s the point, since it will call Finalize(), and Finalize() has no guarantees when the memory will be cleaned up, plus, it introduces additional load on the garbage collector. The only time the finalizer should be implemented, is when you’re dealing with unmanaged code. What’s different about namespace declaration when comparing that to package declaration in Java? No semicolon. Package declarations also have to be the first thing within the file, can’t be nested, and affect all classes within the file. What’s the difference between const and readonly? You can initialize readonly variables to some runtime values. Let’s say your program uses current date and time as one of the values that won’t change. This way you declare
public readonly string DateT = new DateTime().ToString(). Can you create enumerated data types in C#? Yes. What’s different about switch statements in C# as compared to C++? No fall-throughs allowed. What happens when you encounter a continue statement inside the for loop? The code for the rest of the loop is ignored, the control is transferred back to the beginning of the loop. Is goto statement supported in C#? How about Java? Gotos are supported in C#to the fullest. In Java goto is a reserved keyword that provides absolutely no functionality. Describe the compilation process for .NET code? Source code is compiled and run in the .NET Framework using a two-stage process. First, source code is compiled to Microsoft intermediate language (MSIL) code using a .NET Framework-compatible compiler, such as that for Visual Basic .NET or Visual C#. Second, MSIL code is compiled to native code. Name any 2 of the 4 .NET authentification methods. ASP.NET, in conjunction with Microsoft Internet Information Services (IIS), can authenticate user credentials such as names and passwords using any of the following authentication methods:
Windows: Basic, digest, or Integrated Windows Authentication (NTLM or Kerberos). Microsoft Passport authentication Forms authentication Client Certificate authentication How do you turn off SessionState in the web.config file? In the system.web section of web.config, you should locate the httpmodule tag and you simply disable session by doing a remove tag with attribute name set to session.
CodeBehind is relevant to Visual Studio.NET only. What’s a bubbled event? When you have a complex control, likeDataGrid, writing an event processing routine for each object (cell, button,row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of itsconstituents. Suppose you want a certain ASP.NET function executed on MouseOver overa certain button. Where do you add an event handler? It’s the Attributesproperty, the Add function inside that property. So
btnSubmit.Attributes.Add("onMouseOver","someClientCode();")A simple"Javascript:ClientCode();” in the button control of the .aspx page will attach the handler (javascript function)to the onmouseover event.
What data type does the RangeValidator control support? Integer,String and Date. Where would you use an iHTTPModule, and what are the limitations of any approach you might take in implementing one? One of ASP.NET’s most useful features is the extensibility of the HTTP pipeline, the path that data takes between client and server. You can use them to extend your ASP.NET applications by adding pre- and post-processing to each HTTP request coming into your application. For example, if you wanted custom authentication facilities for your application, the best technique would be to intercept the request when it comes in and process the request in a custom HTTP module. Explain what a diffgram is, and a good use for one? A DiffGram is an XML format that is used to identify current and original versions of data elements. The DataSet uses the DiffGram format to load and persist its contents, and to serialize its contents for transport across a network connection. When a DataSet is written as a DiffGram, it populates the DiffGram with all the necessary information to accurately recreate the contents, though not the schema, of the DataSet, including column values from both the Original and Current row versions, row error information, and row order.
|
Responses
|
| Author: Ravi Makwana 30 Dec 2004 | Member Level: Bronze Points : 0 | These are few of those may b asked in interviews. However, effort is appreciable.
Regards,
|
|