dot net Interview Questions and Answers-5

dot net Interview Questions and Answers -5

1. Which method do you invoke on the DataAdapter control to load your generated dataset with data?
     
DataAdapter’s fill () method is used to fill load the data in dataset.

2. What is the purpose of an Assembly?
     
An assembly controls many aspects of an application. The assembly handles versioning, type and class scope, security permissions, as well as other metadata including references to other assemblies and resources. The rules described in an assembly are enforced at runtime.

3. What is Authentication and Authorization?
     
Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password).
Authorization performs after authentication. Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user.

4. What are the types of Authentication?     

  There are 3 types of Authentication.
    Windows authentication
    Forms authentication
    Passport authentication.

5. What is a Literal Control?

  The Literal control is used to display text on a page. The text is programmable. This control does not let you apply styles to its content.

6. What are the namespace available in .net?     

    Namespace is a logical grouping of class.
    System
    System.Data
    System.IO
    System.Drawing
    System.Windows.Forms
    System.Threading

7. What is Side-by-Side Execution?
     
The CLR allows any versions of the same-shared DLL (shared assembly) to execute at the same time, on the same system, and even in the same process. This concept is known as side-by-side execution.

8. What is the difference between System.String and System.StringBuilder classes?
     
System.String is immutable, System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

9. What is the use of JIT ?
     
JIT (Just - In - Time) is a compiler which converts MSIL code to Native Code (ie. CPU-specific code that runs on the same computer architecture).

10. What is the difference between early binding and late binding?
     
Calling a non-virtual method, decided at a compile time is known as early binding. Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding.

11. What are the different types of Caching?     

    There are three types of Caching :
    Output Caching
    Fragment Caching
    Data Caching.

12. What is Reference type and value type?

 Reference Type : Reference types are allocated on the managed CLR heap, just like object types. A data type that is stored as a reference to the value’s location. Reference types can be self-describing  types, pointer types, or interface types.Value Type : Value types are allocated on the stack just like primitive types in VBScript, VB6 and C/C++. Value types are not instantiated using new go out of scope when the function they are defined within   returns.

13. What is Delegates?

 Delegates are a type-safe, object-oriented implementation of function pointers and are used in many situations where a component needs to call back to the component that is using it.

14. What is Authentication and Authorization?

 Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password).
Authorization performs after authentication. Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user.

15. What is a Static class?

  Static class is a class which can be used or accessed without creating an instance of the class.

16 What is sealed class?

 Sealed classes are those classes which can not be inherited and thus any sealed class member can not be derived in any other class. A sealed class cannot also be an abstract class.

17. What are the two main parts of the .NET Framework?
     
    There are the two main parts of the .NET Framework are :
    The common language runtime (CLR).
    The .NET Framework class library.

18. What is the advantage of using System.Text.StringBuilder over System.String?
     
StringBuilder is more efficient in cases where there is a large amount of string manipulation. Strings are immutable, so each time it's being operated on, a new instance is created.

19. What is reflection?
     
All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection.

20. What is an Application Domain? How they get created?
     
An Application Domain can be thought of as a lightweight processes controlled by the .Net runtime. Application Domains are usually created by hosts like Windows Shell, ASP.NET and IE. When you run a .NET application from the command-line, the host is the Shell. The Shell creates a new Application Domain for every application.

21. What is the difference between Compiler and Interpreter?
     
Compiler :A compiler is a program that translates program (called source code) written in some high level language into object code.
Interpreter:An interpreter translates high-level instructions into an intermediate form, which it then executes. Interpreter analyzes and executes each line of source code in succession, without looking at the entire program; the advantage of interpreters is that they can execute a program immediately. .

22. What is a class?
     
Class is concrete representation of an entity. It represents a group of objects, which hold similar attributes and behavior. It provides abstraction and encapsulations.

23. What is an Object?
     
Object represents/resembles a Physical/real entity. An object is simply something you can give a name.

24 What is Abstraction?
     
Hiding the complexity. It is a process of defining communication interface for the functionality and hiding rest of the things.

25. How do you convert a string into an integer in .NET?
     
