EXAM 1 Overview FORMAT Bring a scantron Some T F Some Mult Choice Some Problem Solving NOT open notes book Exam 1 Review 2 1 Topics Covered 1 2 3 4 5 6 7 8 Basic Input Output Arithmetic in C Selection Repetition Functions Arrays Searching Sorting 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 Don t Cram Pace your studying Your brain needs protein try not to eat a high carb meal 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 4 Exam 1 Review 2 B a s i c s 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 O u t p u t 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 3 I n p u t 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 7 Exam 1 Review A r i t h m e t i c 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 4 A r i t h m e t i c Order of Precedence unary How would the following statement s be evaluated a 4 b 3 c a 10 b 9 F u n c t i o n s What is the order of precedence 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 5 F u n c t i o n s 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 6 F u n c t I o n s 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 7 H e a d e r F i l e s A R R A Y S 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 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 8 A R R A Y S 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 have in one array T F Given the declaration int someAr 20 int someAr2 20 cout someAr 3 outputs the 3rd element in the array cin someAr 20 will produce a compiler error someAr someAr2 will transfer all values from someAr2 to someAr 17 A R R A Y S What is the advantage of passing by reference Which of the following is true about an array a Arrays are always passed by reference b The name of an array is the address in memory of the first element c Array subscripts always begin at 0 …
View Full Document