CDA 16217

subject Type Homework Help
subject Pages 9
subject Words 1474
subject Authors Harvey Deitel, Paul J. Deitel

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Which of the following is not part of the FILE structure specified in <stdio.h>?
(a) file descriptor
(b) open file table
(c) read/write methods
(d) file control block
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
The __________ selection statement performs an action if a condition is true and skips
that action if the condition is false.
page-pf2
a) if
b) when
c) if else
d) switch
Which statement is false?
a) Each function should be limited to performing a single, well-defined task.
b) If you cannot choose a concise name that expresses what a function does, it's
possible that the function is attempting to perform too many diverse tasks.
c) Every function should be broken into smaller functions.
d) A function's parameters are local variables.
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.
page-pf3
d) If there are no more tokens when the function is called, NULL is returned.
The World Wide Web ________.
(a) was developed at roughly the same time as the Internet
(b) paved the way for the Internet
(c) was developed years after the Internet
(d) was designed for 'stand-alone" computers
Given the preprocessor directive
#define HAPPY(x) printf ("Happy, " #x "\n");
How would you invoke this macro to generate a statement that would print
Happy BIRTHDAY (followed by a newline)
at execution time?
a) Happy(Birthday)
b) Happy(BIRTHDAY)
page-pf4
c) HAPPY(Birthday)
d) HAPPY(BIRTHDAY)
Q3: The try block cannot:
a. Enclose the code that may throw the exception.
b. Enclose its own catch blocks.
c. Test enclosing try blocks for additional catch statements if this try block's catch
statements can"t match the exception being thrown.
d. Have exceptions explicitly or implicitly thrown in the try block itself.
If a = 7.0, b = 7.0 and c = 6.0, then what is printed by
printf("%.2f", sqrt(a + b * c));
a) 49
b) 7.00
c) 7
d) 49.00
page-pf5
Which expression is true?
a) The expression a * (b + c) + c * (d + e) contains nested parentheses.
b) The expression y = a * x * x + b * x + cdoes exponentiation without an
exponentiation operator.
c) The C standard library provides function power to perform exponentiation.
d) When we say evaluation of an expression proceeds from left to right we are referring
to the additivity of the operators.
The ____________, __________, and ____________ are the only three forms of
control necessary.
(a) switch, if, else
(b) sequence, selection, iteration
(c) break, continue, ifelse
(d) for, while, dowhile
page-pf6
Which statement regarding for statements is false?
a) In a for statement, the initialization, loop-continuation condition, and increment can
contain arithmetic expressions.
b) The increment must be greater than zero.
c) If the loop-continuation condition is initially false, the body of the loop is not
performed.
d) It is common to use the control variable for controlling iteration while never
mentioning it in the body of the loop.
A queue receives the following commands (in pseudo-code):
enqueue 4, 6, 8, 3, 1
dequeue three elements
enqueue 3, 1, 5, 6
dequeue two elements
What number is at the front of the queue?
(a) 3
(b) 4
(c) 5
(d) 6
page-pf7
Which statement is false?
a) The ANSI C standard does not specify the order in which the operands of most
operators are to be evaluated.
b) The ANSI C standard specifies the order of evaluation of operators &&, ||, comma,
and ?:.
c) A program that evaluates Fibonacci numbers recursively achieves high performance
because of exponential complexity.
d) Programs that depend on the order of evaluation of the operands of operators other
than &&, ||, comma, and ?: can function differently on systems with different compilers.
The smallest data item in a computer, called a ________, can assume the value 0 or the
value 1
(a) bit
(b) character
(c) field
(d) digit
page-pf8
C's if statement executes the statement inside its body if a specified __________ is
__________.
(a) condition, true
(b) condition, false
(c) equality operator, true
(d) relational operator, true
Function __________ prints the character equivalent of its integer argument.
a) putchar
b) putch
c) printchar
d) printch
A label must
page-pf9
(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
Q2: Assuming that text is a variable of type string, what will be the contents of text
after the statement cin >> text; is executed if the user types Hello World! then presses
Enter?
a. "H"
b. "Hello"
c. "Hello World"
d. "Hello World!"
In a flowchart of an algorithm, what is the shape of the decision symbol?
(a) circle
(b) rectangle
page-pfa
(c) diamond
(d) rounded rectangle
Which integer conversion specifier displays an unsigned decimal integer?
a) u
b) U
c) ud
d) UD
A valid reason for building programs out of functions is
(a) that the divide-and-conquer approach facilitates program construction
(b) that pre-existing functions can be used to create new programs
(c) the avoidance of code iteration within a program
(d) all of the above
page-pfb
What method should be used to pass an array to a function that does not modify the
array and only looks at it using array subscript notation?
(a) A constant pointer to constant data.
(b) A constant pointer to nonconstant data.
(c) A nonconstant pointer to constant data.
(d) A nonconstant pointer to constant data.
Which operator sets the bits in the result to 1 if at exactly one of the corresponding bits
in the two operands is 1?
a) bitwise AND
b) bitwise inclusive OR
c) bitwise exclusive OR
d) bitwise complement
page-pfc
The _____ is the average value of a set of data items.
a) mean
b) median
c) mode
d) matrix
. 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
The address operator is
a) &&
b) %
page-pfd
c) @
d) &
If x = 3, which of the following sets x to 7?
(a) x *= 4;
(b) x += 4;
(c) x =+ 4;
(d) x + 4 = x;
Q4: protected base class members cannot be accessed by:
a. Functions that are neither friends of the base class, derived-class member functions
nor friends of a derived class.
b. friends of the base class.
c. Functions that are not derived-class member functions.
d. friends of derived classes.
page-pfe
Function malloc takes as an argument the number of bytes to be allocated, and returns a
pointer of type __________ to the allocated memory.
a) char *
b) int *
c) void *
d) NULL *
Q2: Assuming that GradeBook.h is found in the current directory and the iostream
header file is found in the C++ Standard Library header file directory, which of the
following preprocessor directives will fail to find its desired header file?
a. #include <iostream>
b. #include "iostream"
c. #include <GradeBook.h>
d. #include "GradeBook.h"
page-pff
Which of the following multiple word variable names does not conform to the good
programming practices in the text?
a) multiple_word_variable_name
b) multipleWordVariableName
c) multiplewordvariablename
d) aReallyReallyLongMultipleWordVa
Q1: Each standard library has a corresponding:
a. Function.
b. Variable type.
c. Header file.
d. Cd-rom.

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.