Keyword

Result: 105 questions

What are the advantages of .Net?

Answer:

  • Good Design
  • Object-Oriented Programming – Using C# and .NET which are based on object-oriented Concepts.
  • Language Independence – All the languages which are supported by .Net (VB.NET, C#, J#, and managed C++) are compiled into common Intermediate Language (IL). So IL makes sure that languages are interoperable.
  • Efficient Data Access – ADO.NET provides fast and efficient way to access RDBMS, file system etc.
  • Code Sharing – To share code between applications, a new concept called assembly is introduced. Assemblies supports versioning.
  • Improved Security
  • Support Dynamic Web Pages – Using ASP.NET
  • Support for Web Services
View

What is Common Type System (CTS) ?

Answer:

.Net uses Common Type System (CTS) for Language Interoperability. CTS defines the predefined data types that are available in IL, so that all languages that target the .NET framework will produce the compiled code that is ultimately based on these types. CTS ensures that a data type defined in a VB.net will be understood by C#. For example, VB.Net uses “Integer” to define the data type Integer. C# uses  “int” to define the data type Integer. When VB.Net code is compiled, it will convert the Integer to Int32. Since C# refers Int to Int32, VB.Net code will be understood by C#.

View

What is Common Language Specification (CLS) ?

Answer:

Common Language Specification (CLS) is used for Language Interoperability in tandem with CTS to ensure the interoperability of the languages. CLS defines a set of minimum standards that all compilers targeting dot net must support. For example, VB.Net is not case sensitive. So attribute “EmployeeName” and “employeename” is considered same. But C# is case sensitive. So for language interoperability, C# doesn't allow two variables which differ only in case.

View

What is C-Sharp (C#)?

Answer:

C# is a type-safe, managed and object oriented language, which is compiled by .Net framework for generating intermediate language (IL).

View

Explain the features of C#?

Answer:

Below are some of the features supported in C# -

  • Constructors and Destructors
  • Properties
  • Passing Parameters
  • Arrays
  • Main
  • XML Documentation and
  • Indexers

 

View

List some of the advantages of C#?

Answer:

Below are the advantages of C# -

  • Easy to learn
  • Object oriented
  • Component oriented
  • Part of .NET framework
View

What are IDE’s provided by Microsoft for C# development?

Answer:

Below are the IDE’s used for C# development –

  • Visual Studio Express (VCE)
  • Visual Studio (VS)
  • Visual Web Developer

 

View

Explain the types of comments in C#?

Answer:

Below are the types of comments in C# -

  • Single Line Comment Eg : //
  • Multiline Comments Eg: /* */
  • XML Comments Eg : ///
View

Explain sealed class in C#?

Answer:

Sealed class is used to prevent the class from being inherited from other classes. So “sealed” modifier also can be used with methods to avoid the methods to override in the child classes.

View

Give an example of using sealed class in C#?

Answer:

Below is the sample code of sealed class in C# -

class X {} 
sealed class Y : X {}

Sealed methods –

class A
{
 protected virtual void First() { }
 protected virtual void Second() { }
}
class B : A
{
 sealed protected override void First() {}
 protected override void Second() { }
}

If any class inherits from class “B” then method – “First” will not be overridable as this method is sealed in class B.

View

List out the differences between Array and ArrayList in C#?

Answer:

  • Array stores the values or elements of same data type but arraylist stores values of different datatypes.
  • Arrays will use the fixed length but arraylist does not uses fixed length like array.
View

Why to use “using” in C#?

Answer:

“Using” statement calls – “dispose” method internally, whenever any exception occurred in any method call and in “Using” statement objects are read only and cannot be reassignable or modifiable.

View

Explain namespaces in C#?

Answer:

Namespaces are containers for the classes. We will use namespaces for grouping the related classes in C#. “Using” keyword can be used for using the namespace in other namespace.

View

Why to use keyword “const” in C#? Give an example.

Answer:

“Const” keyword is used for making an entity constant. We can’t reassign the value to constant.

Eg: const string _name = "Test";
View

What is the difference between “constant” and “readonly” variables in C#?

Answer:

  • “Const” keyword is used for making an entity constant. We cannot modify the value later in the code. Value assigning is mandatory to constant variables.
  • “readonly” variable value can be changed during runtime and value to readonly variables can be assigned in the constructor or at the time of declaration.
View

Explain “static” keyword in C#?

Answer:

“Static” keyword can be used for declaring a static member. If the class is made static then all the members of the class are also made static. If the variable is made static then it will have a single instance and the value change is updated in this instance.

View

What is the difference between “dispose” and “finalize” variables in C#?

Answer:

  • Dispose - This method uses interface – “IDisposable” interface and it will free up both managed and unmanaged codes like – database connection, files etc.
  • Finalize - This method is called internally unlike Dispose method which is called explicitly. It is called by garbage collector and can’t be called from the code.
View

Can we execute multiple catch blocks in C#?

Answer:

No. Once any exception is occurred it executes specific exception catch block and the control comes out.

View

Why to use “finally” block in C#?

Answer:

“Finally” block will be executed irrespective of exception. So while executing the code in try block when exception is occurred, control is returned to catch block and at last “finally” block will be executed. So closing connection to database / releasing the file handlers can be kept in “finally” block.

View

What is the difference between “finalize” and “finally” methods in C#?

Answer:

  • Finalize – This method is used for garbage collection. So before destroying an object this method is called as part of clean up activity.
  • Finally – This method is used for executing the code irrespective of exception occurred or not.
View

© 2017 QuizBucket.org