Programming

  1. Describe the special properties of a dictionary
  2. Explain how you would filter elements in a dictionary
  3. Implement a method which filters the elements in the collection
  4. Show how you can test your code in your Program.cs ← Example Answer Not Included ❗

Question 1

A dictionary could be seen as a two-dimentional list known as a Key-Value-Pair Key must be unique in each entry within the dictionary

Question 2

Filtering a dictionary can be done by using a loop and specifying which Keyor Valuematches given input

Question 3

public static Dictionary<DateTime, string> FilterByString(string inputfilter, Dictionary<DateTime, string> inputDictionary)
{
    Dictionary<DateTime, string> filteredLogs = new Dictionary<DateTime, string>();
    foreach(KeyValuePair<DateTime, string> filterTest in inputDictionary)
    {
        if (filterTest.Value.Contains(inputfilter))
        {
            filteredLogs.Add(filterTest.Key, filterTest.Value);
            Console.WriteLine($"Date: {filterTest.Key.ToShortDateString()}, Log: {filterTest.Value}");
        }
    }

    return filteredLogs;
}

System Development

  1. Show how you would use a sequence diagram to describe the interactions between objects, which involve choices (alternatives)
  2. How would you show a method being run internally in a class?
  3. Which diagram can be used to visualize a users interaction with the system as a whole?
  4. Does any diagram exist which can show the relation between classes?