EECS 280 Midterm | UPDATED Questions with 100% Verified Answers
Question:
Types of testing
Answer:
Unit testing, system testing, Regression testing
Question:
Unit Testing
Answer:
- Test smaller, less complex, easier to understand units
- One piece at a time (e.g., a function)
Question:
System testing
Answer:
- Test entire project (code base)
- Do this after unit testing
Question:
- Regression testing
Answer:
- Automatically run all unit and system tests after a code
change
Question:
Steps to test:
Answer:
1. Understand the specification
2. Write tests
3. Check the results
Question:
Arrays
, Answer:
An array is a fixed-sized, indexed, homogeneous aggregate
type (a collection of items, all of the same type.)
Question:
declare arrat
Answer:
int bar[4]; // Array, int bar[4] = {1, 2, 3, 4}; // Static Initializer
Question:
accessing array elements
Answer:
- You can access the contents of an array using an "index".
The index of the first array element is zero, the next is one,
and so on.
- Each individual element is used just like a regular int, so all
of the following are legal: 1 // array = {1, 2, 3, 4} 2 array[1] =
6; 3 // array = {1, 6, 3, 4} 4 ++array[1]; 5 // array = {1, 7, 3,
4} 6 array[0] = array[1]; 7 // array = {7, 7, 3, 4}
Question:
declare a pointer to int
Answer:
int *foo
Question:
bar is a pointer to int
Answer:
1 int foo; 2 int *bar; 3 bar = &foo; 4 foo= 1;
- The symbol "&" means "address-of". So, this statement says
that "bar is a pointer to an integer, initialized to the address of
foo
Question:
Types of testing
Answer:
Unit testing, system testing, Regression testing
Question:
Unit Testing
Answer:
- Test smaller, less complex, easier to understand units
- One piece at a time (e.g., a function)
Question:
System testing
Answer:
- Test entire project (code base)
- Do this after unit testing
Question:
- Regression testing
Answer:
- Automatically run all unit and system tests after a code
change
Question:
Steps to test:
Answer:
1. Understand the specification
2. Write tests
3. Check the results
Question:
Arrays
, Answer:
An array is a fixed-sized, indexed, homogeneous aggregate
type (a collection of items, all of the same type.)
Question:
declare arrat
Answer:
int bar[4]; // Array, int bar[4] = {1, 2, 3, 4}; // Static Initializer
Question:
accessing array elements
Answer:
- You can access the contents of an array using an "index".
The index of the first array element is zero, the next is one,
and so on.
- Each individual element is used just like a regular int, so all
of the following are legal: 1 // array = {1, 2, 3, 4} 2 array[1] =
6; 3 // array = {1, 6, 3, 4} 4 ++array[1]; 5 // array = {1, 7, 3,
4} 6 array[0] = array[1]; 7 // array = {7, 7, 3, 4}
Question:
declare a pointer to int
Answer:
int *foo
Question:
bar is a pointer to int
Answer:
1 int foo; 2 int *bar; 3 bar = &foo; 4 foo= 1;
- The symbol "&" means "address-of". So, this statement says
that "bar is a pointer to an integer, initialized to the address of
foo