What is a platform?
Platform is the combination of CPU Architecture and
Opearating System architecture.
What is platform dependency?
Code that has been generated by the language compiler Compilation does not run/execute on a different processor and in different Opearating
System than which it has been compiled
,this nature is known as platform
dependency.
What is platform independency?
If the code generataed by the language compiler Compilation which runs on
any processor any opearating system
than which it has been compiled is known as platform independency.
What is .Net framework?
.Net FrameWork is execution
or runtime environment of dotnet programs or applications.
What is VisualStudio .Net?
VisualStudio .Net is
an editor to write .Net code or develop
application using n.Net framework.
What is CLS?
CLS is a set of Common Language standards defined by Microsoft
for all .Net Languages.
What is role of CLS?
CLS is responsible to provide Language Interopearability
which is done in 2 ways.
1.ManagedCode
2.UnManagedCode
What is Language Interopearability?
Providing Code execution Support that has been written in ither progamamuing
Language is known as Language Interopearability.
What is ManagedCode?
Code which is taking help of CLR for execution is called as ManagedCode.
What is UnmanagedCode?
Code which is
not taking help of CLR for execution is called as unmanagedcode.
What is LanguageSpecification?
Every Programming Language will have some syntactical
rules used to write the code which is
known as Language specification.
What is CLS?
This Language specification
of CLR is common to all Programming
languages of managedcode execution of
.Net and is known as CLS(Common Languages Specification).
What is CTS?
The Datatype system of CLR which is common to all programming languages of .Net is known as CommonType System.
This CommonType System is divided into 2 types.
1.ValueType
2.ReferenceType.
What is ValueType ?
The DataTypes which
stores Data directly into their memory locations is known as ValueType.
What is ReferenceType ?
The DataTypes which
stores Data directly into their memory locations rather refers to other Locations is known as
ReferenceType.
What is Boxing?
Boxing is the process of converting variable from valuetype
to referencetype.
What is UnBoxing ?
Boxing is the process
of converting variable from referencetype to valuetype.
What is GarbageCollector ?
It is responsible tom
provide automaticMemoryMangement.
What is physical
location of baseclass libraries?
C:\windows\assembly
What is DLL ?
DynamicLinkLibrary
cannot run itself used to supportfile to other application.
What is Exe File ?
An executableFile is
not supportive file,it ‘s an application.
Whar ate contents of assembly?
AssemblyMetadata
TypedMetaData
MSIL code
Resources
What is metadata?
MetaData is binary
Information describing your program
that is stored either in a CLR
portable executable (PE) file or in memory.
What is private Asembly?
If an assembly is copied into individual application
in which we want to use then it is known as private (or)
local assembly.
What is
publicAssembly?
If an assembly is copied into globalplace
and the reference of assembly is used
from all other application then assembly is known as is known as
public (or) local assembly.
What is Jagged Arrays?
The array which has elements of type array is called jagged array. The elements can be of different dimensions and sizes. We can also call jagged array as Array of arrays.
What is the difference between ref & out parameters?
An argument passed as ref must be initialized before passing to the method whereas out parameter needs not to be initialized before passing to a method.
What is the use of using statement in C#?
The using block is used to obtain a resource and use it and then automatically dispose of when the execution of block completed.
The array which has elements of type array is called jagged array. The elements can be of different dimensions and sizes. We can also call jagged array as Array of arrays.
What is the difference between ref & out parameters?
An argument passed as ref must be initialized before passing to the method whereas out parameter needs not to be initialized before passing to a method.
What is the use of using statement in C#?
The using block is used to obtain a resource and use it and then automatically dispose of when the execution of block completed.
What is serialization?
When we want to transport an object through network then we have to convert the object into a stream of bytes. The process of converting an object into a stream of bytes is called Serialization. For an object to be serializable, it should inherit ISerialize Interface.
When we want to transport an object through network then we have to convert the object into a stream of bytes. The process of converting an object into a stream of bytes is called Serialization. For an object to be serializable, it should inherit ISerialize Interface.
Can “this” be used within a static method?
We can’t use ‘This’ in a static method because we can only use static variables/methods in a static method.
We can’t use ‘This’ in a static method because we can only use static variables/methods in a static method.
What is the difference between Array and Arraylist?
In an array, we can have items of the
same type only. The size of the array is fixed. An arraylist is similar to an
array but it doesn’t have a fixed size.
What are the differences
between System.String and System.Text.StringBuilder classes?
System.String is immutable. When we modify the value of a string variable then a new memory is allocated to the new value and the previous memory allocation released. System.StringBuilder was designed to have concept of a mutable string where a variety of operations can be performed without allocation separate memory location for the modified string.
System.String is immutable. When we modify the value of a string variable then a new memory is allocated to the new value and the previous memory allocation released. System.StringBuilder was designed to have concept of a mutable string where a variety of operations can be performed without allocation separate memory location for the modified string.
What’s the difference between the System.Array.CopyTo() and System.Array.Clone()
?
Using Clone() method, we creates a new array object containing all the elements in the original array and using CopyTo() method, all the elements of existing array copies into another existing array. Both the methods perform a shallow copy.
Using Clone() method, we creates a new array object containing all the elements in the original array and using CopyTo() method, all the elements of existing array copies into another existing array. Both the methods perform a shallow copy.
How can we sort the elements of the array in descending order?
Using Sort() methods followed by Reverse() method.
Using Sort() methods followed by Reverse() method.
What is the difference between Finalize() and Dispose() methods?
Dispose() is called when we want for an object to release any unmanaged resources with them. On the other hand Finalize() is used for the same purpose but it doesn’t assure the garbage collection of an object.
Dispose() is called when we want for an object to release any unmanaged resources with them. On the other hand Finalize() is used for the same purpose but it doesn’t assure the garbage collection of an object.
What are generics in C#.NET?
Generics are used to make reusable code classes to decrease the code redundancy, increase type safety and performance. Using generics, we can create collection classes. To create generic collection, System.Collections.Generic namespace should be used instead of classes such as ArrayList in the System.Collections namespace. Generics promotes the usage of parameterized types.
Generics are used to make reusable code classes to decrease the code redundancy, increase type safety and performance. Using generics, we can create collection classes. To create generic collection, System.Collections.Generic namespace should be used instead of classes such as ArrayList in the System.Collections namespace. Generics promotes the usage of parameterized types.
What is an object pool in .NET?
An object pool is a container having objects ready to be used. It tracks the object that is currently in use, total number of objects in the pool. This reduces the overhead of creating and re-creating objects.
An object pool is a container having objects ready to be used. It tracks the object that is currently in use, total number of objects in the pool. This reduces the overhead of creating and re-creating objects.
List down the commonly used types of exceptions in .Net?
ArgumentException, ArgumentNullException , ArgumentOutOfRangeException, ArithmeticException, DivideByZeroException ,OverflowException , IndexOutOfRangeException ,InvalidCastException ,InvalidOperationException , IOEndOfStreamException , NullReferenceException , OutOfMemoryException , StackOverflowException etc.
ArgumentException, ArgumentNullException , ArgumentOutOfRangeException, ArithmeticException, DivideByZeroException ,OverflowException , IndexOutOfRangeException ,InvalidCastException ,InvalidOperationException , IOEndOfStreamException , NullReferenceException , OutOfMemoryException , StackOverflowException etc.
What are Custom Exceptions?
Sometimes there are some errors that need to be handeled as per user requirements. Custom exceptions are used for them and are used defined exceptions.
Sometimes there are some errors that need to be handeled as per user requirements. Custom exceptions are used for them and are used defined exceptions.
What is the base class in .net from which all the classes are
derived from?
[csharp]System.Object[/csharp]
[csharp]System.Object[/csharp]
Why can’t you specify the accessibility modifier for methods inside
the interface?
In an interface, we have virtual methods that do not have method definition. All the methods are there to be overridden in the derived class. That’s why they all are public.
In an interface, we have virtual methods that do not have method definition. All the methods are there to be overridden in the derived class. That’s why they all are public.
How can we set class to be inherited, but prevent the method from
being over-ridden?
Declare the class as public and make the method sealed to prevent it from being overridden.
Declare the class as public and make the method sealed to prevent it from being overridden.
What happens if the inherited interfaces have conflicting method
names?
Implement is up to you as the method is inside your own class. There might be problem when the methods from different interfaces expect different data, but as far as compiler cares you’re okay.
Implement is up to you as the method is inside your own class. There might be problem when the methods from different interfaces expect different data, but as far as compiler cares you’re okay.
What is the difference between a Struct and a Class?
Structs are value-type variables and classes are reference types. Structs stored on the stack, causes additional overhead but faster retrieval. Structs cannot be inherited.
Structs are value-type variables and classes are reference types. Structs stored on the stack, causes additional overhead but faster retrieval. Structs cannot be inherited.
How to use nullable types in .Net?
Value
types can take either their normal values or a null value. Such types are
called nullable types.
[csharp]Int? someID = null;
If(someID.HasVAlue)
{
}
[/csharp]
[csharp]Int? someID = null;
If(someID.HasVAlue)
{
}
[/csharp]
How we can create an array with non-default values?
We can create an array with non-default values using Enumerable.Repeat.
We can create an array with non-default values using Enumerable.Repeat.
What is difference between is and as operators in c#?
“is” operator is used to check the
compatibility of an object with a given type and it returns the result as
Boolean.
“as” operator is used for casting of object to a type or a class.
“as” operator is used for casting of object to a type or a class.
What are indexers in C# .NET?
Indexers are known as smart arrays in C#. It allows the instances of a class to be indexed in the same way as array.
Eg:
[csharp]public int this[int index] // Indexer declaration[/csharp]
Indexers are known as smart arrays in C#. It allows the instances of a class to be indexed in the same way as array.
Eg:
[csharp]public int this[int index] // Indexer declaration[/csharp]
What is difference between the “throw” and “throw ex” in .NET?
“Throw” statement preserves original error stack whereas “throw ex” have the stack trace from their throw point. It is always advised to use “throw” because it provides more accurate error information.
“Throw” statement preserves original error stack whereas “throw ex” have the stack trace from their throw point. It is always advised to use “throw” because it provides more accurate error information.
What are C# attributes and its significance?
C# provides developers a way to define declarative tags on certain entities eg. Class, method etc. are called attributes. The attribute’s information can be retrieved at runtime using Reflection.
C# provides developers a way to define declarative tags on certain entities eg. Class, method etc. are called attributes. The attribute’s information can be retrieved at runtime using Reflection.
How to implement singleton design pattern in C#?
In singleton pattern, a class can only have one instance and provides access point to it globally.
Eg:
[csharp]
Public sealed class Singleton
{
Private static readonly Singleton _instance = new Singleton();
}
[/csharp]
In singleton pattern, a class can only have one instance and provides access point to it globally.
Eg:
[csharp]
Public sealed class Singleton
{
Private static readonly Singleton _instance = new Singleton();
}
[/csharp]
What is the difference between directcast and ctype?
DirectCast is used to convert the type of an object that requires the run-time type to be the same as the specified type in DirectCast.
Ctype is used for conversion where the conversion is defined between the expression and the type.
DirectCast is used to convert the type of an object that requires the run-time type to be the same as the specified type in DirectCast.
Ctype is used for conversion where the conversion is defined between the expression and the type.
Is C# code is managed or unmanaged code?
C# is managed code because Common language runtime can compile C# code to Intermediate language.
C# is managed code because Common language runtime can compile C# code to Intermediate language.