Accounting
Anthropology
Archaeology
Art History
Banking
Biology & Life Science
Business
Business Communication
Business Development
Business Ethics
Business Law
Chemistry
Communication
Computer Science
Counseling
Criminal Law
Curriculum & Instruction
Design
Earth Science
Economic
Education
Engineering
Finance
History & Theory
Humanities
Human Resource
International Business
Investments & Securities
Journalism
Law
Management
Marketing
Medicine
Medicine & Health Science
Nursing
Philosophy
Physic
Psychology
Real Estate
Science
Social Science
Sociology
Special Education
Speech
Visual Arts
Programming Language
Q:
When used with integer conversion specifiers, the letters h and l ("el") are called __________.
a) height modifiers
b) length modifiers
c) complements
d) adjustors
Q:
Which integer conversion specifier would display the hexadecimal digit A?
a) h
b) H
c) x
d) X
Q:
Which integer conversion specifier displays an unsigned decimal integer?
a) u
b) U
c) ud
d) UD
Q:
Which integer conversion specifier displays an unsigned octal integer?
a) oct
b) OCT
c) o (lowercase letter)
d) O (uppercase letter)
Q:
Which statement about the i and d integer conversion specifiers is false?
a) They display a signed decimal integer (when used with printf).
b) They are identical when used with printf.
c) They are identical when used with scanf.
d) They display numbers without a decimal point.
Q:
A printf format control string must be enclosed in
a) slashes
b) /* */
c) single quotes
d) double quotes
Q:
Which is not a formatting capability of printf?
a) representing unsigned integers in binary format
b) representing unsigned integers in decimal format
c) representing unsigned integers in hexadecimal format
d) representing unsigned integers in octal format
Q:
Which is not a formatting capability of printf?
a) left justification
b) centering
c) right justification
d) aligning a column of numbers so that decimal appoints appear one above the other
Q:
Which is not a part of a format control string?
a) conversion specifiers
b) flags
c) field widths
d) printf
Q:
Which of the following does not represent a capability of the printf function?
(a) center justification of outputs
(b) left justification of outputs
(c) right justification of outputs
(d) inserting literal characters at precise locations in a line of output
Q:
Which statement about the standard streams is true?
a) The standard input stream must be connected to the keyboard.
b) The standard output stream must be connected to the screen.
c) The standard error stream is connected to the screen by default.
d) Streams may not be redirected.
Q:
Which of the following is not a standard C formatted stream?
(a) standard input stream
(b) standard error stream
(c) standard output stream
(d) standard redirection stream
Q:
Which function does not use either the standard input stream or the standard output stream?
a) puts
b) getchar
c) gettime
d) scanf
Q:
Which statement is false?
a) Function strerror takes an error number and creates an error message string.
b) Function strerror maps its integer argument into a full text string in a system-dependent manner
c) Function strlen determines the length of a string including the null character.
d) Function strerror does not display its string output.
Q:
The strlen function returns ________.
(a) the number of characters in a string excluding the null character
(b) the number of characters in a string including the null character
(c) the ASCII representation of the character
(d) none of these
Q:
Function __________ takes an error number and creates an error message string.
(a) errorstr
(b) strerror
(c) badstr
(d) strfail
Q:
What memory function of the string handling library copies an unsigned char into a specified number of the leading locations pointed to by its first argument?
a) memcpy
b) memmove
c) memset
d) memlead
Q:
Which statement about function memcpy is false?
a) It copies a specified number of characters from the object pointed to by its second argument into the object pointed to by its first argument.
b) It can receive a pointer to any type of object.
c) The result of this function is defined even if the two objects overlap in memory.
d) Function memmove correctly handles the situation for which memcpy most notably fails.
Q:
Which statement about the memory functions of the string handling library is false?
a) The functions treat blocks of memory as strings.
b) The functions facilitate manipulating, comparing and searching blocks of memory.
c) The pointer parameters to these functions are defined void *.
d) A void * pointer cannot be dereferenced.
Q:
To change the string "ABCDEFGHI"to "aaaaaFGHI" you would use the _________ function.
(a) memset
(b) memcmp
(c) memchr
(d) memcopy
Q:
memcmp would return ___________ for the call
memcmp("Hi, how are you?", "Hi, how are things?", 6);
(a) -1
(b) a negative number.
(c) zero.
(d) a positive number.
Q:
The ___________ function allows characters of one part of a string to be copied into another part of the string.
(a) memchr
(b) memcmp
(c) memset
(d) memmove
Q:
Which statement is true?
a) strtok modifies the input string.
b) strtok makes a backup copy of the input string.
c) The first argument of each call to strtok is the string being tokenized.
d) strtok works only with a set of four predefined delimiters.
Q:
Which statement about strtok is false?
a) It breaks a string into tokens.
b) Subsequent calls to continue tokenizing the same string contain NULL as the first argument.
c) The length of the current token is returned by each call.
d) If there are no more tokens when the function is called, NULL is returned.
Q:
Function __________ searches for the first occurrence in its first string argument of any character in its second string argument.
a) strfirst
b) strstr
c) firstany
d) strpbrk
Q:
Function strcspn returns __________.
a) a length
b) a range of characters
c) the starting and ending positions of a range of characters
d) a char
Q:
Function __________ searches for the first occurrence of a character in a string.
a) firstchar
b) getfirst
c) firstchr
d) strchr
Q:
What is the output of the following statement?
printf( "%s", strspn( "Cows like to moo.", "Ceiklosw " );
(a) Nothing.
(b) 10
(c) 8
(d) e
Q:
Which function would be the most useful for determining if a certain word is contained in a string representing a sentence?
(a) strcspn
(b) strchr
(c) strstr
(d) strrchr
Q:
Q:
When the computer compares two strings, it actually compares the __________ in the strings.
a) number of characters
b) numeric codes of the characters
c) character bits
d) lengths of the leading alphabetic portions
Q:
ASCII and EBCDIC are
a) characters
b) strings
c) character sets
d) character comparison operators
Q:
Function __________ compares up to n characters of its first argument with its second argument.
a) nstrcmp
b) strncmp
c) strcmpn
d) strcmp
Q:
Function strcmp returns __________ if its first argument is equal to its second argument.
a) specifically 1
b) any non-zero value (i.e., true)
c) specifically 0
d) any negative value
Q:
Assuming that string1 = "hello" and string2 = "hello world", Which of the following returns 0?
(a) strcmp(string1, string2);
(b) strcmp(string1, string2, 6);
(c) strncmp(string1, string2, 6);
(d) strncmp(string1, string2, 5);
Q:
Which statement is false?
a) Function strcpy copies its first argument into its second argument.
b) Function strncpy does not necessarily copy the terminating null character of its second argument.
c) A common error is not appending a terminating null character to the first argument of a strncpy when the third argument is less than or equal to the length of the string in the second argument.
d) The first character of the second argument of strcat replaces the null character that terminates the string in the first argument.
Q:
The integral type of the value returned by operator sizeof is __________.
a) size-t
b) sizet
c) size.t
d) size_t
Q:
Every function of the string handling library except for __________ appends the null character to its result.
a) strncpy
b) strncat
c) strcpy
d) strcat
Q:
Which is not a capability of the string-handling library?
a) tokenizing strings
b) comparing strings
c) searching strings
d) inputting strings
Q:
Which of the following does not necessarily append the null character to its result?
(a) strcpy
(b) strncpy
(c) strcat
(d) strncat
Q:
Which statement is true?
a) sprintf takes its input from a character array.
b) sprintf prints its output in string format on the screen.
c) sprintf stores its output in a character array.
d) sprintf is a secure version of printf.
Q:
Function fgets appends a __________ to its array target in memory.
a) leading null character
b) leading end-of-file character
c) terminating null character
d) terminating end-of-file character
Q:
Function __________ prints the character equivalent of its integer argument.
a) putchar
b) putch
c) printchar
d) printch
Q:
Function __________ inputs the next character from the standard input and returns it as an integer.
a) inputchr
b) getchr
c) inputchar
d) getchar
Q:
Which function does not read data from standard input?
(a) scanf
(b) sscanf
(c) sprintf
(d) getchar
Q:
__________ values can consist of the digits 0 through 9 and the letters A through F.
a) hexadecimal
b) binary
c) octal
d) decimal
Q:
Which statement is false?
a) Function atof returns a double version of its argument.
b) If the converted value cannot be represented, the behavior of atoi is undefined.
c) When using functions from the general utilities library, its header file must be included.
d) Function strtol receives three arguments.
Q:
The general utilities library is
a) stdutil
b) stdlibrary
c) stdutility
d) stdlib
Q:
The strtol and stroul functions do not
(a) need a special header file in order to be used.
(b) take three arguments.
(c) have to convert the entire string they are given.
(d) have the ability to output data in base 8.
Q:
Which character handling library function returns true if its argument is a printing character?
a) ispchar
b) isprintablechar
c) isprint
d) isprintchar
Q:
Q:
Which character-handling library function converts lowercase letters to uppercase letters?
a) lowertoupper
b) isupper
c) touppercase
d) toupper
Q:
Which character-handling library function returns a true value if its argument is a letter and 0 otherwise?
a) isalphanumeric
b) isalphabetic
c) isalpha
d) isletter
Q:
The isxdigit (is hex digit) function would return false on
(a) a
(b) A
(c) 2
(d) g
Q:
The functions of the character-handling library typically manipulate characters as ___________.
(a) ints.
(b) floats.
(c) longs.
(d) bits.
Q:
The number 4 typically takes up _________ bit(s) when stored as a character on most of today's computers.
(a) 1
(b) 2
(c) 3
(d) 8
Q:
In C, it is appropriate to say that a string is a(n) __________.
a) pointer
b) integer
c) double quote
d) sequence of characters contained in single quotes
Q:
A string in C is __________.
a) an array of characters ending in the empty string
b) a sequence of characters contained within single quotes
c) a sequence of characters preceded by a length field
d) an array of characters ending in the null character
Q:
Q:
'
' represents the integer value of
a) the character n
b) the string n
c) newline
d) nextline
Q:
A character constant is a(n) __________ value represented as a character in single quotes.
a) short
b) int
c) long
d) double
Q:
Q:
Which of the following statements is false?
(a) Dereferencing NULL pointers typically causes programs to crash.
(b) If a function parameter points to a value that will not be changed by the function, const should be used to indicate that the data is constant.
(c) Attackers cannot execute code by dereferencing a NULL pointer.
(d)None of the above.
Q:
Which of the following statements is false?
(a) A key feature of functions like printf_s and scanf_s that makes them more secure is that they have runtime pointer constraints that are checked after attempting to use the pointers.
(b) In a scanf_s, if any of the pointer arguments (including the format-control string) are NULL, the function returns EOF.
(c) In a printf_s, if the format-control string or any argument that corresponds to a %s is NULL, the function stops outputting data and returns a negative number.
(d)None of the above.
Q:
Which statement about the parameter definition
int (*compare)(int, int)
is false?
a) It defines a parameter that is a pointer to a function that receives two integer arguments and returns a pointer to an integer as a result.
b) Parentheses are needed around *compare because * has a lower precedence than the parentheses enclosing the function parameters.
c) Without the parentheses it would have defined a function that receives two integers and returns a pointer to an integer.
d) The corresponding parameter in the function prototype would ordinarily be
int (*)(int, int)
Q:
A pointer to a function contains __________.
a) the address of the function's automatic variables
b) the address of the function on the stack
c) the address of the entry for that function in the System Function Table
d) the address of the function in memory
Q:
(*max)(num1, num2, num3);
(a) is the header for function max
(b) is a call to function max
(c) is the prototype for function max
(d) is part of a definition of a pointer to the function max
Q:
Which of the following is false with regard to pointers to functions?
(a) They contain the starting address of the function code.
(b) They"re dereferenced in order to call the function.
(c) They can be stored in arrays.
(d) They cannot be assigned to other function pointers
Q:
Which statement about the algorithm we presented in Section 7. of the text for shuffling a deck of cards is true?
a) It's guaranteed to terminate.
b) It could execute indefinitely.
c) It's efficient.
d) It uses a one-dimensional array of 52 cards.
Q:
An algorithm that could execute for an unknown amount of time because it depends on random numbers to exit a function may
(a) have a redundancy.
(b) get caught in an infinite loop.
(c) suffer from indefinite postponement.
(d) issue a compiler error.
Q:
Which statement is false?
a) In C, a string is essentially a pointer to its first character.
b) Arrays may contain pointers.
c) Each entry in an array of strings is actually a pointer to the first character of a string.
d) The size of an array of strings is the sum of the lengths of the strings.
Q:
A string array
(a) stores an actual string in each of its elements
(b) can only provide access to strings of a certain length
(c) is actually an array of pointers
(d) is always less memory efficient than an equivalent double-subscripted array
Q:
If bPtr is assigned b (the name of an array), then array element b[3] can alternatively be referenced with the pointer expression __________.
a) bPtr + 3
b) b[bPtr + 3]
c) *b [bPtr + 3]
d) *(bPtr + 3)
Q:
Q:
Assuming that t is an array and tPtr is a pointer to that array, what expression refers to the address of element 3?
(a) *(tPtr + 3)
(b) tPtr[3]
(c) &t[3]
(d) *(t + 3)
Q:
Which statement is false?
a) A pointer can always be assigned to another pointer of the same type.
b) A cast operator must always be used to convert the pointer on the right of an assignment to the pointer type on the left of the assignment.
c) Variables of all pointer types can be assigned a pointer to void.
d) A pointer to void can be assigned a pointer of any type.
Q:
Which statement is false?
a) A pointer may be incremented or decremented.
b) An integer may be added to a pointer.
c) All operators normally used in arithmetic expressions, assignment expressions and comparison expressions are valid in conjunction with pointer variables.
d) A pointer may not be added to a pointer.
Q:
Comparing pointers and performing arithmetic on them is meaningless unless
(a) they point to members of the same array
(b) they point to arrays of the same type
(c) they point to arrays of equal size
(d) they point to different locations
Q:
A pointer cannot be assigned to
(a) another pointer of the same type
(b) a pointer to void
(c) a pointer of a type other than its own type and void
(d) any other pointer by using the cast operator
Q:
Given that k is an integer array starting at location 2000, kPtr is a pointer to k, and each integer is stored in 4 bytes of memory, what location does kPtr + 3 point to?
(a) 2003
(b) 2006
(c) 2012
(d) 2024