COMP 89767

subject Type Homework Help
subject Pages 10
subject Words 1604
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
A linked list has the functions insertAtFront, removeFromFront, insertAtBack, and
removeFromBack, which perform operations on nodes exactly as their names describe.
Which two functions would most
naturally model the operation of a queue?
(a) insertAtBackand removeFromBack.
(b) insertAtBackand removeFromFront.
(c) insertAtFrontand removeFromFront.
(d) insertAtFrontand removeFromBack.
Q2: Which of the following operators cannot be overloaded?
a. The . operator.
b. The -> operator.
c. The & operator.
d. The [ ] operator.
.4 Q2: virtual functions must:
a. Be overridden in every derived class.
page-pf2
b. Be declared virtualin every derived class.
c. Be declared virtual in the base class.
d. Have the same implementation in every derived class.
Which of the following is not a valid directive?
(a) #endif
(b) #ifdef
(c) #for
(d) #elif
Which statement is false?
a) Arrays are normally stored contiguously in memory.
b) Dynamic memory allocation can sometimes use memory more efficiently than using
fixed-size data structures.
c) Dynamic memory allocation incurs execution-time overhead.
d) Linked lists are normally stored contiguously in memory.
page-pf3
Q1: Select the false statement regarding exceptions.
a. The C++ standard has a hierarchy of exception classes.
b. All exception classes are accessible via <exception>.
c. Several classes derive from class exception.
d. The what function can be overridden in each class derived from exception.
Which of the following does not represent a capability of the printf function?
(a) center justification of outputs
(b) left justification of outputs
(c) right justification of outputs
(d) inserting literal characters at precise locations in a line of output
page-pf4
The definition
char string1[] = "first";
is equivalent to:
a) character string1[] = {'f', 'i', 'r', 's', 't', '\0'};
b) char string1 = {'f', 'i', 'r', 's', 't', '\0'};
c) char string1[] = {'f', 'i', 'r', 's', 't'};
d) char string1[] = {'f', 'i', 'r', 's', 't', '\0'};
Java was developed by ___________.
(a) Sun Microsystems
(b) Bell Labs
(c) IBM
(d) ANSI/ISO
Q1: For a non-constant member function of class Test, the this pointer has type:
page-pf5
a. const Test *
b. Test * const
c. Test const *
d. const Test * const
Which statement is true?
a) fopen returns a FILE structure.
b) fopen returns a pointer to a FILE structure.
c) fopen returns a file control block (FCB).
d) fopen returns a pointer to a file control block (FCB).
. Structures can be initialized in __________ statements.
a) assignment
b) null
c) scope
page-pf6
d) empty
Q1: Which of the following is not true about bool values and how they're output with
the output stream?
a. The old style of representing true/false values used -1 to indicate false and 1 to
indicate true.
b. A bool value outputs as 0 or 1 by default.
c. Stream manipulator boolalpha sets the output stream to display bool values as the
strings "true" and "false".
d. Both boolalpha and noboolalpha are 'sticky" settings.
Function fwrite __________.
a) is equivalent to function fprintf
b) transfers a specified number of bytes beginning at a specified location in memory to
a location in a file indicated by the file position pointer
c) transfers a specified number of bytes beginning at a specified location in memory to
a location in a file indicated by one of its arguments
d) is equivalent to function fprintf, except that fwrite can only write to standard streams
page-pf7
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
Which statement about the following assertion is true?
assert(count <= 7);
a) It evaluates its argument at preprocessor time.
b) It evaluates its argument at compile time.
c) It evaluates its argument at execution time.
d) It always calls function abort.
page-pf8
Q3: Given the following function template
template < class T >
T maximum( T value1, T value2 )
{
if ( value1 > value2 )
return value1;
else
return value2;
}
what would be returned by the following two function calls?
maximum( 2, 5 );
maximum( 2.3, 5.2 );
a. 5 and a type-mismatch error.
b. 5 and 5.2.
c. 2 and 2.3.
d. Two error messages.
A variable that can have values only in the range 0 to 65535 is a
page-pf9
(a) four-byte int
(b) four-byte unsigned int
(c) two-byte int
(d) two-byte unsigned int
__________ represent waiting lines; insertions are made at the back (also called the
tail) and deletions are made from the front (also called the head) of a __________.
a) Linked lists, linked list
b) Queues, queue
c) Stacks, stack
d) Binary trees, binary tree
Which of the following is not a valid integer value?
(a) -3
(b) 0
(c) 2134859
page-pfa
(d) 1.1
Which of the following is going to be the key programming methodology for the next
decade?
(a) object-oriented programming
(b) structured programming
(c) "legacy C code"
(d) "live-code approach"
Arrays are
(a) always passed call-by-reference.
(b) passed call-by-reference unless inside a structure.
(c) always passed call-by-value.
(d) passed call-by-value unless inside a structure.
page-pfb
Assuming myString is a 20-element char array, which of the following statements might
result in buffer overflow?
(a) scanf("%19s", myString);
(b) scanf_s("%s", myString, 20);
(c) scanf_s("%19s", myString, 20);
(d)scanf("%s", myString);
Which of the following statements is false?
a) The programmer must know the specifics of the FILE structure to use files.
b) The FILE structure for a file leads indirectly to the operating system's file control
block (FCB) for a file.
c) If a file does not exist and is opened for writing fopen creates the file.
d) A C program administers each file with a separate FILE structure.
page-pfc
Q1: Exception handling should not be used:
a. As an alternative for program control.
b. To make error handling uniform on large projects.
c. To deal with errors that do not arise very often.
d. To deal with errors for components that will be widely used in other applications,
such as classes and libraries.
Which statement is false?
a) Function rand generates an integer between 0 and MAX.
b) The range of values produced directly by rand is often different than what is needed
in a specific application.
c) The number 6 in the expression rand % 6 is called a scaling factor.
d) The rand function prototype is in <stdlib.h>.
Q1: Which of the following is not true about setw and width?
a. If the width set is not sufficient the output prints as wide as it needs.
b. They are used to set the field width of output.
page-pfd
c. Both of them can perform two tasks, setting the field width and returning the current
field width.
d. They only apply for the next insertion/extraction.
A(n) __________ pointer normally indicates the end of a data structure.
a) uninitialized
b) NULL
c) self
d) dereferenced
The general utilities library is
a) stdutil
b) stdlibrary
c) stdutility
d) stdlib
page-pfe
What does the deck[52] array contain in the following statement?
struct card a, deck[52], *cPtr;
(a) card structure elements
(b) a structure elements
(c) *cPtr elements
(d) none of these
Let x be an int on a machine with four-byte ints. What effect does
x<<=1;
x>>=1;
have?
(a) There is no effect.
(b) The leftmost bit of x is set to zero.
(c) The rightmost bit of x is set to zero.
(d) Both (b) and (c).
page-pff
An array is a group of memory locations related by the fact that they all have
__________ array name and __________ type.
a) different, different
b) same, different
c) different same
d) same, same
Q2 [C++11] Which of the following statements is false?
a. The C++ standard redesigned the classic C++ stream classes, which processed only
chars, as class templates with specializations for processing characters of types char and
wchar_t, respectively.
b. C++11 added type char64_t to handle the new double-width Unicode characters.
c. The size of type wchar_t is not specified by the C++ standard.
d. C++11's new char16_t and char32_t types for representing Unicode characters were
added to provide character types with explicitly specified sizes.
page-pf10
Which type of binary search tree traversal processes the node values in ascending
order?
a) in-order traversal
b) pre-order traversal
c) post-order traversal
d) duplicate elimination traversal

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.