Exam #2 will be given on **Wednesday, November 2nd** during regular class hours. It will begin at 2pm and you will have 75 minutes to complete the exam. The exam will cover the discussion about binary numbers and logic gates, as well as Chapters 1-4 and 5.1-5.4 of Gaddis. No notes or reference materials will be allowed for use during the exam. You will be allowed a calculator to check your math, but you probably won't need it.

The format of the exam will be as follows:

**Multiple Choice.**There will be a series of multiple choice questions to test your basic knowledge of terms and problem-solving concepts.**Short Answer.**You will be asked to define, identify, or explain various problem-solving concepts based on the material that has been discussed in lecture.**Problems.**In this section, you will be asked to solve problems. For example, you may be given C++ coding segments and asked to describe or list what the output would be. Alternatively, you may be asked to write a short segment of C++ code to perform a particular action. These problems will be similar to the lab activities and homework you have completed for this class.

**Binary Numbers and Logic Gates**

- Be able to convert a number from binary to decimal
- Know the symbols for the basic logic gates (NOT, AND, OR, and XOR)
- Know how to complete a truth table for a simple circuit
- Be able to convert a decimal number to binary using either the Table Method or the Quotient-Remainder Method

**Gaddis, Chapter 1 - Introduction to Programming**

- Know the definitions to program and programming
- What is machine language? What is the difference between low-level and high-level programming languages?
- Describe the steps (in order) to go from source code to an executable file
- Know the five common elements of all programming languages
- Understand the steps of the programming process

**Gaddis, Chapter 2 - Introduction to C++**

- What is the cout object and how is it used?
- How do you move to a new line in a cout statement? What are your two options?
- Describe the purpose of the #include directive
- How do you add comments to C++ code? What are your options?
- Know how and why variables are declared (or defined).
- Be able to give examples of C++ key words
- Be able to identify legal identifiers from illegal identifiers
- Understand the five different
**categories**of data types we discussed - What is variable initialization and how is it accomplished?
- Be able to specify the difference between declaring/defining a variable and intitializing a variable.
- Understand variable scope. What is a scope error?
- Understand the basic arithmetic operators and how to use them

**Gaddis, Chapter 3 - Expressions and Interactivity**

- Know how, when, and why you would use getline, cin.get(), and cin.ignore() statements
- Be able to interpret and use common stream manipulators (setw, setprecision, fixed). What header file must you include for the stream manipulators to work?
- Be able to translate between a mathematical expression and C++ syntax
- Understand type conversions and know what occurs when a type conversion takes place between C++ data types
- Be able to use and understand multiple and combined assignment statements
- Give examples of common mathematical functions and be able to properly use them (Table 3-13). What header file must be included for the math functions to work?
- Understand how to generate (pseudo)random numbers in C++ and the purpose of the seed value

**Gaddis, Chapter 4 - Making Decisions**

- What is a relational operator? Be able to identify the six major relational operators in C++
- Know how to use and interpret all forms of an if statement (if, if-else, if-else-if, nested if)
- Describe the purpose of input validation, and be able to give real-world examples
- Be able to describe the scope of a variable in relationship to program blocks
- Understand logical operators and be able to use them
- Be able to test variables to determine whether or not they fit within a given numeric range
- Know how to compare characters and strings
- Be able to read and use the switch statement

**Gaddis, Chapter 5 - While Loops! **

- Understand and be able to use a basic while loop
- Know the input validation routine to validate user input using while loops
- Be able to describe mistakes that lead to infinite loops
- Know the purpose of a counter variable and how one is used in a while loop
- Understand the increment and decrement operators (prefix vs. postfix)