CSCI 159 Midterm and Final Exam Info/Prep
(Fall 2026, Sections F26N01/2)
Midterm
| Sample solutions for each the midterm will be posted on
the lab solutions page after the midterm marking is completed.
|
The midterm will be held in-lecture on Monday October 26th, and is worth 25% of your final grade.
The midterm is hand written (paper/pencil),
closed notes and closed book and no electronics permitted, but the student is permitted to bring one
double-sided 8.5"x11" cheat sheet.
The student's final exam mark can be used to substitute for a missed midterm
or if the final exam mark is better than the midterm mark.
Individual work: as with all work in this course, midterms and final exams must
be strictly individual efforts. The student is not permitted to seek or accept
assistance from other individuals in completing any portion of any exam.
Similarly, students are not permitted to provide assistance to other students
in completing any portion of the quiz/exam. Note that VIU policies consider
both parties to be committing academic misconduct in such situations,
and both parties may incur the resulting penalties. The use of AI tools (e.g. chatGPT) to generate whole or partial solutions is not permitted.
A review session will be held in labs the week before the midterm, and the list of
examinable topics and practice questions will be updated here by that time.
Preliminary topics list:
basics
- basic C++ syntax and the structure of simple C++ programs
- use of constants and variables
- use of the int/long, float/double, char, and bool data types
- basic use of the C++ string class as a datatype
selection
- the use of if/else if/else for selecting different sets of actions
under different conditions
- nested if/else statements
- correct composition of the condition expressions using comparison operators
together with and (&&), or (||), not (!) operators
functions and parameters
- calling functions, passing parameters, and using return values
- writing and using our own functions
- appropriate declaration and use of
pass by value parameters and pass by reference parameters
- writing and understanding recursive functions
and the use of base case(s) and general case(s)
- the use of functions for modular/top-down design of programs
scopes
- understanding and correctly using the three kinds of scope
introduced so far: global, local to functions, local to blocks (if/else/loops)
- understanding how nested scopes work and how variable use is
resolved (which variable from which scope is chosen)
basic use of loops (if we get there by Oct 19/21)
- understanding the three basic types of loop (for, while, do while)
and being able to use them
- understanding the difference between top-tested and bottom-tested loops
Practice questions
Note that past iterations of the course have used various combinations of
handwritten quizzes, single-midterms, dual-midterms, and VIULearn quizzes,
and topics and the order of topics varies a bit from year to year,
so only certain questions from the following will be directly relevant to
this year's midterm.
Old quizzes
2025 quiz 1,
quiz 2,
quiz 3
2024 quiz 1,
quiz 2,
(quiz3 was viulearn),
quiz 4,
quiz 5
2023 quiz 1,
quiz 2,
quiz 3,
quiz 4
(midterms/quizzes 2020-2022 were viulearn)
Old midterms (with solutions)
2019 midterm 1, 2019 midterm 2
2018 midterm 1, 2018 midterm 2
2017 midterm 1, 2017 midterm 2
2016 midterm 1, 2016 midterm 2
2015 midterm 1, 2015 midterm 2
|
Final exam
The final exam will be worth 45% of your total grade and will be held in person
in the gym during the scheduled VIU exam period: (time, date, and location TBA).
The exam must be written at the time/location specified.
Exceptions will only be made for officially documented illnesses or
emergencies, in which case the student is expected to contact their
instructor as soon as possible and arrange
for a make-up exam to be taken as soon as possible. The
make-up exam will NOT be the same exam given to the rest of
the class.
The final exam is closed notes, closed book, no dictionaries,
calculators or electronics permitted. The use of earplugs/protection is permitted,
but the use of headphones/headsets (with or without connected devices) is not.
The student is permitted to bring one double-sided "cheat" sheet to the exam.
This does not have to be hand-written.
Here is a sample cheat sheet,
you're welcome to use this one or expand on it.
I did cram a lot in, but no promises it has everything you'll want on it :)
In addition, prior to the exam you should all receive an email from the Registrar's office
outlining rules for writing exams in the gym. Some of the key points in that include:
- You must display your student card or other valid photo ID on your exam table.
- You must turn off your cell phone for the duration of the exam. In the event of an
emergency you may be contacted through the Registration Centre at 250-740-6400.
- You may not enter the gym more than 30 minutes after the exam has begun. You will
be unable to write the exam.
- You many not bring your backpack, briefcase or large back to the exam table or place
them on the floor by your exam seat. You must leave these items at the side of the gym
before taking your seat. Unfortunately there is no secure storage in the gym for valuables.
Questions and content
The final exam will consist of a variety of question forms,
generally chosen from formats similar to:
- show the precise output from the following C++ program...
- given a set of compiler error messages,
identify all the syntax errors in the following C++ program...
- write a complete and correct C++ program to do the following...
- write a C++ function to do the following...
- modify the following program or function to do the following...
- given the prototypes for a set of functions, write a function that
uses them to do ...
- explain the benefits and drawbacks of the following language feature...
- discuss the appropriate use of the following language feature...
Note that linux will not be explicitly tested on the exam.
In general I assume that by now students are fully fluent with material from the
first half of the course, most of which will be required to successfully
answer almost any question:
- basic C++ syntax rules,
- operators and assignment,
- input/output with cin, cout, cerr,
- libraries and #includes,
- core data types: short, int, long, float, double, char, bool
- variables and constants,
- functions, parameters, and return values,
- if/else statements,
- loops (for, while, and do-while),
- variable scope (global vs local).
The final exam questions tend to heavily emphasize the later material:
- recursion,
- arrays,
- sorting and searching (bubblesort, binary search, linear search),
- null-terminated char arrays and the cstring library functions (strcpy, strlen, etc)
- basic use of the string class,
- structs and arrays of structs,
- pointers and dynamic allocation of arrays and structs,
- perhaps a general/theory question about linked lists.
The final generally consists of 8-10 equally-weighted questions,
though some of those questions will have multiple parts.
A review session will be held prior to the final exam, and the material covered
will consist of course all material up to and including the review session,
including all lectures, labs, lab exercises, quizzes, etc.
Another review session may be offered through the CSCI Help Centre sometime during
the first week of exams: details will be posted if/as they become available.
You will be expected to understand, debug, and write logically
and syntactically correct C++ programs or code segments using
the language features discussed in labs and lectures to that point.
The best way to prepare is to hone your fluency in C++,
i.e. by doing the labs and assignment and writing lots of small practice
programs.
Practice questions from past lab sessions
A collection of past practice questions and sample solutions can be found
here (currently a dozen
questions drawn from key topic areas).
|
OLD MIDTERMS AND EXAMS
The old midterms/exams below are from CSCI 160 versions of the course, with more
of an emphasis on printf/scanf instead of cin/cout and using malloc/free rather
than new/delete, but many of the question ideas/topics are still relevant.