Even Driven501
Even Driven501
2024 – 2025
Preliminary Examination
Event Driven Programming
I. Identification
Instructions: Read the sentence carefully. Fill each blank
with correct answers. Write the answer on the blank provided.
_____________ 1. These can reference a method that returns and
takes parameters of different types.
_____________ 2. It is a member of a class that is a fired
whenever a specific action takes place.
_____________ 3. What operators that allow adding an event to
the class.
_____________ 4. To register a new subscription to an event.
_____________ 5. This class stores key or values pairs where
the key represents the value in the collection.
_____________ 6. This method returns the key to the specific
index.
_____________ 7. It is an interface that allows you to
determine the number of elements in a collection and copy them
in a simple array type.
_____________ 8. What is the syntax for the format of creating
a List<T> collection?
_____________ 9. It is part of properties of the SortedList
that can used to gets and sets the value associated with a
specific key.
_____________ 10. It is an interface that allows you to loop
through elements in a collection.
1st Term S.Y. 2024 – 2025
Preliminary Examination
Event Driven Programming
II. Tracing
1st Term S.Y. 2024 – 2025
Preliminary Examination
Event Driven Programming
namespace PrelimExamination {
public delegate void TaskProcessor(string task);
}
}
public static void ProcessTask(string task)
{
Console.WriteLine(Task + " - Completed");
}
}
}
2.
using System;
using System.Collections.Generic;
namespace Preliminary_Examination {
3.
using System;
using System.Collections.Generic; // Required for SortedList
namespace PrelimExaminations {
public class Program
{
public static void Main(string[] args)
{
SortedList<string, int> studentScores = new
SortedList<string, int>();
studentScores.Add("Alice", 85):
studentScores.add("Bob", 90);
studentScores.Add("Charlie", 88);
StudentScores.Add("Dave", 92);
studentScores.Add("Eve", 79);
III. Programming
Instructions: Create a C# Program to the given statement.
1. Create a for loop to display all the added objects in the
SortedList Grades of the students using GetKey.
2. Create a program that defines a delegate for performing
basic arithmethic operations on two numbers.
3. Create a delegate named DelIntVal that contains two
parameters of int data type name getNum1 and getNum2.