C#.NET INTERVIEW QUESTION & ANSWERS
86. |
What are the different usages of keywords in developing computer programs or why keywords are available with programming languages? |
|
- Keywords are those words that are reserved to be used for a specific task. These words cannot be used as identifiers.
-
You cannot use a keyword to define the name of a variable or method.
-
Keywords are used in programs to use the features of object oriented programming. For example,the abstract keyword is used to implement abstraction and the inherits keyword is used to implement inheritance by deriving subclasses in C# and Visual Basic, respectively.
- The new keyword is universally used in C# and Visual Basic to implement encapsulation by creating objects.
|
87. |
Where is the output of TextWriterTraceListener redirected? |
|
To the Console or a text file depending on the parameter passed to the constructor. |
88. |
When do you absolutely have to declare a class as abstract? |
|
When at least one of the methods in the class is abstract. |
89. |
What is the differences between the while and for loop in C#? |
|
The while and for loops are used to execute those units of code that need to be repeatedly executed, unless the result of the specified condition evaluates to false. However, the only difference between the two is in the syntax. The syntax of the for loop includes an initializer and a loop expression along with the condition in the while loop. |
90. |
Will the finally block get executed if an exception has not occurred? |
|
Yes |