CSC110 Final Exam Study Sheet(this is an excellent topical study sheet for your exam)
Final Exam Topics:(updated 05/02/2018) Closed Book is given 1st. (one point each) This sheet cannot be used on the Closed Book Exam
- Recognizing a C++ statements as the correct C++ prototype.
- Assuming a = 5 and b = 2, which of the following expressions is true?
- The following loop would execute how many times?
- Which of the following is an example of an infinite loop?
- Must the else part of the if instruction must be present in the code?
- Can an if/else instruction contain another if/else instruction?
- Evaluate a C++ expression as true or false (1 or 0) assuming a = 4 and b = 4
- How are the parameters being passed in this prototype (by value or by reference)?
- How is the parameter being passed in this prototype (by value or by reference)?
- The form that an assembler uses: usually short 3 letter mnemonics code to convert to machine language.
- What are the three main sections of a CPU?
- If we decide to use this in our program, what does abs(disc) do?
- What is the name for the special variable that holds the argument being passed into a function?
- What is the name for the reserved word used to make an identifier a constant?
- Choose which if structure tests that the integer variable a is more than a certain number such as 3.
- Choose the correct syntax to test one boolean variable.
- What does “nested” refer to?An if ? Or in a loop?
- The usefulness of using cout < value < endl; to debug a section of C++ program.
- Choose the statement that uses "casting" in a C++ source code line.
- How do you assign an int variable the value of 0?
- What is a common way to add 1 to an int variable named x?
- Does each C++ line of source code end with a semicolon?
- Does each C++ statement end with a semicolon?
- Is there a syntax error in this line of C++ code?
- Give a C++ example of an accumulator.
- Write the code to calculate the tax on a sub total if the rate is 6.5 percent.
- Give two purposes for the + symbol in C++.
- Is the cout < message < endl; useful in a program for displaying diagnostic messages?
- Pseudocode is written in what language. What does it do?
- What is the purpose of the black triangle in the upper right corner of a structure chart?
- What is the purpose of a structure chart?
- Compare a while loop versus a for loop. When is the while generally used? When is the for generally used?
- Why is return 0 found at the end of each main function?
- What is the definition of an array?
- How do we refer to the position number of an array?
- What is the index of the firstelement in an array that contains 80 elements?
- Which instruction is used to initialize an array named oddNumbers to the integers: 1, 5, 9, and 13?
- Which instruction is usually used to display each element of an array?
- What does this C++ code refer to? months[3]
- How do you access the third color in this array: string colors[] = {“RED”, “BLUE”,” ORANGE”, and “BROWN”};
- Which of these lines of C++ code displays a short circuit?
- Given these two bytes, use the AND to predict the outcome.
- Given these two bytes, use the OR to predict the outcome.
- Predict the console output with this if statement.
- Predict the console output with this nested if statement.
- Predict the console output with this compound if statement.
- If a = 2 and b = 5, evaluate (a = = b)
- If a = 2 and b = 5, evaluate (a <= b)
- If a = 2 and b = 5, evaluate (b % a)
- If a = 2 and b = 5, this statement: a ̶ = b; assigns what value to a ?
CSC110 Final Exam Open Book (Closed Book is given 2nd you may use this annotated study sheet on the Open Book Exam.)
The first 25 questions are 1 point each. The latter Free Response Questions vary in point values as indicated.
- Give some examples of logical operators.
- Give an example of a unary operator.
- How many times will this loop call the functionmakeBiscuits()?
- What is the value of the expression (a / b) given these variables: int a = 3; and double b = 4.0;
- What is the value of (a || b) if both are true? If one true and the other is false? if both are false?
- When a function contains value parameters, what happens? What about if a function contains reference parameters?
- Brookshear mentions RISC and CISC computer architectures. What are these?
- Which of the following items is not a reserved word? Do you know where these can be found in your textbook?
- Which C++ preprocessor directive for special math functions such as sqrt() and abs() did we use?
- Have we used a sentinel-controlled loop in one of our programs? If so, what form did it take?
- Which type of loop constructs is especially good for iterating a fixed number of times?
- Which type of loop constructs is especially good for iterating an unknown number of times?
This Fill in the Blank Section is from the Brookshear book
- Vocabulary term to connect the CPU to the computer’s main memory.
- Given these initials (easily found in our textbook), what does the acronym with four capital letters stand for?
- Vocabulary term: the CPU is mounted on the motherboard is called what?
- Vocabulary term for a portion of high-speed memory within the CPU itself.
- What type of computer architecture does the Pentium Class computer have? How about Apple’s G4 and G5?
This section is from the Dale and Weems book
- What is a pre-condition?
- Given two familiar arithmetic operations (which has higher precedence).
- Does the C++ language use short-circuit (or conditional) evaluation of expressions?
- Is this an example of a short-circuit OR expression?
- Is this an example of a short-circuit AND expression?
- Describe what happens in an if/else structure?
- Determine the equivalent expression. For example, what is equivalent to !( a 3)
- Can some lines of pseudocode be used directly as comments in your C++ source code? Why?
Free Response Section (write the correct C++ source code for each situation. 25 points)
26-28. (3 pts.)Write a statement to declare a variable as an int .
29-31. (3 pts.) Using the same variable in question 26, use the assignment operator to set itsinitial value to 0.
32-34. (3 pts.) Write a statement that will add 1 to the value of the variable in question #29.
35-38. (4 pts.) Write an if statement and other necessary line(s) to check to see if the value in question #32 is equal
to 5. And if so, assign that variable to 0.
39-44. (6 pts.) This problem is independent of all others in the Free Response Questions.
Write several lines of C++ to give discount price on a ticket basedon the age of the senior.
45-50. (6 pts.) This problem is independent of all others in the Free Response Questions.
Write only the function that returns a bool to determine a situation. For example:
the sum of two angles is complimentary if they total 90 degrees. (a similar code problem on final exam)
If so, return true, otherwise, return false. Don’t forget to return the values. Use this given signature:
bool isComplementary(int angle1, int angle2)
{
}