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
Computer Science
Q:
. Which statement is false?
a) Structures are derived data types.
b) Each structure definition must end with a semicolon.
c) A structure can contain an instance of itself.
d) Structures may not be compared using operators == and !=.
Q:
. A structure containing a member that's a pointer to the same structure type is referred to as a __________ structure.
a) self-referential
b) self-describing
c) self-recursive
d) self- elemental
Q:
. Keyword __________ introduces the structure definition.
a) structure
b) str
c) strdef
d) struct
Q:
What does the deck[52] array contain in the following statement?
struct card a, deck[52], *cPtr;
(a) card structure elements
(b) a structure elements
(c) *cPtr elements
(d) none of these
Q:
Two structure variables with the same member values
(a) always compare equally.
(b) never compare equally.
(c) sometimes compare equally.
(d) only compare equally if both structure variables contain holes.
Q:
. Structures may contain variables of many different data typesin contrast to ___________ that contain only elements of the same data type.
a) files
b) arrays
c) constants
d) functions
Q:
. __________ are collections of related variablessometimes referred to as aggregatesunder one name.
a) Members
b) Enumerations
c) Structures
d) Files
Q:
________ may contain different data types.
(a) structures
(b) arrays
(c) both a and b
(d) none of these
Q:
Which of the following statements is true?
(a) Allowing multiple enumeration constants to have the same value can result in difficult-to-find logic errors.
(b) Performing bitwise operations on integer types smaller than int always yields correct results.
(c) Bitwise operations on signed and unsigned integer types are portable across platforms.
(d)None of the above.
Q:
Which of the following statements is true?
(a) The size of a struct variable is the sum of its members' sizes.
(b) struct variables can be compared for equality or inequality.
(c) In a struct variable, undefined extra bytes could contain secure dataleft over from prior use of those memory locationsthat should not be accessible.
(d)None of the above.
Q:
Which statement is true?
a) The identifiers in an enumeration must be unique.
b) The constant values assigned to members of an enumeration must be unique.
c) Enumeration constant names must consist of all uppercase letters.
d) Values in an enumeration start with 1 unless specified otherwise.
Q:
Which statement is false?
a) Assigning a value to an enumeration constant when creating an enumeration type causes a syntax error.
b) An enumeration is a set of integer constants represented by identifiers.
c) Enumeration constant values can be set automatically.
d) Assigning a value to an enumeration constant after it has been defined is a syntax error.
Q:
Enumeration constants within an enumeration
(a) must have unique integer values
(b) can be assigned other values once they have been defined
(c) must have unique identifiers
(d) are defined using the keyword const
Q:
Which statement is false?
a) Using bit fields can be an effective space saving technique.
b) Using bit fields always results in faster executing machine language.
c) The decision to use bit fields is one of many examples of the kinds of space-time tradeoffs that occur in computer science.
d) An unnamed bit field with a non-zero width is used as padding in a struct of bit fields.
Q:
An unnamed bit field with a zero width is used to __________.
a) purge a bit from a bit field
b) initialize a bit field to 0.
c) concatenate two bit fields.
d) align the next bit field on a new storage unit boundary.
Q:
Which statement is false?
a) Bit field manipulations are machine dependent.
b) Bit fields may never cross a word boundary.
c) Bit fields are not "arrays of bits."
d) It is not possible to take the address of a bit field.
Q:
__________ is not allowed.
(a) Accessing individual bits in a multi-bit bitfield.
(b) Padding a bitfield with bits that cannot be accessed
(c) Having an unnamed bitfield.
(d) Having a bitfield with a zero width.
Q:
The number of bits in a bitfield is specified with __________.
(a) parenthesis as in bitfield(4)
(b) a colon as in bitfield : 4
(c) brackets as in bitfield[4]
(d) a dot as in bitfield.4
Q:
A bitfield must be defined as a __________.
(a) int or unsigned
(b) char
(c) float
(d) long
Q:
Which statement is false?
a) The result of shifting a value is undefined if the right operand is negative.
b) The result of shifting a value is undefined if the right operand has more bits than the number of bits in which the left operand is stored.
c) Left shifting is machine dependent.
d) Right shifting is machine dependent.
Q:
Which statement is true?
a) || is the bitwise or operator,
b) | is the logical or operator
c) Operators || and | are interchangeable.
d) || and | are each binary operators.
Q:
Which of the following statements is false?
(a) In general, as you study any programming language, if the language specification says that doing something can lead to undefined behavior, avoid doing it to prevent security vulnerabilities.
(b) The C standard specifies the exact behavior for every case in which incorrect library-function arguments are passed to a library function.
(c) Undefined behaviors can occur when using printf with improperly formed conversion specifications.
(d)None of the above.
Q:
Which statement about scan sets is false?
a) A scan set is a set of characters enclosed in parentheses and preceded by a percent sign in the format control string.
b) A scan set scans the characters in the input stream looking only for those characters that match the characters contained in the scan set.
c) Each time a character in the input stream matches a character in the scan set, the input stream character is stored in the scan set's corresponding argumenta pointer to a character array.
d) The scan set stops inputting characters when a character that is not contained in the scan set is encountered.
Q:
The %i scanf conversion specifier is not capable of inputting which type of data?
a) hexadecimal
b) binary
c) decimal
d) octal
Q:
Which is not an input formatting capability of scanf?
a) inputting all types of data
b) inputting specific characters from an input stream
c) skipping specific characters in the input stream
d) replacing specific characters in the input stream
Q:
The ________ character reads data from the input stream and discards the data.
(a) %
(b) conversion specifier
(c) assignment suppression
(d) //
Q:
A field width ________ be included in the format control string of the scanf statement.
(a) can
(b) cannot
(c) must
(d) none of these
Q:
Q:
What does the \ do when used in a format control string?
(a) It outputs the backslash character
(b) It delimits comments
(c) both a and b
(d) none of these
Q:
Q:
Which statement is false with regard to format control string flags?
a) The plus sign is only displayed when the + flag is used.
b) The minus sign is always displayed (when the value being printed is negative).
c) To use a flag in a format control string, place the flag immediately to the left of the percent sign.
d) Use the 0 flag to pad a field with leading zeros.
Q:
Which is not a format control string flag?
a) "
b) space
c) newline
d) #
Q:
Which of the following is the correct way to output the value of 4 left justified?
(a) printf( "%i", 4 );
(b) printf( "%-i", 4 );
(c) printf( "4%i", 4 );
(d) printf( "4-%i", 4 );
Q:
Which of the following is not a flag that can be used in the printf format-control string?
(a) 0
(b) +
(c) /
(d) #
Q:
If the field width is larger than the data being printed, the data will normally be __________ within that field.
a) truncated
b) right justified
c) centered
d) left justified
Q:
The statement
printf( "%*.*f", 7, 2, 98.736 );
uses _______ for the precision, __________ for the field width and outputs the value 98.74 __________.
a) 7, 2, left justified
b) 2, 7, left justified
c) 2, 7, right justified
d) 7, 2, right justified
Q:
What would be the output of the following statement?
printf( "%4d", 123456 );
(a) 1234
(b) 2345
(c) 3456
(d) none of these
Q:
What does the 4 signify in the follwing statement?
printf( "%4i
", 123 );
(a) degree of exponentiation
(b) floating point precision
(c) a field width
(d) none of these
Q:
Conversion specifier p __________.
a) displays a pointer value with -> notation
b) displays a pointer value in hexadecimal notation
c) displays a pointer value in decimal notation
d) displays a pointer value in an implementation-defined manner.
Q:
Which of the following would output a "%" sign when used in the format control string of the printf statement?
(a) %/
(b) /%
(c) %%
(d) none of these
Q:
Which is not a common programming error with regard to the character and string conversion specifiers.
a) Using %c to print a string.
b) Using %s to print a char argument
c) Using double quotes around a character string
d) Using double quotes around a character constant
Q:
Conversion specifier s requires a(n) __________ argument.
a) pointer to char
b) char
c) integer
d) ASCII numeric
Q:
Conversion specifier c requires a(n) __________ argument.
a) pointer to char
b) char
c) integer
d) ASCII numeric
Q:
What would be the output of the following statement?
char* value = 'hello';
printf( '%s', value );
(a) h
(b) hello
(c) value
(d) none of these
Q:
What would be the output of the following statements?
char* value = "hello";
printf( "%c", value );
(a) h
(b) hello
(c) value
(d) none of these
Q:
With the %g conversion specifier, the value 0.0000875 prints as
a) 8.75e-05
b) 87.5e-06
c) 0.875e-04
d) 0 (because of truncation)
Q:
Conversion specifiers g or G always print __________.
a) no trailing zeros
b) one trailing zero
c) as many trailing zeros as are in the number itself
d) a default of six trailing zeros
Q:
Conversion specifiers e and E always print exactly __________ to the left of the decimal point.
a) zero digits
b) one digit
c) two digits
d) three digits
Q:
Values printed with the conversion specifiers e, E and f are output with __________ digits of precision to the right of the decimal point by default.
a) 0
b) 1
c) 5
d) 6
Q:
In 1.504582E+02, the E+02 indicates that __________.
a) 1.504582 is to be raised to the second power
b) 1.504582 is to be extended by two print positions
c) 1.504582 is to be multiplied by 100
d) 1.504582 is to be doubled
Q:
The floating-point conversion specifiers e and E display floating-point values in __________ notation.
a) elliptical
b) existential
c) exponential
d) exportable
Q:
A floating-point value always contains a __________.
a) decimal point
b) comma
c) plus sign
d) e or E
Q:
The %g conversion specifier indicates ________.
(a) color
(b) significant digits
(c) a global variable
(d) a hexadecimal integer
Q:
The %e conversion specifier displays ________ values.
(a) long
(b) character
(c) integer
(d) floating-point
Q:
Which statement about integer conversion specifiers is false?
a) It is an error to print a negative value with a conversion specifier that expects an unsigned value.
b) "455 when printed with %u prints 455.
c) When printing an integers with %d, the plus sign (on a positive integer) does not print.
d) Place an l ("el") before any integer conversion specifier to indicate that a long integer is displayed.
Q:
Place __________ before any integer conversion specifier to indicate that a short integer is to be displayed.
a) s
b) S
c) h
d) H
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.