C How To Program 8th Edition By Deitel & deitel - Test Bank
2.1
Introduction
(No questions.)
2.2 A
Simple C Program: Printing a Line of Text
2.1 Which of the
following must every C program have?
(a) main
(b) #include
(c) /*
(d) <stdio.h>
ANS: (a)
2.2 Every statement
in C must end with a
(a) period (.)
(b) semicolon (;)
(c) colon (:)
(d) backslash (/)
ANS: (b)
2.3 Which of the
following is not a valid escape
sequence?
(a) \n
(b) \\
(c) \~
(d) \”
ANS: (c)
2.4 Which statement
about comments is false?
a) Comments begin and end with /* and */, respectively.
b) Programmers insert comments to document programs and
improve program readability.
c) Comments do not cause any machine language object code
to be generated.
d) Lengthy comments can cause poor execution-time
performance.
ANS: (d)
2.5 Lines beginning
with a # are processed
a) at execution time.
b) at compile time.
c) at preprocessor time.
d) at postprocessor time.
ANS: (c)
2.6 Which of the
following statements about the inclusion of <stdio.h> is false?
a) It is required.
b) This header file contains information and declarations
used by the compiler when compiling standard input/output library functions
such as printf.
c) This header file contains information that helps the
compiler determine if calls to library functions have been made correctly.
d) This header helps locate bugs in your program at
compile time, rather than at execution time (when errors are usually more
costly to correct).
ANS: (a)
2.7 In the line
int main()
the parentheses indicate that main is a program building block
called a
a) module
b) statement
c) directive
d) function
ANS: (d)
2.8 The pair of
braces that delineate the body of main and
the portion of the program between these braces is called a __________.
a) function
b) block
c) statement
d) header
ANS: (b)
2.9 Which of the
following is not a synonym for a C
string?
a) message
b) character string
c) character