Dot Net Technical Interview Questions Set 3

Posted by , No Comments

dot-net61. What is a formatter?

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.

62. Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what are the trade-offs?

Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperable.

63. What’s SingleCall activation mode used for?

If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode.

64. What’s Singleton activation mode?

A single object is instantiated regardless of the number of clients accessing it. Lifetime of this object is determined by lifetime lease.

65. How do you define the lease of the object?

By implementing ILease interface when writing the class code.

66. Can you configure a .NET Remoting object via XML file?

Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.

67. How can you automatically generate interface for the remotable object in .NET with Microsoft tools?

Use the Soapsuds tool.

68. What is Delegation?

A delegate acts like a strongly type function pointer. Delegates can invoke the methods that they reference without making explicit calls to those methods.
Delegate is an entity that is entrusted with the task of representation, assign or passing on information. In code sense, it means a Delegate is entrusted with a Method to report information back to it when a certain task (which the Method expects) is accomplished outside the Method’s class.

69. What is “Microsoft Intermediate Language” (MSIL)?

A .NET programming language (C#, VB.NET, J# etc.) does not compile into executable code; instead it compiles into an intermediate code called Microsoft Intermediate Language (MSIL). As a programmer one need not worry about the syntax of MSIL – since our source code in automatically converted to MSIL. The MSIL code is then send to the CLR (Common Language Runtime) that converts the code to machine language, which is, then run on the host machine. MSIL is similar to Java Byte code. MSIL is the CPU-independent instruction set into which .NET Framework programs are compiled. It contains instructions for loading, storing, initializing, and calling methods on objects. Combined with metadata and the common type system, MSIL allows for true cross- language integration Prior to execution, MSIL is converted to machine code. It is not interpreted.

70. Differences between Datagrid, Datalist and Repeater?

1. Datagrid has paging while Datalist doesnt.
2. Datalist has a property called repeat. Direction = vertical/horizontal. (This is of great help in designing layouts). This is not there in Datagrid.
3. A repeater is used when more intimate control over html generation is required.
4. When only checkboxes/radiobuttons are repeatedly served then a checkboxlist or radiobuttonlist are used as they involve fewer overheads than a Datagrid.
The Repeater repeats a chunk of HTML you write, it has the least functionality of the three. DataList is the next step up from a Repeater; accept you have very little control over the HTML that the control renders. DataList is the first of the three controls that allow you Repeat-Columns horizontally or vertically. Finally, the DataGrid is the motherload. However, instead of working on a row-by-row basis, you’re working on a column-by-column basis. DataGrid caters to sorting and has basic paging for your disposal. Again you have little contro, over the HTML. NOTE: DataList and DataGrid both render as HTML tables by default. Out of the 3 controls, I use the Repeater the most due to its flexibility w/ HTML. Creating a Pagination scheme isn’t that hard, so I rarely if ever use a DataGrid.
Occasionally I like using a DataList because it allows me to easily list out my records in rows of three for instance.
I am constantly writing the drawing procedures with System.Drawing.Graphics, but having to use the try and dispose blocks is too time-consuming with

71. Graphics objects. Can I automate this?

Yes, the code
System.Drawing.Graphics canvas = new System.Drawing.Graphics();
try
{
//some code
}
finally
canvas.Dispose();

is functionally equivalent to

using (System.Drawing.Graphics canvas = new System.Drawing.Graphics())
{
//some code
} //canvas.Dispose() gets called automatically

72. How do you trigger the Paint event in System.Drawing?

Invalidate the current form, the OS will take care of repainting. The Update method forces the repaint.
With these events, why wouldn’t Microsoft combine Invalidate and Paint, so that you wouldn’t have to tell it to repaint, and then to force it to repaint?
Painting is the slowest thing the OS does, so usually telling it to repaint, but not forcing it allows for the process to take place in the background.

73. How can you assign an RGB color to a System.Drawing.Color object?

Call the static method FromArgb of this class and pass it the RGB values.

74. What class does Icon derive from? Isn’t it just a Bitmap with a wrapper name around it?

No, Icon lives in System.Drawing namespace. It’s not a Bitmap by default, and is treated separately by .NET. However, you can use ToBitmap method to get a valid Bitmap object from a valid Icon object.

75. Before in my VB app I would just load the icons from DLL. How can I load the icons provided by .NET dynamically?

By using System.Drawing.SystemIcons class, for example System.Drawing.SystemIcons.Warning produces an Icon with a warning sign in it.

76. When displaying fonts, what’s the difference between pixels, points and ems?

A pixel is the lowest-resolution dot the computer monitor supports. Its size depends on user’s settings and monitor size. A point is always 1/72 of an inch. An em is the number of pixels that it takes to display the letter M.

77. What is the difference between VB 6 and VB.NET?

Answer1
VB
1,Object-based Language
2,Doesnot support Threading
3,Not powerful Exception handling mechanism
4,Doesnot having support for the console based applications
5,Cannot use more than one version of com objects in vb application called DLL error
6,Doesnot support for the Disconnected data source.
VB.Net
1,Object-oriented Language
2,supports Threading
3,powerful Exception handling mechanism
4,having support for the console based applications
5,More than one version of dll is supported
6,supports the Disconnected data source by using Dataset class
Answer2
VB:
1. Object-based language
2. Does not support inheritance
3. ADO.Net does not give support for disconnected data architecture
4. No interoperability function
5. No support for threading
VB.Net
1. Object-Oriented Programming lanugage
2. ADO.Net gives support for disconnected data architecture
3. It provides interoperability
4. It uses managed code
5. supports threading
6. provides access to third-party controls like COM, DCOM
Answer2
1.The concept of the complete flow of execution of a program from start to finish: Visual Basic hides this aspect of programs from you, so that the only elements of a Visual Basic program you code are the event handlers and any methods in class modules. C# makes the complete program available to you as source code. The reason for this has to do with the fact that C# can be seen, philosophically, as next-generation C++. The roots of C++ go back to the 1960s and predate windowed user interfaces and sophisticated operating systems. C++ evolved as a low-level, closeto- the-machine, all-purpose language. To write GUI applications with C++ meant that you had to invoke the system calls to create and interact with the windowed forms. C# has been designed to build on this tradition while simplifying and modernizing C++, to combine the low-level performance benefits of C++ with the ease of coding in Visual Basic. Visual Basic, on the other hand, is designed specifically for rapid application development of Windows GUI applications. For this reason, in Visual Basic all the GUI boilerplate code is hidden, and all the Visual Basic programmer implements are the event handlers. In C# on the other hand, this boilerplate code is exposed as part of your source code.
2. Classes and inheritance: C# is a genuine object-oriented language, unlike Visual Basic, requiring all code to be a part of a class. It also includes extensive support for implementation inheritance. Indeed, most well-designed C# programs will be very much designed around this form of inheritance, which is completely absent in Visual Basic.

78. What are the authentication methods in .NET?

There are 4 types of authentications.
1.WINDOWS AUTHENTICATION
2.FORMS AUTHENTICATION
3.PASSPORT AUTHENTICATION
4.NONE/CUSTOM AUTHENTICATION
The authentication option for the ASP.NET application is specified by using the tag in the Web.config file, as shown below:
other authentication options
1. WINDOWS AUTHENTICATION Schemes
I. Integrated Windows authentication
II. Basic and basic with SSL authentication
III. Digest authentication
IV. Client Certificate authentication
2. FORMS AUTHENTICATION
You, as a Web application developer, are supposed to develop the Web page and authenticate the user by checking the provided user ID and password against some user database
3.PASSPORT AUTHENTICATION
A centralized service provided by Microsoft, offers a single logon point for clients. Unauthenticated users are redirected to the Passport site
4 NONE/CUSTOM AUTHENTICATION:
If we don’t want ASP.NET to perform any authentication, we can set the authentication mode to “none”. The reason behind this decision could be: We don’t want to authenticate our users, and our Web site is open for all to use. We want to provide our own custom authentication

79. What is Serialization in .NET?

Anwer1
The serialization is the process of converting the objects into stream of bytes.
they or used for transport the objects(via remoting) and persist objects(via files and databases)
Answer2
When developing smaller applications that do not have a database (or other formal storage mechanism) or data that doesn’t need to be stored in a database (such as the state of a web application), you often still would like to save the data for later retrieval. There are many ways to do this, but many of them are subject to a lot of extra code (work) and extra time spent debugging. With .NET, there is now an easy way to add this functionality to your code with only a few lines of easily tested code. This easy way is called serialization.
Serialization is the process of storing an object, including all of its public and private fields, to a stream. Deserialization is the opposite – restoring an object’s field values from a stream. The stream is generally in the form of a FileStream, but does not have to be. It could be a memory stream or any other object that is of type IO.Stream. The format can be anything from XML to binary to SOAP.

80. What is Serialization in .NET?

Anwer1
The serialization is the process of converting the objects into stream of bytes.
they or used for transport the objects(via remoting) and persist objects(via files and databases)
Answer2
When developing smaller applications that do not have a database (or other formal storage mechanism) or data that doesn’t need to be stored in a database (such as the state of a web application), you often still would like to save the data for later retrieval. There are many ways to do this, but many of them are subject to a lot of extra code (work) and extra time spent debugging. With .NET, there is now an easy way to add this functionality to your code with only a few lines of easily tested code. This easy way is called serialization.
Serialization is the process of storing an object, including all of its public and private fields, to a stream. Deserialization is the opposite – restoring an object’s field values from a stream. The stream is generally in the form of a FileStream, but does not have to be. It could be a memory stream or any other object that is of type IO.Stream. The format can be anything from XML to binary to SOAP.

81. What’s the use of System.Diagnostics.Process class?

By using System.Diagnostics.Process class, we can provide access to the files which are presented in the local and remote system.
Example: System.Diagnostics.Process(”c:mlaksexample.txt”) — local file
System.Diagnostics.Process(”http://www.mlaks.comexample.txt”) — remote file

82. What are the authentication methods in .NET?

Abstract class: This class has abstract methods (no body). This class cannot be instantiated. One needs to provide the implementation of the methods by overriding them in the derived class. No Multiple Inheritance.
Interfaces: Interface class contains all abstract methods which are public by default. All of these methods must be implemented in the derived class. One can inherit from from more than one interface thus provides for Multiple Inheritance.
re-clarification of object based:
VB6 DOES support polymorphism and interface inheritance. It also supports the “Implements” keyword. What is not supported in vb6 is implementation inheritance.
Also, from above, vb6 DOES “provides access to third-party controls like COM, DCOM ” That is not anything new in .NET.

83. How to achieve Polymorphism in VB.Net?

We can achieve polymarphism in .Net i.e Compile time polymarphism and Runtime polymarphism. Compiletime Polymarphism achieved by method overloading. Runtime polymarphism achieved by Early Binding or Late Binding. Provide the function pointer to the object at compile time called as Early Binding.
provide the function pointer to the object at runtime called as Late Binding
class emp having the method display()
class dept having the method display()
create objects as in the main function
// Early binding
dim obj as new emp
dim ob as new dept
obj.display()-to call the display method of emp class
ob.display-to call the display method of the dept class
// Late binding
create object in the main class as
object obj
obj=new emp
obj.display()-to call the display of emp class
obj=new dept
obj.display()-to call the display of dept class
Difference between Class And Interface
Class is logical representation of object. It is collection of data and related sub procedures with defination.
Interface is also a class containg methods which is not having any definations.
Class does not support multiple inheritance. But interface can support.

84. What doesu mean by .NET framework?

The .NET Framework is an environment for building, deploying, and running Web Services and other applications. It consists of three main parts: the Common Language Runtime, the Framework classes, and ASP.NET

85. What is assembly?

It is a single deployable unit that contains all the information abt the implimentation of classes , stuctures and interfaces
NET framework overview
1. Has own class libraries. System is the main namespace and all other namespaces are subsets of this.
2. It has CLR(Common language runtime, Common type system, common language specification)
3. All the types are part of CTS and Object is the base class for all the types.
4. If a language said to be .net complaint, it should be compatible with CTS and CLS.
5. All the code compiled into an intermediate language by the .Net language compiler, which is nothing but an assembly.
6. During runtime, JIT of CLR picks the IL code and converts into PE machine code and from there it processes the request.
7. CTS, CLS, CLR
8. Garbage Collection
9. Dispose, finalize, suppress finalize, Idispose interface
10. Assemblies, Namespace: Assembly is a collection of class/namespaces. An assembly contains Manifest, Metadata, Resource files, IL code
11. Com interoperability, adding references, web references
12. Database connectivity and providers
Application Domain
1. Class modifiers: public, private, friend, protected, protected friend, mustinherit, NotInheritable
2. Method modifiers: public, private
3. Overridable
4. Shadows
5. Overloadable
6. Overrides
7. Overloads
8. Set/Get Property
9. IIF
10. Inheritance
11. Polymorphism
12. Delegates
13. Events
14. Reflection
15. Boxing
16. UnBoxing
ASP.Net
1. Web Controls: Data grid (templates, sorting, paging, bound columns, unbound columns, data binding), Data list, repeater controls
2. HTML Controls
3. Code behind pages, system.web.ui.page base class
4. Web.config: App settings, identity (impersonate), authentication (windows, forms, anonymous, passport), authorization
5. Databind.eval
6. Trace, Debug
7. Output cache
8. Session management
9. Application, Session
10. Global.asax httpapplication
11. User controls, custom controls, custom rendered controls (postback event, postdatachanged event) usercontrol is the base class
12. Directives
ADO.Net
1. Command object (ExecuteNonquery, ExecuteReader, ExecuteXMLReader, ExecuteScalar)
2. DataAdapter object (Fill)
3. Dataset (collection of tables)
4. CommandBuiler object
5. Transaction Object
6. Isolation levels
86. What is value?

Value is a ‘physical’ characteristic of the property. Property declares what should be formatted, e.g. FONT while value suggests how the property should be formatted, e.g. 12pt. By setting the value 12pt to the property FONT it is suggested that the formatted text be displayed in a 12 point font. There must always be a corresponding property to each value or set of values.
H1 {font: bold 180%}
In the example above the H1 selector is declared the FONT property which in its turn is declared the values BOLD and 180%.
The values suggesting alternatives are specified in a comma separated list, e.g.

H1 {font-family: font1, font2}

87. What is initial value?

Initial value is a default value of the property, that is the value given to the root element of the document tree. All properties have an initial value. If no specific value is set and/or if a property is not inherited the initial value is used. For example the background property is not inherited, however, the background of the parent element shines through because the initial value of background property is transparent.

Hello World

Content of the element P will also have red background

>88. How frustrating is it to write a specification knowing that you’re at the browser vendors’ mercy?

That’s part of the game. I don’t think any specification has a birthright to be fully supported by all browsers. There should be healthy competition between different specifications. I believe simple, author-friendly specifications will prevail in this environment.
Microformats are another way of developing new formats. Instead of having to convince browser vendors to support your favorite specification, microformats add semantics to HTML through the CLASS attribute. And style it with CSS.

89. How far can CSS be taken beyond the web page–that is, have generalized or non-web specific features for such things as page formatting or type setting?

Yes, it’s possible to take CSS further in several directions. W3C just published a new Working Draft which describes features for printing, e.g., footnotes, cross-references, and even generated indexes.
Another great opportunity for CSS is Web Applications. Just like documents, applications need to be styled and CSS is an intrinsic component of AJAX. The “AJAX” name sounds great.

90. How To Style Table Cells?

Margin, Border and Padding are difficult to apply to inline elements. Officially, the tag is a block level element because it can contain other block level elements (see Basics – Elements).
If you need to set special margins, borders, or padding inside a table cell, then us
this markup: yourtext to apply the CSS rules to the div inside the cell.

91. How To Style Forms?

Forms and form elements like SELECT, INPUT etc. can be styled with CSS – partially.
Checkboxes and Radiobuttons do not yet accept styles, and Netscape 4.xx has certain issues, but here is a tutorial that explains the application of CSS Styles on Form Elements.

92. How do I get my footer to sit at the bottom…?

Margin, Border and Padding are difficult to apply to inline elements. Officially, the tag is a block level element because it can contain other block level elements (see Basics – Elements).
If you need to set special margins, borders, or padding inside a table cell, then use this markup:

yourtext

to apply the CSS rules to the div inside the cell.

93. How To Style Forms?

Forms and form elements like SELECT, INPUT etc. can be styled with CSS – partially.
Checkboxes and Radiobuttons do not yet accept styles, and Netscape 4.xx has certain issues, but here is a tutorial that explains the application of CSS Styles on Form Elements.

94. How do I get my footer to sit at the bottom…?

Need a div which makes space at the bottom of the main page (inside the #wrap div). Then, the footer (being inside #wrap) can be placed in that space by using absolute positioning. Like this :
CSS body, html {
height:100%;
}
body {
margin:0;
padding:0;
}
#wrap {
position:relative;
width:780px;
margin:auto; min-height:100%;
}
* html #wrap {
height:100%;
}
# clearfooter {
height:50px;
overflow:hidden;
}
#footer {
position:absolute;
bottom:0;
width:100%;
height:50px;
}

