e01 : Midterm
num | ready? | description | exam date |
---|---|---|---|
e01 | true | Midterm | Wed 11/02 11:00AM |
Midterm exam time and location
In person in the regular lecture hall at the regular lecture time: BUCHN 1920 11a - 12:15p
Instructions for the exam
- The midterm is in person, closed book, closed notes.
- 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
- We will provide you with scratch paper
- Seating is assigned, check your seat prior to the exam at this link:
https://docs.google.com/spreadsheets/d/15DQZENEcPsTiGA5kgfzkWhJAUqLuG5X6fNXnSdjj6ME/edit?usp=sharing
Reference material
You are expected to know the following material
- lectures 1 - 9,
- labs 1 - 4
- homeworks 1 - 9.
Please be sure to review the code from lecture which can be found in the lecture notes (different from lecture slides)
- Link to code written in lecture: https://github.com/ucsb-cs16-f22/lectures
Pracice problems:
- You may contribute to this COLLABORATIVE DOCUMENT
- Practice Problems -I
- Solutions to the practice problems -I
- Concept Inventory on Pointers and Arrays.
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, nested 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
- The role of the compiler
- Arguments to g++ (creatin executables with a name)
- Data representation:
- Conversions between difference bases using positional encoding (hex decimal binary)
- Finding the range of values with fixed numbers of bits for unsigned representation
- Arrays and vectors:
- declaration
- initialization
- representation in memory (for arrays only)
- accessing elements via index-based and range-based for loops
- passing arrays to functions
- passing vectors to functions in different ways: by value, reference, and address.
- tracing/writing code involving arrays and showing program dynamics via pointer diagrams
- Pointers:
- purpose
- declaration, size of a pointer
- initialization to null value, initialization using ‘&’ operator
- pointer diagrams showing relationship between pointer and pointee
- derefencing pointers using the ‘*’ operator
- assignment involving pointers: making two pointers point to the same object
- changing where a pointer points to
- tracing/writing code involving pointers and showing program dynamics via pointer diagrams
- References:
- Definition
- Assignment
- Call by reference
- Differences between pointers and references (when would you use each and why)
- tracing/writing code involving pointers, references and showing program dynamics via pointer diagrams
Past exams
You may also refer to all the past exams. Please note that some questions on these exams may refer to labs/concepts 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.