CMCS 13846

subject Type Homework Help
subject Pages 11
subject Words 1715
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
Q1: Which statement is false?
a. Based on whether an operator is implemented as a member function or as a
non-member function, the operator is used differently in expressions.
b. When an operator function is implemented as a member function, the leftmost (or
only) operand must be an object (or a reference to an object) of the operator's class.
c. Operator member functions of a specific class are called (implicitly by the compiler)
only when the left operand of a binary operator is specifically an object of that class, or
when the single operand of a unary operator is an object of that class.
d. Another reason why you might choose a non-member function to overload an
operator is to enable the operator to be commutative.
A sorted array of a million elements can be searched by a binary search in __________
or fewer comparisons.
a) 10
b) 20
c) 30
d) 999,999
page-pf2
Which statement is true of the >> operator?
a) It is called the left shift operator.
b) It is called the bitwise left shift operator.
c) It shifts the bits of the first operand right by the number of bits specified by the
second operand.
d) It fills from the left portably across platforms.
sizeof
a) is a compile-time function
b) is a compile-time unary operator
c) is a run-time unary operator
d) is a run-time function
Global variables can be used to increase performance because
(a) global variables are accessed faster than local variables
page-pf3
(b) the overhead of passing data between functions is eliminated
(c) they are stored more compactly than local variables
(d) all of the above
Functions such as isEmpty and isFull that test a condition and return a value that can be
interpreted as true or false, are called __________ functions.
a) imperative
b) declarative
c) predicate
d) conditional
Q1: Which of the following is false?
a. A string can be defined to store any data type.
b. Class string provides bounds checking in its member function at.
c. Class string's overloaded [] operator returns a vector element as an rvalue or an
lvalue, depending on the context.
d. An exception is thrown if the argument to string's at member function is an invalid
page-pf4
subscript.
________ iteration is sometimes called definite iteration.
(a) counter-controlled
(b) sentinel-controlled
(c) variable-controlled
(d) none of these
Which statement about the #include preprocessor directive is false?
a) It is used with programs consisting of several source files that are to be compiled
together.
b) A header file containing definitions common to separate program files is often
created and included in a program with #include.
c) #include header files often contain structure and union definitions, enumerations and
function prototypes.
d) It includes standard library header files such as standardio.h.
page-pf5
The escape sequence for horizontal tab is __________.
a) \tab
b) \t
c) \horizontaltab
d) \T
For any eight-bit x, which of the following does not result in zero?
(a) x &= (~x)
(b) x ^= x
(c) x <<= 8
(d) x |= x
page-pf6
Which of the following symbols is not used in UNIX for redirecting input or output?
(a) >
(b) |
(c) $
(d) >>
Which of the following statements is false?
(a) The concepts of icons, menus and windows were originally developed by Xerox
PARC.
(b) Windows is an open source operating system.
(c) The software that contains the core components of the operating system is called the
kernel.
(d) Linux source code is available to the public for examination and modification.
Which statement would be used to define a 10 element integer array c?
(a) Array c = int[10];
page-pf7
(b) c = int[10];
(c) int Array c[10];
(d) int c[10];
Q2: If a member function of a class already provides all or part of the functionality
required by a constructor or another member function then:
a. Copy and paste that member function's code into this constructor or member
function.
b. Call that member function from this constructor or member function.
c. That member function is unnecessary.
d. This constructor or member function is unnecessary.
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
page-pf8
d) memlead
Which of the following statements is correct?
(a) #define X = 3
(b) #define X 3, Y 4
(c) #define X 3
(d) #define X:3
New nodes can be added to a stack and removed from the stack only at its top. For this
reason a stack is referred to as a __________ data structure.
a) first-in, first-out
b) linear
c) last-in, first-out
d) dynamic
page-pf9
Which of the following is not a synonym for 'sentinel value."
a) signal value
b) dummy value
c) counter value
d) flag value
Large portions of code can be prevented from compiling by
(a) #if 0
code prevented from compiling
#endif
(b) #nodefine
code prevented from compiling
#endif
(c) #if 1
code prevented from compiling
#endif
(d) #ifndef 0
page-pfa
code prevented from compiling
#endif
Which operation does not take place in the following example?
int x = 21;
double y = 6;
double z = 14;
y = x / z;
x = 5.5 * y;
(a) implicit conversion
(b) promotion
(c) explicit conversion
(d) truncation
. Which of the following is false?
a) To pass a structure by reference, pass the address of the structure variable.
page-pfb
b) A way to pass an array by value, is to create a structure with the array as a member
then pass the name of the structure.
c) To pass a structure by reference, pass the name of the structure variable.
d) Passing large structures by reference is more efficient than passing large structures
by value.
The randfunction generates a data value of the type
(a) unsigned int
(b) int
(c) long int
(d) short int
. Which statement is false?
a) The const qualifier enables the programmer to inform the compiler that the value of a
particular variable should not be modified.
b) The const qualifier did not exist in early versions of C; it was added to the language
by the ANSI C committee.
page-pfc
c) Using the const qualifier typically violates the principle of least privilege
d) Adding const to C programs that do not use it presents significant opportunities for
improvement in the software engineering of that code.
Which statement is false?
a) All function calls in C pass arguments call-by-value.
b) Call-by-reference enables a called function to modify variables in the calling
function.
c) Call-by-value is always more efficient than call-by-reference.
d) In C, programmers use pointers and the indirection operator to simulate
call-by-reference.
If there are fewer initializers than elements in the array, the remaining elements are
__________.
a) deleted
b) ignored
c) initialized to empty
d) initialized to zero
page-pfd
The diamond flowcharting symbol is also called the __________ symbol.
a) determination
b) derision
c) declarative
d) decision
Which of the following languages was an ancestor of C?
(a) A
(b) A+
(c) B
(d) B+
page-pfe
The ________ accesses a structure member via the structure variable name.
(a) structure member operator
(b) structure pointer operator
(c) structure arrow operator
(d) none of these
Which statement is false?
a) A static local variable exists for the duration of the program.
b) A static local variable is visible only in the control structure in which it is defined.
c) A static local array is not created and destroyed each time the function is entered and
exited, respectively.
d) Arrays that are defined static are automatically initialized once at compile time.
Which of the following statements about the inclusion of <stdio.h> is false?
a) It is required.
page-pff
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).
Which statement about trees is false?
a) A tree is a non-linear, two-dimensional data structure.
b) Tree nodes contain two or more links.
c) Binary tree nodes contain two or fewer links.
d) Binary tree nodes contain exactly two links.
Any C program we"ll ever need to build can be constructed from only __________
different control statements combined in only __________ ways.
a) 7, 3
b) 6, 2
c) 7, 2
page-pf10
d) 6, 3
To customize preprocessing to the unique needs of a particular installation, you would
most likely use the __________ directive.
a) #unique
b) #pragmatic
c) #pragma
d) #customize
C views each file simply as a sequential stream of __________.
a) bits
b) bytes
c) fields
d) records

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.