Int32.Parse(string)
Convert.ToInt32()

26. 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.

27. What Is Boxing And Unboxing?
     
Boxing :Boxing is an implicit conversion of a value type to the reference type.
Examples : Stuct Type, Enumeration Type
UnBoxing :Unboxing is an explicit conversion from the reference to a value type.
Examples : Class , Interface.

28. How do you create threading in .NET? What is the namespace for that?
     
System.Threading.Thread

29. What is Method overloading?
     
Method overloading occurs when a class contains two methods with the same name, but different signatures.

30. What is Method Overriding?
     
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.

31. What is difference between inline and code behind?
     
Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

32. What is an abstract class?
     
An abstract class is a class that must be inherited and have the methods overridden. An abstract class is essentially a blueprint for a class without any implementation.

33. What is the difference between datagrid and gridview?
     
Datagrid is used in windows application and gridview is used in web and in datagrid we cannot write the code for datagrid properties where as for grid view we can write the code like template column item template etc this will not be done in datagrid.

34. What is the use of System.Diagnostics.Process class?
     
The System.Diagnostics namespace provides the interfaces, classes, enumerations and structures that are used for tracing.
The System.Diagnostics namespace provides two classes named Trace and Debug that are used for writing errors and application execution information in logs.

35. What is the difference between static or dynamic assemblies?
     
Assemblies can be static or dynamic.
Static assemblies :can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on).Staticassemblies are stored on disk in portable executable (PE) files.
Dynamic assemblies :which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed.

36. What are the difference between Structure and Class?     

    Structures are value type and Classes are reference type.
    Structures can not have contractors or destructors. Classes can have both contractors and destructors.
    Structures do not support Inheritance, while Classes support Inheritance

37. What is 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.

38. What is the use of ErrorProvider Control?

 The ErrorProvider control is used to indicate invalid data on a data entry form.

39. How many languages .NET is supporting now?
     
When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. 44 languages are supported.

40. How many .NET languages can a single .NET DLL contain?
     
Many.

41. What is metadata?
     
Metadata means data about the data i.e., machine-readable information about a resource, . Such information might include details on content, format, size, or other characteristics of a data source. In .NET, metadata includes type definitions, version information, external assembly references, and other standardized information.

42. What is the difference between Custom Control and User Control?
     
Custom Controls are compiled code (Dlls), easier to use, difficult to create, and can be placed in toolbox. Drag and Drop controls. Attributes can be set visually at design time.
AUser Control is shared among the single application files.

43. What keyword is used to accept a variable number of parameter in a method?
     
“params” keyword is used as to accept variable number of parameters.

44. What is boxing and unboxing?
     
Implicit conversion of value type to reference type of a variable is known as BOXING, for example integer to object type conversion.
Conversion of reference type variable back to value type is called as UnBoxing.

45. What is object?
 
An object is an instance of a class. An object is created by using operator new. A class that creates an object in memory will contain the information about the values and behaviours (or methods) of that specific object.

46. Where are the types of arrays in C#?     

    Single-Dimensional
    Multidimensional
    Jagged arrays.

47. What is the difference between Object and Instance?
     
An instance of a user-defined type is called an object. We can instantiate many objects from one class.
An object is an instance of a class.

48. What are different types of JIT ?     

    There are three types of jit :
    pre - jit
    Econo - jit
    Normal - jit.

49. What is difference between C# And Vb.net?     

    C# is case sensitive while VB is not case sensitive.
    vb.net does not support xml while c# support xml
    vb.net supports with constructor while c# do not.

50. What does assert() method do?
     
In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.

51. Why string are called Immutable data Type?
 
The memory representation of string is an Array of Characters, So on re-assigning the new array of Char is formed & the start address is changed . Thus keeping the Old string in Memory for Garbage Collector to be disposed.

52. What is the difference between Convert.toString and .toString() method?
     
Convert.toString handles null while i.tostring() does not handles null.

53. How many types of Transactions are there in COM + .NET ?     

    There are 5 transactions types that can be used with COM+.
    Disabled
    Not Supported
    Supported
    Required
    Required New

