1.What is Active Directory? What is the namespace used to access the Microsoft
Active Directories? What are ADSI Directories?
Active Directory Service Interfaces (ADSI) is a programmatic interface for Microsoft
Windows Active Directory. It enables your applications to interact with diverse
directories on a network, using a single interface. Visual Studio .NET and the .NET
Framework make it easy to add ADSI functionality with the DirectoryEntry and
DirectorySearcher components.Using ADSI, you can create applications that perform
common administrative tasks, such as backing up databases, accessing printers, and
administering user accounts. ADSI makes it possible for you to:
Log on once to work with diverse directories. The DirectoryEntry component class
provides username and password properties that can be entered at runtime and
communicated to the Active Directory object you are binding to.
Use a single application programming interface (API) to perform tasks on multiple
directory systems by offering the user a variety of protocols to use. The
DirectoryServices namespace provides the classes to perform most administrative
functions.
Perform "rich querying" on directory systems. ADSI technology allows for searching for
an object by specifying two query dialects: SQL and LDAP.
Access and use a single, hierarchical structure for administering and maintaining diverse
and complicated network configurations by accessing an Active Directory tree.
Integrate directory information with databases such as SQL Server. The DirectoryEntry
path may be used as an ADO.NET connection string provided that it is using the LDAP
provider. using System.DirectoryServices;
2.What are Namespaces?
The namespace keyword is used to declare a scope. This namespace scope lets you
organize code and gives you a way to create globally-unique types. Even if you do not
explicitly declare one, a default namespace is created. This unnamed namespace,
sometimes called the global namespace, is present in every file. Any identifier in the
global namespace is available for use in a named namespace. Namespaces implicitly have
public access and this is not modifiable
3.What is the difference between CONST and READONLY?
Both are meant for constant values. A const field can only be initialized at the declaration
of the field. A readonly field can be initialized either at the declaration or in a constructor.
Therefore, readonly fields can have different values depending on the constructor used.
readonly int b;public X(){b=1;}public X(string s){b=5;}public X(string s, int
i){b=i;}Also, while a const field is a compile-time constant, the readonly field can be
used for runtime constants, as in the following example:public static readonly uint l1 =
(uint) DateTime.Now.Ticks; (this can't be possible with const)
4. What is the difference between ref & out parameters?
An argument passed to a ref parameter must first be initialized. Compare this to an out
parameter, whose argument does not have to be explicitly initialized before being passed
to an out parameter.
5.What is the difference between Array and Arraylist?
As elements are added to an ArrayList, the capacity is automatically increased as required
through reallocation. The capacity can be decreased by calling TrimToSize or by setting
the Capacity property explicitly.
6. What is Jagged Arrays?
A jagged array is an array whose elements are arrays. The elements of a jagged array can
be of different dimensions and sizes. A jagged array is sometimes called an "array-of-
arrays.
7.What are indexers?
Indexers are similar to properties, except that the get and set accessors of indexers take
parameters, while property accessors do not.
8.What is the difference between a Struct and a Class?
a.The struct type is suitable for representing lightweight objects such as Point, Rectangle,
and Color. Although it is possible to represent a point as a class, a struct is more efficient
in some scenarios. For example, if you declare an array of 1000 Point objects, you will
allocate additional memory for referencing each object. In this case, the struct is less
expensive.
b.When you create a struct object using the new operator, it gets created and the
appropriate constructor is called. Unlike classes, structs can be instantiated without using
the new operator. If you do not use new, the fields will remain unassigned and the object
cannot be used until all of the fields are initialized.
c.It is an error to declare a default (parameterless) constructor for a struct. A default
constructor is always provided to initialize the struct members to their default values.
d.It is an error to initialize an instance field in a struct.
e.There is no inheritance for structs as there is for classes. A struct cannot inherit from
another struct or class, and it cannot be the base of a class. Structs, however, inherit from
the base class Object. A struct can implement interfaces, and it does that exactly as
classes do
f.A struct is a value type, while a class is a reference type
9.Value type & reference types difference? Example from .NET. Integer & struct
are value types or reference types in .NET?
Most programming languages provide built-in data types, such as integers and floating-
point numbers, that are copied when they are passed as arguments (that is, they are
passed by value). In the .NET Framework, these are called value types. The runtime
supports two kinds of value types:
•
Built-in value types
The .NET Framework defines built-in value types, such as System.Int32 and
System.Boolean, which correspond and are identical to primitive data types used by
programming languages.
•
User-defined value types
Your language will provide ways to define your own value types, which derive from
System.ValueType. If you want to define a type representing a value that is small, such as
a complex number (using two floating-point numbers), you might choose to define it as a
value type because you can pass the value type efficiently by value. If the type you are
defining would be more efficiently passed by reference, you should define it as a class
instead.
Variables of reference types, referred to as objects, store references to the actual data.
This following are the reference types:
•
class
•
interface
•
delegate
This following are the built-in reference types:
•
object
•
string
10.What is Method overloading?
Method overloading occurs when a class contains two methods with the same name, but
different signatures.
11.What is Method Overriding? How to override a function in C#?
Use the override modifier to modify a method, a property, an indexer, or an event. An
override method provides a new implementation of a member inherited from a base class.
The method overridden by an override declaration is known as the overridden base
method. The overridden base method must have the same signature as the override
method.You cannot override a non-virtual or static method. The overridden base method
must be virtual, abstract, or override.
Tuesday, March 10, 2009
Interview Question Part III
Labels:
Active Directory,
Array,
Arraylist,
CONST,
indexers,
Jagged Arrays,
Namespaces,
out parameters,
READONLY,
reflection
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment