Mention the assembly name where System namespace lies in C#?
Answer:
Assembly Name – mscorlib.dll
ViewDo we get error while executing “finally” block in C#?
Answer:
Yes. We may get error in finally block.
ViewList out two different types of errors in C#?
Answer:
Below are the types of errors in C# -
Can we have only “try” block without “catch” block in C#?
Answer:
Yes we can have only try block without catch block.
ViewWhat is the difference between “throw ex” and “throw” methods in C#?
Answer:
What is the difference between “finalize” and “finally” methods in C#?
Answer:
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.
ViewCan 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.
ViewWhat is the difference between “dispose” and “finalize” variables in C#?
Answer:
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.
ViewWhat is the difference between “constant” and “readonly” variables in C#?
Answer:
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
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.
ViewWhy 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.
ViewList out the differences between Array and ArrayList in C#?
Answer:
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.
ViewExplain 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.
ViewExplain the types of comments in C#?
Answer:
Below are the types of comments in C# -
What are IDE’s provided by Microsoft for C# development?
Answer:
Below are the IDE’s used for C# development –
View
List some of the advantages of C#?
Answer:
Below are the advantages of C# -
© 2017 QuizBucket.org