54. What is a DataTable?
     
A DataTable is a class in .NET Framework and in simple words a DataTable object represents a table from a database.

55. How many namespaces are in .NET version 1.1?
     
124.

56. What is a DataSet?
     
A DataSet is an in memory representation of data loaded from any data source

57. What is the difference between in-proc and out-of-proc?
     
An Inproc is one which runs in the same process area as that of the client giving tha advantage of speed but the disadvantage of stability becoz if it crashes it takes the client application also with it.
Outproc is one which works outside the clients memory thus giving stability to the client, but we have to compromise a bit on speed.

58. What is the differnce between Managed code and unmanaged code?
     
Managed Code: Code that runs under a "contract of cooperation" with the common language runtime. Managed code must supply the metadata necessary for the runtimeto provide services such as memory management, cross-language integration, code access security, and automatic lifetime control of objects. All code based on Microsoft intermediate language (MSIL) executes as managed code.
Un-Managed Code:Code that is created without regard for the conventions and requirements of the common language runtime. Unmanaged code executes in the common language runtime environment with minimal services (for example, no garbage collection, limited debugging, and so on).

59. What is difference between constants, readonly and, static?
     
   Constants: The value can’t be changed.
    Read-only: The value will be initialized only once from the constructor of the class.
    Static: Value can be initialized once.

60. What is the difference between Convert.toString and .toString() method?
     
Convert.toString handles null while i.tostring() does not handles null.

61. What are the advantages of VB.NET?     

    The main advantages of .net are :
    .NET is a language independent
    Automatic memory management(garbage collection)
    Disconnected architecture
    Object Oriented.

62. What is strong-typing versus weak-typing?

 Strong type is checking at the variables in compile time.Weak typing is checking the variables at run-time.

63. What is the root class in .Net?

system.object is the root class in .net .

64. What is the maximum size of the textbox?

65536

65. What is managed code execution?
     
The .Net framework loads and executes the .Net applications, and manages the state of objects during program execution. This also provides automatically garbage collections.

66. What is the strong name in .net assembly?
     
   Strong Name is similar to GUID (It is supposed to be unique in space and time).
    In COM components. Strong name is only needed when we need to deploy assembly in GAC.
    Strong names use public key cryptography (PKC) to ensure that no one can spoof it. PKC use public key and private key concept. Following are the step to generate a strong name and sign an assembly:

