1 EXAM 1 - Overview FORMAT Bring a scantron Some T/F Some Mult Choice Some Problem Solving NOT open notes/book Exam 1 - Review 22 Topics Covered 1. Basic Input/Output 2. Arithmetic in C++ 3. Selection 4. Repetition 5. Functions 6. Arrays 7. Searching & Sorting 8. Structs and some other smaller topics like files Exam 1 - Review 3 Some tips – avoiding test anxiety Get a good nights rest ● I know this is tough, but you don’t think as well without sleep Don’t skip a meal before an exam ● Your brain needs protein try not to eat a high carb meal Don’t Cram! Pace your studying ● Try not to put it off until the last minute ● If you pace yourself you will be prepared Study with classmates so you can compare notes ● don’t discuss the exam just before coming in ● their anxiety may impact you Take deep breaths relax yourself ● Thing positive thoughts remind yourself that you are prepared Don’t get bogged down on a question ● answer the questions you know quickly go back to the others Ask Questions ● Calm yourself before you come in… Avoid being late Exam 1 - Review 43 T/F A C++ identifier may not begin with a digit or an underscore. What is a literal constant? What type of loop should be used for a program segment that should sum a list of positive integers (it is unknown how many inputs the user will provide_? What should the LCV be? What should the sentinel value be? When should you initialize the LCV, for each loop? When should you update the LCV, for each loop? 5 B a s i c s What is this symbol <<? What can be on the left side of the insertion operator? What can be on the right side of the insertion operator? Which manipulator(s) would you use output in columns ? What are the escape sequences? Which output manipulators would you use to format floating point numbers? Know how they work together Exam 1 - Review 6 Ou t p u t4 What is this symbol >>? What can appear on the left side of the extraction operator? What can appear on the right side of the extraction operator? When do you have to use .ignore() when reading in c-strings or strings? What function do you use to get a line of characters and place it in a string T/F cin always reads directly in from the keyboard Exam 1 - Review 7 I n p u t What is the difference between type coercion and type casting? How would the following statement be evaluated? in1 = ( fn3 = (in2 = 5) * (4 / 8.0) ) * 2; Rewrite the following using combined operators: The remainder of n1 divided by (n2 * 12) with the value stored in n1 Also understand Boolean expressions and the conditional operator. 8 A r i t hme t i c5 What is the order of precedence? How would the following statement s be evaluated? a = 4; b = 3; c = --a + 10 * b++; 9 A r i t hme t i c Order of Precedence () ++, -- ! (unary) * / % + - < <= > >= == != && || = += -= *= /= %= T/F If a function contains a statement that changes a value parameter, only the copy of the argument is changed, not the original. How do you declare a function? Where does the prototype go? What is the scope of a local identifier? T/F The scope of a value parameter is identical to the scope of a local variable declared in the outermost block of the function body. T/F In C++, corresponding arguments from a calling function and parameters from a called function must have the same name. When would you use a void function? 10 F u n c t i o n s6 How do you return multiple values from a function? What is a side effect? How can we avoid side effects? Parameter passage by reference is used if a parameter's data flow is a) one-way, into the function b) one-way, out of the function c) two-way, into and out of the function T/F When passing by value data flow is one-way – into the function What type of arguments can be sent from the calling function when passing by reference? 11 F u n c t i o n s What type of arguments can be sent from the calling function when passing by value? T/F All functions should have a return statement. If a module is supposed to compute and return the average of five numbers, which is more appropriate a value returning function or a void function? T/F Functions must have a return data type What should the return data type for main be? What is the advantage of using functions? 12 F u n c t I o n s7 What are the three steps in the function process Where do each of the steps above occur Declare a function that is passed two integers representing a sum and a count and returns an average. Declare a function that returns the sum & avg of an integer array. T/F You can only have 1 return statement in a function What is an advantage of passing by value? 13 F u n c t I o n s What is a disadvantage of passing by value? When we pass by reference what is passed to the calling function. What is a disadvantage of passing my reference? How do you pass by reference? 14 F u n c t I o n s8 T/F You can put executable code in a header file. T/F It doesn’t matter what order the directives and declarations appear in a header file. What order should the directives appear and why? What are these lines in a header file for? #ifndef MYHEADER_H_ #define MYHEADER_H_ #endif Does the extension for your header file matter? How do you include a user-defined header file? 15 H e a d e r F i l e s What is an array? Is this a valid statement: firstArray = secondArray; Is this a valid statement: if(firstArray == secondArray) T/F an array is a composite data type. Why should we use constants for array size? How do we initialize an array? 16 A R R A Y S9 T/F An individual component of an array cannot be passed as an argument to a function. The entire array must be sent. How many different data types can you …
View Full Document