Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Login

Register Now

Welcome to All Test Answers

Chapter 15 – C How to Program 6e Multiple Choice Test Bank


 

Download  file with the answers

Not a member!
Create a FREE account here to get access and download this file with answers


Section 15.2 C++
15.2 Q1: Today, virtually all new major operating systems are written in:
a.B or BCPL.
b.C or C++.
c.UNIX.
d.Smalltalk.

15.2 Q2: C++ is a:
a.Typeless language.
b.Hybrid object-oriented language.
c.Subset of the C Language.
d.Pure object-oriented language.

Section 15.3 A Simple Program: Adding Two Integers

15.3 Q1: End-of-line comments that should be ignored by the compiler are denoted using:
a.Two forward slashes ( // ).
b.Three forward slashes ( /// ).
c.A slash and a star ( /* ).
d.A slash and two stars ( /** ).

15.3 Q2: A(n) ________ enables a program to read data from the user.
a.std::cout.
b.std::cin.
c.return statement.
d.main declaration.

15.3 Q3: Which of the following is a variable declaration statement?
a.int total;
b.#include
c.int main()
d.// first string entered by user

Section 15.4 C++ Standard Library

15.4 Q1: Which of the following statements about the C++ Standard Library is false:
a.The C++ Standard Library consists of classes and functions that perform tasks.
b.The C++ Standard Library is an important part of the C++ “world.”
c.An advantage of using classes and functions from the C++ Standard Library is saving the effort of designing, developing and testing new classes.
d.The C++ Standard Library functions and classes are not included in every C++ implementation.

Section 15.5 Header Files

15.5 Q1: Each standard library has a corresponding:
a. Function.
b. Variable type.
c. Header file.
d. Cd-rom.

15.5 Q2: Which of the following C++ Standard Library header files does not contain a C++ Standard Library container class?
a. .
b. .
c. .
d. .

Section 15.6 Inline Functions

15.6 Q1: The inline keyword:
a. Increases function-call overhead.
b. Can reduce a function’s execution time but increase program size.
c. Can decrease program size but increase the function’s execution time.
d. Should be used with all frequently used functions.

Section 15.7: Reference and Reference Parameters

15.7 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.
c. Do, do.
d. Do, do not.

15.7 Q2: A reference parameter:
a. Is an alias for its corresponding argument.
b. Is declared by following the parameter’s type in the function prototype by an ampersand (&).
c. Cannot be modified.
d. Both (a) and (b).

15.7 Q3: Call-by-reference can achieve the security of call-by-value when:
a. The value being passed is small.
b. A large argument is passed in order to improve performance.
c. A pointer to the argument is used.
d. The const qualifier is used.

Section 15.8: Empty Parameter Lists

15.8 Q1: Which of the following is correct keyword to explicitly indicate that a function does not receive any parameters?
a.empty
b.void
c. epl
d. none

15.8 Q2: Which of the following is false about the following function prototype?

void functionA( void );

a. It does not receive any arguments.
b. It could have been written void functionA( );.
c. It does not return a value.
d. It could have been written functionA( void );.

Section 15.9 Default Arguments

15.9 Q1: In regards to default arguments, which of the following is false?
a. When an argument is omitted in a function call, the default value of that argument is automatically inserted by the compiler and passed in the function call.
b. They must be the rightmost (trailing) arguments in a function’s parameter list.
c. Default values can be constants.
d. Default values cannot be global variables or function calls.

15.9 Q2: If the function int volume( int x = 1, int y = 1, int z = 1 ); is called by the expression volume( 3 ), how many default arguments are used?
a. None.
b. One.
c. Two.
d. Three.

Section 15.10 Unary Scope Resolution Operator

15.10 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.

Section 15.11 Function Overloading

15.11 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.

15.11 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.

15.11 Q3: Type-safe linkage is ensured by:
a. Name mangling.
b. Calling the correct function.
c. The agreement of the arguments and parameters.
d. Specifying return types.

Section 15.12 Function Templates

15.12 Q1: If a function’s program logic and operations are identical for each data type it could receive as argument(s) then a __________ should be used.
a. Overloaded function.
b. Recursive function.
c. Macro.
d. Function template.

15.12 Q2: Which of the following is true of function templates?
a. All function templates begin with the keyword class.
b. Every formal type parameter is preceded by either keyword typename or template.
c. Formal type parameters act as placeholders for built-in types or user-defined types and are used to specify the types of arguments to the function, to specify the return type of the function, and to declare variables within the body of the function definition.
d. A programmer must define a separate function template for each template function specialization to be used in the program.

15.12 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.

Section 15.13 Introduction to Object Technology and the UML

15.13 Q1: The other classes or functions that use a certain class are referred to as its:
a. Clients.
b.Data members.
c.Member functions.
d.Methods.

15.13 Q2: Which of the following is not true of object-oriented design?
a. OOD takes advantage of inheritance relationships.
b.OOD encapsulates attributes and operations into objects.
c.OOD focuses on actions (verbs).
d.Each class can be used to create multiple objects.

About

Leave a reply

Captcha Click on image to update the captcha .

error: Content is protected !!