CDA 74190

subject Type Homework Help
subject Pages 10
subject Words 1709
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
The following line is most properly an example of a __________.
puts( "Welcome to C!" );
a) function
b) block
c) statement
d) header
Q1: Which of the following does the C++ compiler not examine in order to select the
proper overloaded function to call?
a. Types and order of the arguments in the function call.
b. The number of arguments in the function call.
c. The return type of the function.
d. It examines all of the above.
Which statement is false?
a) Function scanf reads characters into memory from the keyboard until the first input
whitespace character is encountered.
page-pf2
b) Function scanf can write beyond the boundary of the array into which input is being
placed.
c) Function printf does not care how large the array it is printing is.
d) When using scanf, you must always precede with the & operator the name of each
variable into which inputs are being placed.
Which is not an attribute of a variable?
a) name
b) definition
c) type
d) value
Which is not a popular application of stacks?
a) enabling called functions to return to their callers
b) supporting recursive function calls
c) containing the space created for automatic variables
page-pf3
d) maintaining waiting lines
Which statement is false?
a) Whitespace characters such as tabs, newlines and spaces are generally ignored by the
C compiler.
b) The statements in an if statement must be indented.
c) Placing a blank line before and after every control structure can improve program
readability.
d) There can be (but should not be) more than one statement per line.
Arrays of structures ________.
(a) are automatically passed by reference
(b) are automatically passed by value
(c) cannot be passed by reference
(d) None of the above.
page-pf4
Flowchart symbols are connected by arrows called __________.
a) flowlines
b) flow of control
c) flow delimiters
d) darts
Which statement is false?
a) Comma operators evaluate lists of expressions from right to left.
b) The value of a comma-separated list of expressions is the value of the rightmost
expression in the list.
c) The type of a comma-separated list of expressions is the type of the rightmost
expression in the list.
d) The comma operator is often used to specify multiple initializations in one particular
type of iteration statement.
page-pf5
Q2: The prototypes of overloaded cast operator functions do not:
a. Specify the type they convert to.
b. Specify the type that is being converted.
c. Specify a return type.
d. Need to be defined inside the class whose objects are being converted.
Conversion specifier p __________.
a) displays a pointer value with -> notation
b) displays a pointer value in hexadecimal notation
c) displays a pointer value in decimal notation
d) displays a pointer value in an implementation-defined manner.
Which of the following statements about binary search trees with no duplicate values is
false?
a) The values in any left subtree are less than the values in its parent node.
page-pf6
b) The values in any right subtree are less than the values in its parent node.
c) The shape of the tree that corresponds to a particular set of data can vary based on the
order in which the values are inserted into the tree.
d) It is possible that a binary tree could contain all its values along one straight path
through the tree.
Q3: Which of the following is not one of the disadvantages of using the
"copy-and-paste" approach to duplicating code from one class into another class?
a. Errors are prone to be spread around.
b. It is time consuming.
c. It forces the system to store many physical copies of the code, creating a
code-maintenance nightmare.
d. All of the above are disadvantages of the "copy-and-paste" approach.
The #error directive
#errortokens
a) prints only the tokens specified in the message.
b) prints the word error followed by the tokens specified in the message.
page-pf7
c) prints only an implementation-defined message.
d) prints an implementation-defined message including the tokens specified in the
directive.
Q4: To implicitly overload the += operator:
a. Only the + operator needs to be overloaded.
b. Only the = operator needs to be overloaded.
c. Both the + and = operators need to be overloaded.
Which statement is false?
a) Assigning a value to an enumeration constant when creating an enumeration type
causes a syntax error.
b) An enumeration is a set of integer constants represented by identifiers.
c) Enumeration constant values can be set automatically.
d) Assigning a value to an enumeration constant after it has been defined is a syntax
error.
page-pf8
Which of the following code segments does not contain any errors?
(a)
void printnum (int x)
{
print("%i", x);
return x;
}
(b)
int cube(int s)
{
int s;
return (s * s * s);
}
(c)
double triple(float n) {
return (3 * n);
}
(d)
double circumference (int r)
return (3.14 * 2 * r);
page-pf9
Which statement is false?
a) Using global variables, instead of passing arguments, can increase program
performance, but reduce effective software engineering.
b) Hardcoding into a function the size of an array that will be passed as an argument
rather than passing the size of the array as a parameter, reduces the software reusability
of that function.
c) sizeof is an operator that calculates the size of its argument in bytes at compile time.
d) When applied to the name of an array, sizeof returns the number of elements in the
array.
Which statement is true?
a) The expression ++(a + 1) adds 2 to a.
b) The expression **a multiplies a by 1.
c) The ANSI standard for the C programming language specifies the order in which
each operator's operands will be evaluated.
d) The expression --(abc * 37) is a syntax error
page-pfa
Which statement about pointers is false?
a) A pointer with the value NULL points to nothing.
b) NULL is a symbolic constant defined in the <stdio.h> header file.
c) Initializing a pointer to 0 is equivalent to initializing a pointer to NULL, but NULL is
preferred.
d) The values 0 and 1 are the only values that can be assigned directly to a pointer
variable.
Which statement is true about the contents of a correct diamond symbol in a correct
flowchart.
a) It must contain an expression that evaluates to zero or one.
b) It must contain a condition or expression that can be either true or false.
c) It must contain relational operators.
d) It must contain equality operators.
page-pfb
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
Which of the following is an equality operator?
(a) ==
(b) =
(c) >
(d) >=
If the increment of the for statement is ________ then the loop counts ________.
(a) true, downwards
(b) false, downwards
(c) positive, downwards
page-pfc
(d) negative, downwards
Q1: Variables defined inside a member function of a class have:
a. File scope.
b. Class scope.
c. Block scope.
d. Class or block scope, depending on whether the binary scope resolution operator (::)
is used.
Function __________ takes an error number and creates an error message string.
(a) errorstr
(b) strerror
(c) badstr
(d) strfail
page-pfd
Which of the following restricts the scope of a global variable to the file it's defined in?
(a) extern
(b) static
(c) int
(d) local
The number of bits in a bitfield is specified with __________.
(a) parenthesis as in bitfield(4)
(b) a colon as in bitfield : 4
(c) brackets as in bitfield[4]
(d) a dot as in bitfield.4
page-pfe
__________ are collections of data items "lined up in a row"insertions and deletions are
made anywhere in a __________.
a) Linked lists, linked list
b) Queues, queue
c) Stacks, stack
d) Binary trees, binary tree
Q2: Overloaded functions must have:
a. Different parameter lists.
b. Different return types.
c. The same number of parameters.
d. The same number of default arguments.
Q1: Class templates:
a. May include the statement template< typename Type >anywhere.
b. Must put template< typename Type >before the class definition.
page-pff
c. Must include template< typename Type >inside the class definition.
d. Have the option of including the optional statement template< typename Type >.
What does the following preprocessor code do?
#if !defined(NULL)
#define NULL 0
#endif
a) The code is incorrect, so it generates an error at preprocessor time.
b) The code ensures that NULL is always 0.
c) The code defines NULL to be 0 only if NULL is undefined.
d) The code ensures that NULL is defined throughout the entire program file.
The standard __________ stream enables a program to read data from the keyboard.
a) read
b) keyboard
c) dialog
page-pf10
d) input

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.