e01 : Midterm 1
num | ready? | description | exam date |
---|---|---|---|
e01 | true | Midterm 1 | Thu 10/24 12:30PM |
Instructions for the exam
- You may bring one 8.5” x 11” piece of paper with notes on both sides. This paper will be collected along with your exam, so make your own copy if you would like to keep it.
- You may add your notes to this COLLABORATIVE DOCUMENT.
- No calculators or phones are allowed in the exam
- There are no makeups for this exam
- You must write your name on every single sheet of paper including your notes
- We will provide you with scratch paper
- We will provide you the table of operator precedence
- Seating is assigned, check your seat prior to the exam here: Seating Chart for midterm 1
- The layout of the room is available here
Reference material
You are expected to know the material from the following lectures, labs and homeworks. Please be sure to review the code from lecture which can be found in the lecture notes (different from lecture slides)
Post Midterm material
- Link to code written in lecture: https://github.com/ucsb-cs16-mirza/ucsb-cs16-f19-lectures
- Lecture 1 to lecture 7
- Homeworks 1 to 4
- Labs 0 to 2
Pracice problems:
For topics on lectures 1-7, use the following practice problems. Please solve the problems on your own and don’t just refer to the provided solutions:
We recommend that you try these problems after you have studied/contributed to the collaborative notes (see above) and gone through the labs, homeworks and lectures.
Midterm Study Guide
- Write the skeleton of a simple C++ program - see the hello world example covered in lecture
- Write code that involves passing parameters to main
- Read and write to standard input, output with cin, cout - you should be able to write code that uses these concepts, identify the difference between cout, exit and return
- Basic unix commands (covered in labs): cp, mkdir, ls, pwd, cd
- An understanding of what compilers are, the compilation and execution process of C++ programs:
- What is g++? What are the inputs and outputs ?
- What is the difference between compiling and running a C++ program?
- How can you ask g++ to use the c++11 libraries when compiling your C++ program
- What are compile-time errors?
- What are run-time errors?
-
How to pass arguments to main refer to labs that used this concept
-
While loops, for loops, do while loops (very important)
- Functions
- An understanding of how parameters are passed to functions, and how values are returned from a function
- Difference between function that prints to output and function that returns a value
- Function declaration, definition and call
- Writing functions similar to those in the labs
- The ability to use variables and basic data types in the type of programs covered in class:
- Identify valid and invalid ways to name variables in C++ - Please refer to book on this
- Identify invalid use of variables: For example using a variable in an expression or assignment before declaring it
- Different ways of initializing variable:
int x =10; int x(10); cin>>x;
- Difference between variable declaration and initialization.
- What is the default value given to uninitialized variables in C++ and why this can be a problem
- The ability to debug and write code that involves flow control structures taught in class and used in labs. Pay attention to syntax, and the ability to use each appropriately to solve problems similar to those provided in the labs
- If else statements, multiway if-else statements
- For, while and do-while loops, nested for loops (used in lab02)
- Identify the occurrence of infinite loops
- Program translation
- Steps (preprocessing, compiling, linking)
- Arguments to g++ (creating objectfiles, differences between object files and executable)
- Write a simple Makefile to compile a program that is split between multiple files, or to compile multiple programs
- Number conversions: hex, decimal, binary
Past exams
You may also refer to all the past exams. Please note that some questions on these exams may refer to labs that you have not completed so far. You will only be asked questions related to the labs you have completed. The past exams should however provide some information on the expected difficulty and approximate format of the exam. Please note that there may be differences in content as well.