![]() |
31. What are methods? Methods are the building blocks of a class, in which they are linked together to share and process data to produce the result. In other words, a method is a block of code that contains a series of statements and represents the behavior of a class. While declaring a method you need to specify the access specifier, the return value, the name of the method, and the method parameters. All these combined together is called the signature of the method. 32. What is a namespace? Namespace is considered as a container that contains functionally related group of classes and other types. 33. Do events have return type? No, events do not have return type. 34. What is the function of the Try-Catch-Finally block? The try block encloses those statements that can cause exception and the catch block handles the exception, if it occurs. Catch block contains the statements that have to be executed, when an exception occurs. The finally block always executes, irrespective of the fact whether or not an exception has occurred. The finally block is generally used to perform the cleanup process. If any exception occurs in the try block, the program control directly transfers to its corresponding catch block and later to the finally block. If no exception occurs inside the try block, then the program control transfers directly to the finally block. 35. How can you prevent a class from overriding in C# and Visual Basic? You can prevent a class from overriding in C# by using the sealed keyword; whereas, the NotInheritable keyword is used to prevent a class from overriding in Visual Basic. 36. What are abstract classes? What are the distinct characteristics of an abstract class? An abstract class is a class that cannot be instantiated and is always used as a base class.
The basic purpose of an abstract class is to provide a common definition of the base class that multiple derived classes can share. |
© 2008-2013 by IndiaBIX™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy
Contact us: info@indiabix.com
Follow us on twitter!