ࡱ> TVS5@ bjbj22 "VXX.8JT.)<.."PPPPPP)))))))$*R+-hB)PPPPPB)PPW)%%%PPP)%P)%(%%%P" ޑ `%)m)0)%-j$-%..-%DPP%PPPPPB)B)..|%4..1. Having a loop within a loop is known as (a) recursion (b) doubling up (c) nesting (d) redundancy ANS: (c) 2. What is the highest value of the loop counter in a for statement with the following header? for ( i = 2; i <= 12; i += 2 ) a) 2 b) 10 c) 12 d) 14 ANS: (d) 3. __________ values can consist of the digits 0 through 9 and the letters A through F. a) hexadecimal b) binary c) octal d) decimal ANS: (a) 4. Which of the following is not specified in the following code segment: for ( c = 1; c <= 10; c++ ) a) increment of the loop counter c b) initial value of the loop counter c c) loop-conditional expression for c d) statements in the loop body ANS: (d) 5. The goto statement is which of the following? (a) an unconditional branch (b) a bad programming practice (c) used to change the programs flow of control (d) all of the above ANS: (d) 6. If a dowhile statement is used, (a) an infinite loop will not take place (b) the counter must be pre-incremented if it is also the conditional expression (c) the body of the loop will execute at least once (d) an off-by-one error will not occur ANS: (c) 7. A for statement is to count from 1 to 20 and explicitly mentions the 1 and the 20 in the for header. Which relational operator would be used in the loop-conditional expression? a) > b) >= c) < d) <= ANS: (d) 8. Which statement is true? a) Often, typedef is used to create synonyms for the basic data types. b) Keyword typedef is used to create antonyms (or opposites) for the basic data types. c) Names for structure types are typically defined with typedef to create longer type names. d) The first letter of each typedef name must be capitalized. ANS: (a) 9. How many times will the following program print hello? i = 1; while ( i <= 10 ) { printf( hello ); i = i + 2; } (a) 5 (b) 6 (c) 9 (d) 10 ANS: (a) 10. The for statement header for ( i = 1; i < 100; i++ ) performs the body of the loop for a) values of the control variable from 1 to 100 in increments of 1. b) values of the control variable from 1 to 99 in increments of 1. c) values of the control variable from 0 to 100 in increments of 1. d) values of the control variable from 0 to 99 in increments of 1. ANS: (b) 11. If grade has the value of 60 what will the following code print? if ( grade >= 60 ) printf(Passed); (a) nothing (b) 60 (c) Passed (d) Passed ANS: (c) 12. A recursive function is a function that (a) returns a double (b) takes 3 arguments (c) calls itself (d) is inside of another function ANS: (c) 13. Which is not a repetition structure? a) while b) do while c) for d) do for ANS: (d) 14. What is wrong with this code? int[] = (1, 2, 3, 4, 5); a) The array size must be specified in the square brackets. b) The parentheses should be square brackets. c) The square brackets should be curly braces. d) The parentheses should be curly braces. ANS: (d) 15. What is the final value of ? after performing the following operations? int x = 21; float y = 4.0; float z = 7.0; y = x / z; ? = 5.0 * y; (a) 20.0 (b) 20 (c) 15.0 (d) 15 ANS: (c) 16. What happens if the loop-conditional expression is omitted in a for statement? a) C assumes the condition is false, so the loop terminates. b) A directive error occurs. c) C assumes the condition is true, so the loop executes one more time, then terminates. d) An infinite loop. ANS: (d) 17. Which of the following is not a correct way to initialize an array? (a) int n[5] = {0, 7, 0, 3, 8, 2}; (b) int n[] = {0, 7, 0, 3, 8, 2}; (c) int n[5] = {7}; (d) int n[5] = {6, 6, 6}; ANS: (a) 18. The following program segment will int counter = 1; do { printf( %d , counter ); } while ( ++counter <= 10 ) ; (a) print the numbers 1 through 11 (b) print the numbers 1 through 10 (c) print the numbers 1 through 9 (d) print the numbers 1 through 8 ANS: (b) 19. Which of the following is not true? (a) the first element of an array is the zeroth element (b) the last element of an array is the array size - 1 (c) the position number contained within square brackets is called a subscript (d) a subscript cannot be an expression. ANS: (d) 20. The parameter list is represented by ______ in the following function definition A B(C) {D} (a) A (b) B (c) C (d) D ANS: (c) 21. In a for loop, if the loop-conditional expression is initially false, ________. (a) the body portion of the loop is not performed (b) execution proceeds with the statement following the for statement (c) both a and b (d) none of the above ANS: (c) 22. Arrays are data structures consisting of related data items of the same __________. a) sort order b) subscript c) type d) element ANS: (c) 23. Suppose a program contains the code for (i = 1; i < = 10; i++) n[ i ] = 0; Which statement about this code is true? a) It contains an off-by-one error. b) It contains a syntax error. c) It is initializing the first 11 elements of an array. d) It is initializing successive elements of an array. ANS: (d) 24. The function declaration double mySqrt(int x); (a) defines a function called mySqrt which takes an integer as an argument and returns a double (b) defines a function called double which calculates square roots (c) defines a function called mySqrt which takes an argument of type x and returns a double (d) defines a function called mySqrt which takes a double as an argument and returns an integer ANS: (a) 25. The forcing of arguments to the appropriate types is commonly called __________. a) conversion b) casting c) coercion d) transmuting ANS: (b) CGS3460 Exam#2 2/27/04 Name: ______ ANSWER KEY_______ Professor Jodi Neely-Ritz Signature: ___________________________ PAGE  PAGE 3 Z_jtuv     J U f q {{gɶT$hZyhytCJOJQJRHd^JaJ'hZyh-!5CJOJQJRHd^JaJ'hh-!5CJOJQJRHd^JaJ$hZyh-!CJOJQJRHd^JaJ'hZyh&]0J5CJOJQJ^JaJ$hZyh0CJOJQJRHd^JaJ'hZyh&]5CJOJQJRHd^JaJhwtJCJOJQJRHd^JaJ$hZyh&]CJOJQJRHd^JaJ+;LZjtu    s $ # p@ P a$gd-!gdytgd&]$ # p@ P a$gd&]  7 8 ^ _   ` e f رwggT@'hZyhZy5CJOJQJRHd^JaJ$h hZyCJOJQJRHd^JaJh/CJOJQJRHd^JaJ'h6hZy0J5CJOJQJ^JaJ$hZyhZyCJOJQJRHd^JaJ$hZyh0CJOJQJRHd^JaJ$hZyh0CJOJQJRHd^JaJ'hEUhyt5CJOJQJRHd^JaJ$hZyhytCJOJQJRHd^JaJ'hZyhyt5CJOJQJRHd^JaJ  9 a  P f q r  H p z gdjgdZ&x$ # p@ P a$gdZygdZy$ # p@ P a$gdZ&xgdytf o q r s z | }   p z { | ðxh]J6J6'hZyhyt0J5CJOJQJ^JaJ$hZyhytCJOJQJRHd^JaJhZyhjCJaJhWbCJOJQJRHd^JaJhCJOJQJRHd^JaJ'hZyhj5CJOJQJRHd^JaJ'hZyhj0J5CJOJQJ^JaJ$hZyhjCJOJQJRHd^JaJ$hZyh0CJOJQJRHd^JaJhZyhZ&xCJaJ'h6hZ&x5CJOJQJRHd^JaJh6hZy5RHdz { 1 6 < A Q m h,.5<$ # p@ P a$gdm1 # p@ P gdZygdytgdZ&x  / 4 6 9 < ? A D F H P İİĠxdQQQQ>$hZyhQ0JC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4@4 0Header  !4 @"4 0Footer  !.)@1. 0 Page NumbervOBv b{YDM.  p@ P1$7$8$H$)B*OJQJRH^J_HmH phsH tH V+;LZjtu s9aPfqrHpz{16<AQm h,.5<CKUVs> , F S [ g u     B K X _ u ! P {    % / 7 A B H ] g h '12Yjo8BCk,a<n=KX`ktu$C|QS]^,nopyz{0@0@0@00@000@0@0@0@0@0@000@0p@0p@0p@0p@00p0@0@0@0@0@0@000p@0p0@0p@0p0 00@00@0@0 @000@0@0@000 @0p@0@0p@0p@00p0@0@0@0@0@0@0@0@0@0@0@000@0@0@0@0@0@0@00p0@0@0@0@0@0@0@000p@0p@0p@0p@0p0p00@0@0@000 @0@0@0p@0@0@000@0@0@0@00@0@0@0@0@00000000000000@0 00000000000000@0@0p00@0@0p@0p@0p@0p0p00@0@0@0@0@00000000000p000p0p00p0p0000p0p0p0p0000p0p0000@0@0@0@0@0@0@0@0@0@0( f P Z8Yn !#%&() z <'"$'*!!w~CJ !"%&4 : Y\rx1:@HRY_iv"<C#'QRMO y|AG  4 ; K R E J N P [ ^ b d   7 ; Y\jlryps12@Cr{@DNW[_cjV]%px{33333333333333333333333333333333333333333333333333333333333333333333333333333333333333ZjPrpzQmVy  {   '1o`s   Jodi Neely-Ritz"/&A\c$ ;U?T! !l%&]K\tq>RW& @= _X %"M $"p$A )Z9* A+.', -p/0001Q0H2Ug2=L485WU6v:7|: =c=&>? B^jB/.jI-Y7m_ zEUaT\0YCbkKiIR!l:y7+[>45C KG# {*QTj qPC[otJurjWA`YEuVu0sTW@    @@UnknownGz Times New Roman5Symbol3& z Arial3z TimesQLucidaSansTypewriter"qhմF 'F '!42H ?u|3Jodi Neely-RitzJodi Neely-RitzOh+'0x  4 @ LX`hp3ssJodi Neely-Ritzodiodi Normal.dotRJodi Neely-Ritz197Microsoft Word 10.0@"@~@8F՜.+,0 hp  The Neely-Ritz' A 3 Title  !"#$%&'()*+-./0123456789:;<=>?@ABDEFGHIJLMNOPQRURoot Entry F5W1Table,-WordDocument"VSummaryInformation(CDocumentSummaryInformation8KCompObjj  FMicrosoft Word Document MSWordDocWord.Document.89q