In: Computer Science
C#questions:
T or F?
Uncaught exceptions cause a program to
terminate unexpectedly.
Answer: True
Exceptions must be caught and handled properly,
otherwise the program will be
crash and terminate
Compared to traditional error handling techniques, exception handling is considered more efficient.
Answer: True
Efficient way of handling exceptions is to catch
that exceptions and handled, then normal flow
of execution of the program continues, after the
handling the exception.
Th Me keyword is a reference to the
current instance of a class that is accessible from within the
class definition.
Answer: False
"this" keyword is used to refer the current
instance of a class in c#.
An abstract class cannot be instantiated.
Answer: True
Abstract class cannot be instantiated. Object
reference can be of Abstract type.
All members of an interface must be implemented
Answer: True
Class implementing the interface must provide
implementation for all the abstract methods in that interface.
Value types can be used as base
classes to derive other classes.
Answer: No
Eventhough value types are objects, they don't
behave like other objects.
You can define one namespace inside
another namespace.
Answer: True
We can declare another namespace inside one
namespace
Only one interface can be implemented on a class.
Answer: False
We can implement more than one interface on a
class.
One constructor can call another constructor in C#.
Answer: True
we can call super class constructor from the
derived class constructor.
Code in the finally block is always
executed.
Answer: True
Whether exceptions occurs in the program or not,
always the code in the finally block will be
exceuted.