Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Login

Register Now

Welcome to All Test Answers

Chapter 14 – C How to Program 6e Multiple Choice Test Bank


 

Download  file with the answers

Not a member!
Create a FREE account here to get access and download this file with answers


14.1 Introduction

14.2 Redirecting I/O

14.1 A pipe (|) causes
(a) the output of the first program to be redirected to the input of the second
(b) the output of the second program to be redirected to the input of the first
(c) the input of the first program to be redirected to the input of the second
(d) the input of the second program to be redirected to the input of the first

14.2 Which of the following symbols is not used in UNIX for redirecting input or out-put?
(a) >
(b) |
(c) $
(d) >>

14.3 Variable-Length Argument Lists

14.3 Which of the following function prototypes is correct?
(a) double average( int, … )
(b) double average( …, int );
(c) double average( int, … );
(d) double average( int, … , int);

14.4 What macro expands to an expression of the value and type of the next argument in a variable-length argument list?
(a) va_end
(b) va_start
(c) va_list
(d) va_arg

14.4 Using Command-Line Arguments

14.5 How many arguments can be passed to main from the command line?
(a) 1
(b) 2
(c) 3
(d) as many as you want

14.6 Which of the following operating systems require special settings for processing command-line arguments?
(a) Macintosh
(b) DOS
(c) UNIX
(d) all of the above

14.5 Notes on Compiling Multiple-Source-File Programs

14.7 extern
(a) is a keyword to indicate that a variable is defined in a different file
(b) is used to access command-line arguments
(c) can be used as a control structure
(d) is a data type

14.8 Global variables can be used to increase performance because
(a) global variables are accessed faster than local variables
(b) the overhead of passing data between functions is eliminated
(c) they are stored more compactly than local variables
(d) all of the above

14.9 Which of the following is not an error?
(a) having a function definition that spans two files
(b) using a global variable in a file it was not defined in without defining it with the ex-tern modifier
(c) defining a function prototype without the extern keyword when the definition is in another file
(d) having global variables in different files with the same name

14.10 Which of the following restricts the scope of a global variable to the file it’s de-fined in?
(a) extern
(b) static
(c) int
(d) local

14.6 Program Termination with exit and atexit

14.11 When exit is called with EXIT_FAILURE
(a) the program quits immediately without returning anything
(b) the program prints an error message and quits the current function
(c) the implementation-defined value for unsuccessful termination is returned
(d) the program breaks out of a loop

14.12 The function atexit takes as an argument
(a) the line number of where the program should exit
(b) a function that is executed when the program is exited unsuccessfully
(c) a function to be called when the program ends successfully
(d) normally the symbolic constant EXIT_SUCCESS or EXIT_FAILURE

14.7 Suffixes for Integer and Floating-Point Literals

14.14 A floating-point constant that’s not suffixed is of type
(a) double
(b) float
(c) unsigned float
(d) long double

14.8 Signal Handling

14.16 SIGFPE signals
(a) an erroneous arithmetic operation
(b) the abnormal termination of the program
(c) the detection of an illegal instruction
(d) an invalid access to storage

14.17 Which of the following will not generate a signal defined in the header signal.h?
(a) a call to exit
(b) dividing by zero
(c) a call to abort
(d) an invalid access to storage

14.9 Dynamic Memory Allocation with calloc and realloc

14.18 realloc is conventionally used to
(a) allocate memory for a single object
(b) allocate memory for an array of objects
(c) change the size of an object previously allocated
(d) change the contents of an object previously allocated

14.10 Unconditional Branching with goto

14.19 The goto statement is which of the following?
(a) an unconditional branch
(b) an instance of unstructured programming
(c) used to change the program’s flow of control
(d) all of the above

14.20 A label must
(a) be defined as a global constant prior to use
(b) appear in the same function as the goto statement that refers to it
(c) be of type int
(d) all of the above

About

Leave a reply

Captcha Click on image to update the captcha .

error: Content is protected !!