67. What are the types of comment in C#?     

    There are 3 types of comments in C#.
    Single line (//)
    Multi (/* */)
    Page/XML Comments (///).

68. What are the namespaces used in C#.NET?     

    Namespace is a logical grouping of class.
    using System;
    using System.Collections.Generic;
    using System.Windows.Forms;

69. What are the characteristics of C#?     

    There are several characteristics of C# are :
    Simple
    Type safe
    Flexible
    Object oriented
    Compatible
    Consistent
    Interoperable
    Modern

70. How to run a Dos command in Vb.net?
     
Shell("cmd.exe /c c:\first.exe < in.txt > out.txt")
 
71. What are the assembly entry points?
     
An assembly can have only one entry point from DllMain, WinMain or Main.

72. What are remotable objects in .NET Remoting?
     
Remotable objects are the objects that can be marshaled across the application domains. You can marshal by value, where a deep copy of the object is created and then passed to the receiver. You can also marshal by reference, where just a reference to an existing object is passed.

73. What are the types of Authentication?     

There are 3 types of Authentication.
Windows Authentication
Forms Authentication
Passport Authentication

.74. What namespaces are necessary to create a localized application?     

System.Globalization
System.Resources

75. Which namespaces are used for data access?     

System.Data
System.Data.OleDB
System.Data.SQLClient

76. What is a SESSION and APPLICATION object?

Session object store information between HTTP requests for a particular user.
Session variables are used to store user specific information where as in application variables we can’t store user specific information.
while application object are global across users.

77. What is static constructor?
     
A static constructor is used to initialize a class. It is called automatically to initialize the class before the first instance is created or any static members are referenced.

78. What is C#?   

 C# (pronounced "C sharp") is a simple, modern, object-oriented, and type-safe programming language.It will immediately be familiar to C and C++ programmers.C# combines the high productivity of Rapid Application Development (RAD) languages.


79. What are the different categories of inheritance?

Inheritance in Object Oriented Programming is of four types:
Single inheritance : Contains one base class and one derived class.
Hierarchical inheritance : Contains one base class and multiple derived classes of the same base class.
Multilevel inheritance : Contains a class derived from a derived class.
Multiple inheritance : Contains several base classes and a derived class.


80. What are the basic concepts of object oriented programming?     

It is necessary to understand some of the concepts used extensively in object oriented programming.These include
    Objects
    Classes
    Data abstraction and encapsulation
    Inheritance
    Polymorphism
    Dynamic Binding
    Message passing.

81. Can you inherit multiple interfaces?
     
Yes. Multiple interfaces may be inherited in C#.

82. What is inheritance?
     
Inheritance is deriving the new class from the already existing one.

83. Define scope?
 
Scope refers to the region of code in which a variable may be accessed.

84. What are the modifiers in C#?
     
 Abstract
 Sealed
 Virtual
 Const
 Event
 Extern
Override
 Readonly
 Static
  New

85. What are the types of access modifiers in C#?     

 Access modifiers in C# are :
 public
 protect
 private
 internal
 internal protect


86. Define destructors?
 
A destructor is called for a class object when that object passes out of scope or is explicitly deleted.A destructors as the name implies is used to destroy the objects that have been created by a constructors.Like a constructor , the destructor is a member function whose name is the same as the class name but is precided by a tilde.

87. What is the use of enumerated data type?
     
An enumerated data type is another user defined type which provides a way for attaching names to numbers thereby increasing comprehensibility of the code. The enum keyword automatically enumerates a list of words by assigning them values 0,1,2, and so on.

88. Define Constructors?
 
A constructor is a member function with the same name as its class. The constructor is invoked whenever an object of its associated class is created.It is called constructor because it constructs the values of data members of the class.

89. What is encapsulation?
     
The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Encapsulation containing and hiding information about an object, such as internal data structures and code.

90. Does c# support multiple inheritance?
     
No,its impossible which accepts multi level inheritance.

91. What is ENUM?
     
Enum are used to define constants.

92. What is a data set?
     
A DataSet is an in memory representation of data loaded from any data source.

93. What is the difference between private and public keyword?
     
Private : The private keyword is the default access level and most restrictive among all other access levels. It gives least permission to a type or type member. A private member is accessible only within the body of the class in which it is declared.
    Public : The public keyword is most liberal among all access levels, with no restrictions to access what so ever. A public member is accessible not only from within, but also from outside, and gives free access to any member declared within the body or outside the body.

94. Define polymorphism?
     
Polymorphism means one name, multiple forms. It allows us to have more than one function with the same name in a program.It allows us to have overloading of operators so that an operation can exhibit different behaviours in different instances.

95. 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.

96. what is an abstract base class?
     
An abstract class is a class that is designed to be specifically used as a base class. An abstract class contains at least one pure virtual function.

97. How is method overriding different from method overloading?
     
When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class.

98. 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.

99. What is the use of using statement in C#?
     
The using statement is used to obtain a resource, execute a statement, and then dispose of that resource.

100. What is serialization?
     
Serialization is the process of converting an object into a stream of bytes.De-serialization is the opposite process of creating an object from a stream of bytes.Serialization / De-serialization is mostly used to transport objects.

101. What are the difference between Structure and Class?     

 Structures are value type and Classes are reference type
Structures can not have contractors or destructors.
Classes can have both contractors and destructors.
 Structures do not support Inheritance, while Classes support Inheritance.

102. What is 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.

103. What is Delegates?
     
Delegates are a type-safe, object-oriented implementation of function pointers and are used in many situations where a component needs to call back to the component that is using it.

104. What is Authentication and Authorization?
     
Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password).
Authorization performs after authentication. Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user.

0 comments:

Post a Comment