Unformatted text preview:

COP 3014 Exam 2 P a g e 1 COP 3014 Exam 2 Fall Term 2012 Your name Last 4 of FSUSN INSTRUCTIONS READ CAREFULLY All answers must be written on the scantron sheets provided by the teaching staff at the Instructor A Tyson December 12 2012 exam Use a 2 pencil to fill in your answer sheet Erase all changes very clearly Fill in the following information fields on your answer sheet as follows LEFT JUSTIFY any entries which are filled into boxes and bubble areas Instructor A Tyson Course COP 3014 Section 01 Form A Date enter current date Name Print your FULL name in the boxes last name first then after that your first name and fill in the bubbles below to code your full name into the test Provide your name as it is stored in FSU Registrar s office records i e no nicknames and no middle name instead of first name Special Coding Section print your exam number in the boxes and fill in the bubbles to code it into the test exam number is in upper right corner of exam paper front page Identification Number print the last 4 digits of your FSUSN in the boxes and fill in the bubbles to code it into the test Make absolutely sure your full name is correct both where it is written and in the bubbles which you fill in because your name identifies your exam and your grade No devices papers or books of any kind are allowed in the exam room with the exception of exactly one 8 1 2 x 11 crib sheet If you are seen with anything other than a pencil an eraser a ruler and this crib sheet you will be required to leave and your exam grade will be a zero Turn in your scantron sheet and your exam paper to the teaching staff when you are finished Show the teaching staff your FSU ID when you turn in your exam materials sign the class roster in the box next to your name and be sure that your exam number is recorded on the class roster This exam contains 16 pages There are 50 questions Each question is worth 2 points for a point total of 100 COP 3014 Exam 2 P a g e 2 Highest precedence For Reference Use C Precedence Rules partial static cast Scope resolution operator Dot operator member selection Array indexing Function call Postfix increment operator placed after the variable Postfix decrement operator Prefix increment operator placed before the variable Prefix decrement operator Not Unary minus Unary plus dereference address of complement new delete delete sizeof type older form of type cast member selection object pointer to member member selection pointer pointer to member Multiply Divide Remainder modulo Addition Subtraction Insertion operator output Extraction operator input Less than less than or equal Greater than greater than or equal Equal Not equal And Or Assignment Add and assign subtract and assign Multiply and assign Divide and assign modulo and assign conditional operator throw throw exception comma operator Lowest precedence COP 3014 Exam 2 P a g e 3 TRUE FALSE General Answer the following questions with true or false Use A on your answer sheet to choose true Use B to choose false 1 A compiler translates a high level language program into the corresponding machine and or assembly language program 2 A double value assigned into an int variable is automatically rounded to the closest int 3 The following two statements are semantically equivalent have the same value in all cases given that comfortable is a bool variable and temp is an int a comfortable temp 60 temp 85 b if temp 60 temp 85 comfortable true else comfortable false 4 When underflow occurs in an attempt to calculate a float value it is due to trying to calculate an exponent which is out of range 5 A switch statement selector may be an expression that has a value of type int char bool or enum 6 In the statement cin XXXXX the XXXXX must be a variable name not a constant or arbitrary expression 7 In the following code the pair is required for the for loop to work correctly for count 1 count 100 count if count 2 0 cout even endl else cout odd endl 8 When encountering the statement a C compiler automatically allocates an array of 11 char elements 9 If a function performs two unrelated tasks we would say that it is not functionally cohesive 10 We know that sizeof double is always twice the value of sizeof float for all computing platforms because this is guaranteed by the ANSI standard for C 11 When a variable is declared in the main function all other functions in the program can access it directly by its name that is without passing it as a parameter char myString summertime COP 3014 Exam 2 P a g e 4 12 Reference parameters in the parameter list of a value returning function are syntactically legal but are generally considered poor programming style 13 Given the following declarations enum Presents MONEY CDS CLOTHES BOOKS GAMES Presents thisGift The following is a valid assignment thisGift BOOKS 14 Given typedef double ListType 100 int lcv ListType list then the following contains an off by one error if the code is intended to print all of the array elements lcv 0 while lcv 100 cout list lcv endl lcv 1 15 When using an interactive debugger a breakpoint is the point at which a program containing a runtime error crashes breaks 16 A struct may contain a member which is a 2 dimensional array 17 Given that ch is a char type variable the following code correctly prints out only the 26 alphabetic letters in upper case on a machine using the ASCII character set for ch A ch Z ch cout ch 18 An array of 1500 names is to be searched The names are alphabetized The linear search would most likely be more efficient than the binary search when used to find a name in this list because the linear search has lower complexity COP 3014 Exam 2 P a g e 5 19 If the code fragment string inWord cin inWord is executed and the user types Roses are Red eoln as input then the variable inWord will contain the string Roses after the input process completes 20 Given this declaration and executable statement double realNum cin realNum if the user types in 37 and then hits ENTER the input stream cin will enter the fail state MULTIPLE CHOICE General Answer the following questions by choosing the one best answer A B C D or E note that some questions may provide fewer than 5 possible answers 21 Which of the following characteristics of a subprogram would indicate that you probably should write it as a value returning function and not a void function a it reads data from a file b it returns no values c it is less than two pages in length d it returns exactly one float value e none


View Full Document

FSU COP 3014 - Exam 2

Download Exam 2
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Exam 2 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Exam 2 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?