CAPP 45484

subject Type Homework Help
subject Pages 9
subject Words 1635
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 statement is true?
a) The do while iteration statement is an alternate notation for the while iteration
statement; these statements function identically.
b) The do while iteration statement tests the loop-continuation condition before the loop
body is performed.
c) The loop body of a correct do while iteration statement is always executed at least
once.
d) The braces delineating the body of a do while statement are always required.
The function prototype
double mySqrt(int x);
(a) defines a function called mySqrt which takes an integer as an argument and returns a
double
(b) defines a function called double which calculates square roots
(c) defines a function called mySqrt which takes an argument of type x and returns a
double
(d) defines a function called mySqrt which takes a double as an argument and returns an
integer
page-pf2
If no memory is available mallocreturns a(n) __________ pointer.
a) self
b) NULL
c) void
d) empty
Which of the following is false?
a) Storage of data in memory variables is temporary; all such data is lost when a
program terminates.
b) Computers store files on primary storage devices, typically disk storage devices.
c) Files are used for permanent retention of data (typically large amounts of data).
d) Storage of data in memory arrays is temporary; all such data is lost when a program
terminates.
What is the output of the following statement?
printf( "%s", strspn( "Cows like to moo.", "Ceiklosw " );
(a) Nothing.
page-pf3
(b) 10
(c) 8
(d) e
Q2: Upon encountering the designated delimiter character, the ignore member function
will:
a. Read it in and return its value.
b. Ignore it and continue reading and discarding characters.
c. Terminate.
d. Replace it with an EOF character.
Two structure variables with the same member values
(a) always compare equally.
(b) never compare equally.
(c) sometimes compare equally.
(d) only compare equally if both structure variables contain holes.
page-pf4
Which of the following is an invalid identifier (variable name)?
(a) _Test
(b) TEST
(c) 5test
(d) test1
To prevent modification of array values in a function,
(a) the array must be defined staticin the function.
(b) the array parameter can be preceded by the constqualifier.
(c) a copy of the array must be made inside the function.
(d) the array must be passed call-by-reference.
page-pf5
The conditional operator (?:) ________.
(a) is the only ternary operator in C
(b) is a unary operator
(c) associates from left to right
(d) accepts two operands
The condition
num != 65
cannot be replaced by:
(a) num > 65 || num < 65
(b) !(num == 65)
(c) num " 65
(d) !(num " 65)
Which of the following is false about a function being passed an array?
page-pf6
(a) it knows the size of the array it was passed
(b) it is passed the address of the first element in the array
(c) it is able to modify the values stored in the array
(d) all of the above are true
Which statement is false?
(a) Classes are reusable software components.
(b) A class is to an object as a blueprint is to a house.
(c) Performing a task in a program requires a method.
(d) A class is an instance of its object.
The steps for an in-order traversal of a binary search tree include each of the following
except _________.
a) Traverse the left subtree in-order.
b) Process the value in the root node.
c) Skip over duplicate values.
page-pf7
d) Traverse the right subtree in-order,
Q1: The unary scope resolution operator is used:
a. To access a global variable when a local variable of the same name is in scope.
b. To access any variable in an outer block when a local variable of the same name is in
scope.
c. To access a global variable when it is out of scope.
d. To access a local variable with the same name as a global variable.
Q2: __________ is usually faster than __________.
a. High-level I/O, low-level I/O.
b. Low-level I/O, high-level I/O.
c. Low-level I/O, internal data processing.
d. High-level I/O, internal data processing.
page-pf8
Which of the following is false?
a) Reading a value into a memory location destroys the previous value.
b) Reading a value out of a memory location destroys that value.
c) sum = integer1 + integer2; involves destructive read-in.
d) The statement in part c) also involves nondestructive read-out.
Preprocessor directives
(a) begin with include
(b) are C statements.
(c) are ignored if whitespace characters before them on the same line.
(d) do not end in a semicolon.
page-pf9
Q1: If unexpected data is processed in an I/O operation:
a. An exception will be thrown.
b. An error message will automatically be displayed.
c. The program will terminate execution.
d. Various error bits will be set.
Q3[C++11]: Assuming the following constructor is provided for class Time
explicit Time( int = 0, int = 0, int = 0 );
which of the following is not a valid way to initialize a Time object?
a. Time t1;
b. Time t2{ 22, 40 };
c. Time t3( 22, 40 );
d. (a), (b) and (c) are all valid ways to initialize a Time object.
Which of the following is not a key organization in the open-source community?
(a) Apache.
page-pfa
(b) SourceForge.
(c) Firefox.
(d) Eclipse.
Which of the following is false?
a) Arrays can be maintained in sorted order.
b) Linked lists can be maintained in sorted order.
c) Insertion and deletion in a sorted array (while maintaining sorted order) is efficient.
d) Once the insertion point or the node to be deleted has been located, insertion or
deletion in a sorted linked list (while maintaining sorted order) is efficient.
Which statement automatically handles all the details of counter-controlled iteration.
a) for
b) while
c) do while
page-pfb
d) continue
Q3[C++11]: Which of the following statements is false?
a. You can overload a classes constructors.
b. There is no mechanism in C++ for a constructor to call another constructor in the
same class.
c. Just as a constructor can call a class's other member functions to perform tasks, C+
+11 allows constructors to call other constructors in the same class.
d. To overload a constructor, provide in the class definition a prototype for each version
of the constructor, and provide a separate constructor definition for each overloaded
version.
Q1: Which of the following is an illegal use of function put?
a. cout.put( 'A' );
b. cout.put( "A" );
c. cout.put( 'A' ).put( '\n' );
page-pfc
d. cout.put( 65 );
Which of the following is not an operation that can be performed on a union?
(a) comparing using the != operator
(b) taking the address (&) of a union
(c) accessing union members using the structure member operator
(d) assigning a union to another union of the same type
Which of the following is true of pseudocode programs?
(a) they are executed by the computer
(b) they help the programmer "think out" a program
(c) they typically include definitions and all types of statements
(d) all of the above are false
page-pfd
ASCII and EBCDIC are
a) characters
b) strings
c) character sets
d) character comparison operators
What would be the output of the following statement?
printf( "%4d", 123456 );
(a) 1234
(b) 2345
(c) 3456
(d) none of these
page-pfe
A(n) unsafe macro is one that ________.
a) evaluates its argument(s) exactly once
b) evaluates its argument(s) more than once
c) does not evaluate its argument(s)
d) None of the above.
Suppose you have a list of names sorted in alphabetical order, already stored in one of
the data types below. The easiest way to print the names in reverse alphabetical order
would be to use a
(a) binary search tree
(b) stack
(c) queue
(d) circular, singly linked list
What would be the output of the following statements?
char* value = "hello";
printf( "%c", value );
page-pff
(a) h
(b) hello
(c) value
(d) none of these

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.