HTML

…content goes here…

95. Can I attach more than one declaration to a selector?

Yes. If more than one declaration is attached to a selector they must appear in a semi colon separated list, e.g.;
Selector {declaration1; declaration2}
P {background: white; color: black}

96. Border around a table?

Try the following:
.tblboda {
border-width: 1px;
border-style: solid;
border-color: #CCCCCC;
}
/*color, thickness and style can be altered*/

You put this style declaration either in
an external stylesheet, or you can stuff it in
thesection, like:

and apply it to the table as follows:

Content text and more content

That should give you a grey thin border around this table. If you want the border to ‘shrink wrap’ around the table, then you have to use the tag instead the
tag. But that is not quite proper CSS or HTML, because a is for inline elements. A table is not an inline element, therefore the correct tag is
If you play around with it a bit then you have a good chance to achieve what you want and still have correct HTML/CSS.The other way would be that you apply the class .tblboda directly to the table (for IE and other contemporary browsers), like And you define another class for each style sheet: .tblboda2
In the NN4.xx style sheet, you use the same properties as above, and in the IE and other contemporary browsers you carefully set all those properties to default, like Then you wrap the table in the with the class .tblboda2 (NN4.xx does that) (IE a.o.c.b. don’t do anything, because the border-style is set to “none” = no border at all). This way you have a table that is wrapped in a nice little border: .tblboda2 for NN4.xx,

Related Jobs & Posts

C++ Programming tips &Technical Interview Que... 1.Can we declare a static function as virtual? Ans: No. The virtual function mechanism is used on the specific object that determines which virtual f...
CSS Interview Questions & Answers Set –... What is CSS? 1. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. Every element...
HTML – Interview Questions & Answers Se... How can I check for errors? HTML validators check HTML documents against a formal definition of HTML syntax and then output a list of errors. Valid...
HTML Interview Question Answer Set – 1 What is HTML? Answer1 : HTML, or HyperText Markup Language, is a Universal language which allows an individual using special code to create web pag...
C++ Programming tips & Technical Interview Qu... 41.What is forward referencing and when should it be used? Ans: Forward referencing is generally required when we make a class or a function as a fri...
C++ Programming tips &Technical Interview Que... 31.Can I have a reference as a data member of a class? If yes, then how do I initialise it? Ans: Yes, we can have a reference as a data member of a c...

Comments

comments