|
|
CS 216
Review for Third Quiz
- Preprocessor directives run until they reach the
first ___ following the # sign.
- ;
- newline
- EOF
- end-of-string marker
- The general form of #define is which one of the
following?
- #define body macro;
- #define body macro
- #define macro body;
- #define macro body
- All of the following are reasons for using symbolic
constants in preprocessor directives except which one?
- Allows for preprocessor calculations
- Improves program portability
- Simplifies program modifications
- Adds mnemonic value
- How many tokens are there in the following definition?
#define SIX 2 * 3
- 1
- 3
- 4
- 5
- With ANSI C, a preprocessor directive
can be redefined if _____.
- The new definition is greater than the old.
- The new definition is less than the old.
- The new definition is the same as the old.
- A redefinition is not allowed with ANSI C.
- A macro call, unlike a function call, passes the
argument ___ to the program ___ compilation.
- value, before
- token, before
- value, after
- token, after
- Which one of the following operators
should not be used with macros?
- *
- --
- ++
- Both b and c.
- Which one of the following statements
about macros is false?
- There are no spaces in macro names.
- Macros always improve program execution time.
- Parentheses help to clarify the arguments
in the body of a macro.
- Capital letters can be used for macro names.
- Which one of the following #include directives tells
the preprocessor to look for the header file , mystuff,
in the current directory (not the system directory)?
- #include "mystuff.h"
- #include <mystuff.h>
- #include "mystuff.c"
- #include <mystuff.c>
- Standard header files store all of the following except?
- macro functions
- function declarations
- structure template definitions
- manifest constraints
- Which preprocessor directive cancels an earlier
#define directive?
- #undefine
- #undif
- #undef
- #undeff
- Which one of the following directives is
the negative of #ifdef?
- #nifdef
- #ifdefn
- #ifnodef
- #ifndef
- All of the following are conditional compilation
preprocessor directives, except?
- #ifelse
- #endif
- #else
- #ifdef
- Which one of the following is the correct way
of assigning values to an enumerated type?
- enum spectrum [red, orange, yellow, blue];
- enum spectrum {red, orange, yellow, blue};
- enum spectrum [red, orange, yellow, blue]
- enum spectrum {red, orange, yellow, blue}
- Technically, enum constants are type ___ constants.
- string
- char
- int
- float
- By default, what value is assigned to skippy, given the statement:
enum kids {nippy, slats, skippy, nina, liz };
- 2
- 3
- 6
- Cannot tell without an assignment.
- Which value is assigned to skippy given the statement:
enum kids {nippy, slats = 10, skippy, nina, liz };
- 2
- 3
- 6
- 11
- Which one of the following is the square root function,
as found in the math.h header file?
- square()
- sqroot()
- squrt()
- sqrt()
- Which one of the following is the general
utilities library?
- stdio.h
- math.h
- stdlib.h
- ctype.h
- The ___ function registers the functions to be
called when a program exits (from the use
of an exit function).
- exit(5)
- apexit()
- aexit()
- atexit()
- How many arguments are required by the malloc function?
- 0
- 1
- 2
- 3
- By using malloc(), a program can decide what memory
is needed and create it when the program is ___.
- written
- compiled
- preprocessed
- run
- Which of the following functions releases
memory allocated by malloc()?
- free()
- release()
- renew()
- letgo()
- How many arguments are required by the calloc function?
- 0
- 1
- 2
- 3
- Which of the following functions releases memory
allocated by calloc()?
- free()
- release()
- renew()
- letgo()
- With malloc() and calloc(), memory persistence is
controlled by the _____.
- stack
- compiler
- malloc() and calloc() functions
- programmer
|