CSCI 265: Fall 2024 Final Exam
- PLEASE CLEARLY PRINT YOUR NAME ON YOUR EXAM BOOKLET
- You have threee hours to complete the exam (9am-noon)
- There are 8 questions on the exam, worth 10 marks each, for a total of 80 marks,
attempt all questions.
- Answer in the exam booklets provided, extra booklets are available if needed.
- Many of the questions are quite open-ended, the expectation is that you spend roughly
20 minutes per question.
- The exam is closed book, closed notes, and no calculators, phones, laptops or other electronic aids
of any form may be used during the exam.
You are permitted one 8.5" x 11" double-sided sheet of notes ("cheat sheet").
- Be sure to check your exam to make sure all eight questions are included.
Question 1: Version control [10]
Suppose a small group of second year students has a project they want to
work on together outside their regular coursework, and they have
been using a github repo with the following branches:
- A 'main' branch for the stable/production version.
- A 'dev' branch for most day-to-day development.
- A 'high performance' branch off of dev for
a customized newer, faster version of the product.
- A 'test' branch that was intended for testing but
has never actually been used.
At the moment, they have no structured plan/process for properly updating the various branches.
They feel the current contents of the 'high performance' branch are ready to be tested and
potentially become the new production version.
Outline a process for the team to follow to use their various branches to perform
testing (assume they do actually have test cases/software ready) and, if successful,
update the production branch. Be sure to point out both the strengths and weaknesses
of your proposed plan.
Question 2: SDLCs and testing [10]
In our team projects this term we waited until phase 5 to officially discuss/address the
testing of the product, and even then focused on a client-side acceptance testing
plan that would (in theory) be applied after the product was completed.
(i) Propose a revised SDLC that would address testing more thoroughly and
beginning test planning from an earlier point in the term.
(ii) Discuss how your revised SDLCwould fit with the CSCI 265 lecture material,
including any suggested changes for the order and/or depth that topics are addressed in.
Question 3: Requirements [10]
Write a detailed set of requirements for a program to be written by CSCI 159 students (students
taking their first course in C++ programming). The general concept for the program is
as follows:
The program allows the user to select a base for the representation of integers
(binary, octal, decimal, or hexadecimal), then
enter a positive integer value in the chosen base,
then have the equivalent value displayed using roman numerals.
Question 4: Design [10]
In object-oriented languages, the data fields of a class are an example of coupling
between the methods of the class since they are values that can be accessed and manipulated
by all the methods.
Discuss if/how/why this is an accepted norm in spite of the fact that,
in the context of cohesion, this would appear to be undesirable.
Question 5: Make/automation [10]
For each of the actions below recommend whether they would be best accomplished
using makefiles or using scripts and briefly justify each recommendation.
(Assume a linux environment and they are being written by students
who have successfully completed CSCI 265.)
- Creating an archive of all project source code files in a repository.
- Removing all the built object and executable files in a repository.
- 'touch' all the .md files in all subdirectories in the repository.
- 'touch' all the .cpp files in all subdirectories in the repository.
- print a list of all the object files and executables that are in need of recompilation.
Question 6: Code re-use [10]
Consider the following project and data structure to be implemented in C++:
The project
- A second year student is building their own bug tracking software in C++,
partly for more C++ practice and partly to keep track of things they need to fix
in different course assignments.
The data structure
- The student is implementing a lookup table class in which they can store and retrieve bug reports as
key/value pairs where both keys and values are strings. The intent is that the value portion
contains the full text of a bug report while the key is a unique text bug id/name.
(i) Is it worth templating the data structure? Justify your answer.
(ii) Is it worth adding an stl-style iterator to the data structure? Justify your answer.
(iii) Is it worth seeking a third party implementation of the data structure? Justify your answer.
Question 7: Testing [10]
Consider the main routine and the insert and search functions described below, then:
(i) Outline a process for
unit testing the insert function in isolation, including outlining any needed stubs/drivers.
(ii) Discuss the practical challenges your proposed process/stubs/drivers would
cause for the testers (e.g. in creating test cases, running test cases, and evaluating the results).
Be sure to state any assumptions you find it necessary to make.
The program overall
- The program fills an array (of a size chosen by the user) with numeric values,
one at a time, preventing duplicate entries and keeping the array sorted as it goes
(i.e. each new element is inserted into its sorted position).
Following each (non-duplicate) entry, the program runs a statsCheck function
on the current array content.
The main routine
- The main routine in the completed program would identify how many values the user
wished to process, create an (empty) array of the specified size, obtain (and error
check) each of the values from the user, calling insert for each value as it is obtained.
The search function
- This function takes a (sorted) array, its size, and a key value as its parameters
and returns true if the key already appears in the array data, false otherwise.
The insert function
- This function takes a (sorted) array, its size, and a key value as its parameters,
calls search to check if the key is already in the array
- If the value is
not yet present in the array then insert updates the array contents to include
the new value in its correct sorted position.
The statsCheck function
- This function is outside the current scope of our testing.
Question 8: Bug handling [10]
Study the bug report and program description below, then answer questions (i) and (ii).
Program description
- The program is a student's CSCI 159 C++ assignment written and run on the pups.
- The program lets the user enter up to 20 integer values and stores them in
a binary search tree. It then prints the tree contents in sorted order
(via an inorder traversal) and allows the user to search for any one value
in the tree.
Bug report
- When run on some data sets the program works perfectly, e.g. if the values entered
are 12, 8, 16, 15, 3, 17, 19 then the traversal outputs 3, 8, 12, 15, 16, 17, 19
and searches successfully find each of the values.
- When run on other data sets though, the print and search don't produce the correct
results. For instance, if the same values as above are entered in the order
12, 8, 3, 17, 15, 16, 19 then the traversal outputs 3, 8, 12, 16, 15, 17, 19,
and the search can't find 16 (though searching for the other values still works).
(i) Is there enough information in the report to allow you to make a reasonable
start on tracking down the source of the problem in the student's code? If not, then identify the most crucial
missing elements from the report and why you would need them.
(ii) Suppose you are mentoring an average first year computer science student faced
with this bug:
give the student a short guide on how to narrow down the source of this problem, making sure
your guide is very explicitly focused on this specific program and this specific bug.