.Net Framework Interview Questions and Answers - 2

Question: 6

What are well-known objects?

Server-activated objects that are published at a URL outside the application domain are called well-known objects.

Question: 7

What are formatters?

Formatters are objects that encode and serialize data into the appropriate format before transmitting it over a channel.

Question: 8

List different types of formatters?

The following are the two types of formatters:

Binary formatter

SOAP formatter

Question: 9

Which classes are used by reflection to get information about various types?

Reflection uses the System.Reflection namespace that contains the following classes:

Assembly - Retrieves and manipulates information about an assembly. This class allows you to perform various functions, such as defining and loading assemblies, loading modules that are listed in the assembly manifest, and locating a type from this assembly to create an instance of it. The Assembly class uses one of the two methods - Assembly.GetType() or Assembly.GetTypes() - to get the Type object from assemblies that has not been loaded.

Module class - Retrieves information about parent assembly, classes in the module, and all the global methods available in the classes.

ConstructorInfo - Retrieves the information about a constructor, such as constructor name, parameters, access modifiers and various implementation details. The ConstructorInfo class uses the GetConstructor or GetConstructors method of a Type object to retrieve the constructor information.

MethodInfo - Retrieves information about a method in the class, module or assembly, such as method name, return type, parameters, access modifiers and implementation details. The MethodInfo class uses either the GetMethod or GetMethods method of a type to retrieve the information.

FieldInfo - Retrieves information about the fields, such as name, access modifiers and implementation details. In addition you can use this class to get or set field values of a class.

EventInfo - Retrieves information about events, such as name, event handler data type, custom attributes, declaring type and reflected type.

Question: 10

Explain the TCP channel?

The TCP channel uses the TCPChannel class to set up a remoting server and its client. It is a socket based transport that uses the TCP protocol for transporting the serialized message stream across .NET rmoting boundaries.

The TcpChannel class is defined in the System.Runtime.Remoting.Channels.

Tcp namespace and implements the IChannel, IChannelSender and IChannelReceiver interfaces, which means that the TcpChannel class supports both sending and receiving data across .NET remoting boundaries.

By default, the TcpChannel class uses binary formatter but it is not bound to use only this one.

Instead, the TcpChannel class can use any of the two formatters, binary or SOAP.

Related Questions