2 Object Oriented Programming And Events

NET Centric Computing · Unit 2

Object-Oriented Programming and Events

Exam-focused notes for Object-Oriented Programming and Events (NET Centric Computing, BIT351): what the TU syllabus asks and how it has actually been tested, with 2 solved past questions from this unit.

What this unit covers

  • Delegates and event handling
  • Exception handling and error management
  • Throwing and catching exceptions
  • Input validation with exceptions

Throwing and catching exceptions

2081.110 marks

Differentiate between error and exception. Write a program to take the input for any five subjects and throw the exception if the given marks is negative or exceed 100.[10]

In everyday use an error is any fault in a program, but as a technical term the two words describe faults of very different severity, and the .NET framework treats them differently from Java. In .NET there is no separate Error base class. Everything that ca...

Full solved answer →

Delegates and event handling

010 marks

Describe the roles of delegates in event handling. Illustrate the use of partial class with an example.[10]

--- A delegate is a type-safe function pointer in C that holds a reference to a method (or multiple methods) with a matching signature. It acts as an intermediary between the event source (publisher) and the event handler (subscriber). Syntax: --- Event han...

Full solved answer →