COS 126 Quiz 2 1) Every character in the ASCII table has a unique code which is an integer. a) False. Not all ASCII characters have a corresponding integer code. b) False. Not all ASCII characters have a unique code. c) False. For some ASCII characters there is no integer code. d) (a), (b), and (c) e) True 2) The string S is empty if a) its first character is not a letter b) its first character is NOT the null character ( '\0' ) c) ( strlen(S) == 0 ) d) (b) and (c) e) it only has blank characters 3) S1 is a string. char S1[] = "S1 is not really a string. Brackets are empty."; T) F) 4) S2 is a string. char S2[999] = "There is something wrong here..."; T) F) 5) S3 is a string. char S3[] = { 'I', 't', ' ', 'i', 's', ' ', 'n', 'o', 't', '\0' }; T) F) 6) S4 is a string. char S4[] = { '\0' }; T) F) 7) In the following declaration, "" denotes a string. char *S5 = ""; T) F) 8) When printed, S4 from 6) and S5 from 7) produce the same result. T) F) 9) Given the following definition of S7: char *S7 = " "; Is the following true? ( strlen( S7 ) == 0 ) T) F) 10) How many characters do we need to store the following string? "This is a string" a) 13 b) 16 c) 17 d) 18 e) 19 11) EOF is a character. T) F) 12) We can print strings like this. char S8[3]; S8[0] = 'O'; S8[1] = 'K'; S8[2] = '!'; printf("%s", S8); T) F) 13) Both printf's produce the same output. char S91[] = "Should not work"; printf(S91); printf("%s", S91); T) F) 14) Both printf's produce the same output. char S92[] = "100%does it right"; printf(S92); printf("%s", S92); T) F) 15) The following 'if' statement can be used to execute the function 'do_something' if the expression S10[i] refers to: if ( S10[i] == '\0' ) do_something(); /* Note, 'i' is an initialized integer variable and 'S10' is a string */ a) the end of string 'S10' b) the beginning of string 'S10' if it is empty c) the middle of nonempty string 'S10' d) (a) and (b) e) (a) and (c) 16) "ABC" is a string. char *S11 = "ABC"; T) F) Mon Oct 7 10:29:54 EDT 1996