Sample Final Exam Questions

CS 1130 Visual Basic

The exam will be a pencil and paper exam and have two parts. The first part will consist of 10 relatively small tasks that ask you to trace, describe, or produce a small chunk of code. These items will be similar in nature to what you saw on the practice/learning activities. Some are true/false or multiple-choice and some are open-ended. When grading this first part, the closed response questions will be worth a half or a third as much as the open-ended items. The second part of the exam will be a single programming problem that addresses the elements included in the project:  array/collection/structure;  conditional execution (If);  file reading & writing;  looping (For...Next, Do Until ..., Do While ...). For this second part, I will look at each category (identified below) and assess understanding demonstrated to be excellent—no problems,  good—very minor problem(s), okay— notable problem(s), marginal—substantial problem(s),  or non-existent and give appropriate credit.

The exam will be closed-book, closed-note. The bulk of the credit (or deduction) will be due to the conceptual solution to the problem. I will deduct nothing for a few simple syntax errors. To study for the exam, I suggest you work as many of the sample problems as you can by writing the solution on paper and then testing it out in a program.

The Practice Problems

Each of the problems below is an example of a final exam problem. The expectation is that you will declare and initialize the variables needed to solve the problem and produce the code that correctly achieves the indicated results. Note: Each solution requires the use of an array or control with a set of items.

  1. Place file data in one of two list boxes

    Read email addresses from a file and put each into one of two list boxes. Those containing uni.edu should be placed in one (lstUNI) and all the others placed in another (lstOther). Assume the file is called emails.txt and is located in the bin/debug folder.

  2. Write list box data to a file

    Examine all the elements in a list box (lstEmails) and write/copy the UNI ones (those that contain uni.edu) to a file (uniEmails.txt) that will be in the default location (bin/debug folder).

  3. Above & below average

    Read a set of integer values into an array from a file (numbers.txt) that will be in the default location (bin/debug folder). (There will be at most 100 values.) Process the values to calculate the average, then process them again to count the number of items above average and the number of items below average. Report the average and the counts via a message box.

  4. Text analysis I

    Read text from a file (words.txt, in the bin/debug folder) to determine the average word length. Assume words will have one or more spaces after them. Do not include the punctuation characters of   .   ,   ?   ;   :   !   at the "end" of a word as part of the length of the word.

  5. Text analysis II

    Read text from a file (words.txt, in the bin/debug folder) and produce the counts of the various word lengths (count all words of length 15 or greater as length 15). Report the counts by producing a string that will be displayed in a message box.

  6. Sales receipt

    Process the items in a list box (lstOrder) in a pizza ordering app to prepare a receipt for the order. Each item in the list box will have a description and a price. The price will be preceded by a dollar sign and be at the end of the list item. The receipt is to contain all the items in the order list box, then a subtotal for the cost of everything, then a value for sales tax (7.5% of the subtotal, then a value for tip/gratuity (15% of the subtotal), and finally the overall total (subtotal + tax + gratuity). Each of ordered items and the last three values should have a description in front of the value. The receipt is to be written to a file (receipt.txt, in the bin/debug folder).