CDA 55096

subject Type Homework Help
subject Pages 9
subject Words 1503
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
Experience has shown that the best way to construct a program is from small pieces.
This is called __________.
a) bottom up
b) the whole is greater than the sum of the parts
c) divide and conquer
d) recursion
What's wrong with this code?
int[] = (1, 2, 3, 4, 5);
a) The array size must be specified in the square brackets.
b) The parentheses should be square brackets.
c) The square brackets should be curly braces.
d) The parentheses should be curly braces.
Structure variables may not be initialized by
(a) setting user-defined default variable values in the struct definition.
page-pf2
(b) assigning values to individual data members.
(c) array-like member initializer lists.
(d) assignment statements.
Which of the following must every C program have?
(a) main
(b) #include
(c) /*
(d) <stdio.h>
Q1: Which C++ data type was designed to store Unicode characters?
a. char
b. long
c. wchar_t
d. size_t
page-pf3
Q3: Assume that the function call operator() is overloaded for data type String in the
usual sense of selecting a substring from a larger string. For a String object string1 with
the character string "ABCDEFGHI", what string does string1( 4 , 2 ) return?
a. "EF"
b. "EFGHI"
c. "CDEF"
d. "CD"
Which statement is true?
a) With nested control statements, the inner control statement is executed in sequence
after the outer control statement completes its own execution.
b) With nested control statements, the inner control statement is executed exactly once.
c) Experience has shown that the most difficult part of solving a problem on a computer
is converting an already correct algoithm to a C program.
d) A double-selection statement can be nested in an iteration statement.
page-pf4
Which statement about integer conversion specifiers is false?
a) It is an error to print a negative value with a conversion specifier that expects an
unsigned value.
b) "455 when printed with %u prints 455.
c) When printing an integers with %d, the plus sign (on a positive integer) does not
print.
d) Place an l ("el") before any integer conversion specifier to indicate that a long integer
is displayed.
Which is not an attribute of a variable?
a) storage class
b) storage duration
c) scope
d) external class
page-pf5
Q1: If Americans are objects of the same class, which of the following attributes would
most likely be represented by a staticvariable of that class?
a. Age.
b. The President.
c. Place of birth.
d. Favorite food.
Which statement is true?
a) Use float variables to perform monetary calculations in C.
b) Use double variables to perform monetary calculations C.
c) Monetary calculations can be performed in C.
d) Printing with %.2f guarantees correct monetary calculations in C.
(*max)(num1, num2, num3);
(a) is the header for function max
(b) is a call to function max
page-pf6
(c) is the prototype for function max
(d) is part of a definition of a pointer to the function max
Which of the following is false?
a) Lists of data can be stored in arrays.
b) The length of a linked list can vary dynamically.
c) Arrays can become full.
d) Linked lists cannot become full.
Which statement is false with regard to format control string flags?
a) The plus sign is only displayed when the + flag is used.
b) The minus sign is always displayed (when the value being printed is negative).
c) To use a flag in a format control string, place the flag immediately to the left of the
percent sign.
d) Use the 0 flag to pad a field with leading zeros.
page-pf7
Which integer conversion specifier displays an unsigned octal integer?
a) oct
b) OCT
c) o (lowercase letter)
d) O (uppercase letter)
Q2: Concrete classes that inherit virtual functions but do not override their
implementations:
a. Have vtables which are the same as those of their base classes.
b. Receive their own copies of the virtual functions.
c. Receive pointers to their base classes' virtual functions.
d. Receive pointers to pure virtual functions.
page-pf8
Q2: Select the false statement. A rethrown exception:
a. Is detected by the next enclosing try block.
b. Is the immediate result of a throwcommand.
c. Can be processed by exception handlers following the enclosing try block.
d. Must have been fully processed at the time it was rethrown.
Which statement is false?
a) In algebra, we write ab to multiply a times b.
b) In C, we write ab to multiply a times b.
c) In C, the remainder operator is %.
d) In C, integer division yields an integer result.
Q1: When an argument is passed-by-value, changes in the calling function __________
affect the original variable's value; when an argument is passed call-by-reference,
changes __________ affect the original variable's value.
a. Do not, do.
b. Do not, do not.
page-pf9
c. Do, do.
d. Do, do not.
A function prototype can always be omitted when a function ________.
(a) is defined before it is first invoked
(b) is invoked before it is first defined
(c) takes no arguments
(d) does not return a value
To change the string "ABCDEFGHI"to "aaaaaFGHI" you would use the _________
function.
(a) memset
(b) memcmp
(c) memchr
(d) memcopy
page-pfa
Q2: Which situation would require the operator to be overloaded as a non-member
function?
a. The overloaded operator is =.
b. The left most operand must be a class object (or a reference to a class object).
c. The left operand is an int.
d. The operator returns a reference.
Function __________ reads one character from a file.
a) fgetcharacter
b) fgetc
c) fgetchar
d) fgetbyte
page-pfb
Which assignment expression is equivalent to c = c / 2 ?
(a) c / = 2
(b) c / c = 2
(c) c /= 2
(d) c =/ 2
Assuming that t is an array and tPtr is a pointer to that array, what expression refers to
the address of element 3?
(a) *(tPtr + 3)
(b) tPtr[3]
(c) &t[3]
(d) *(t + 3)
Which statement is false?
a) When we define a local variable in a block it can be referenced only in that block or
in blocks in which that block is nested.
b) Labels are the only identifiers with function scope.
page-pfc
c) Labels can be used anywhere in the function in which they appear, but can not be
referenced outside the function body.
d) Labels are used in switch statements and in goto statements.
A function prototype does not have to ________.
(a) include parameter names
(b) terminate with a semicolon
(c) agree with the function definition
(d) match with all calls to the function
Counter-controlled iteration is often called __________ iteration because the number of
iterations is known before the loop begins executing.
a) indefinite
b) sentinel
c) definite
d) determinate
page-pfd
If an error occurs while opening a file in any mode, function fopen returns ________.
(a) true
(b) NULL
(c) false
(d) -1
Which of the following is an incorrect expression to increment c by 1 in the increment
expression of a for "header?"
a) c += 1
b) ++c
c) c++
d) c + 1 = c
page-pfe
Q2: Run-time type information can be used to determine:
a. A function's return type.
b. A function's argument type.
c. An object's type.
d. The number of arguments a function takes.
Placing a semicolon after the parenthesized condition in an if statement leads to a
__________ error in single-selection if statements and a __________ error in
double-selection if statements.
a) logic, logic
b) logic, syntax
c) syntax, logic
d) syntax, syntax
Which is not a C iteration statement?
a) while
page-pff
b) dowhile
c) for
d) dofor

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.