The questions on Test 2 are based on the topics we have covered recently in class and used in Assignments 3 and 4. The material includes:
The test includes true-false questions, multiple-choice questions, and some questions needing written answers (long or short), including some coding.
There are web pages on some of these topics. You may find it useful to look at the quiz questions.
You should make sure you understand:
Exceptions
We have four key words for exceptions: try, throw, catch and finally. You need to understand how they are used. What argument does catch have? What argument does throw have? Why is a finally block useful?
Bear in mind some examples of exceptions: array subscript out of bounds, trying to open a file that does not exist, dividing by zero, etc.
We can invent our own kinds of exceptions, typically derived from the Exception class. An exception normally has several constructors.
Sometimes we use a "using" block. Is that related to exception handling?
Database
Think about the steps involved in using a database. We need a connection string and an SQL statement, but then what do we do with them?
What are some of the tasks we can do with an SQL statement?
What are the methods we have used with a SQLCommand? What do they return? Which method would I use for each of these:
If we do a query, the results come back as a table. How do we examine the table of results?
Events and Delegates
Is there a key word "event"? Is there an Event class?
How many arguments does an event handler have?
Is there a Delegate class? Is there a key word "delegate"?
How do we create a delegate and assign a method to it?
Sometimes we refer to a delegate as a kind of template class in which the template argument is the signature of a method. If you think of an event as a kind of delegate, what is the signature of the methods involved?
Charts
How is the DataPoint class related to the Series class?
Can we display more than one series of values in a chart at the same time?
What happens if we delete all the points from a Series and the chart has only that one Series?
What are some of the chart types we can use? Do they all make sense for all kinds of values? For instance, if we have both X and Y values, would a pie chart make sense?
A Few practice problems:
By the way, there is a File.Exists method, so we might be able to do all this without exception handling.
Define a delegate which can refer to a method which returns nothing and has one String as an argument. Create a variable BigM of that delegate type. Attach the three methods to it and execute it with the string "AbCdEf".
Now remove the three methods from BigM.