COSC 66934

subject Type Homework Help
subject Pages 10
subject Words 1437
subject Authors Harvey Deitel, Paul Deitel

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Three of the following expressions have the same value. Which of the following
expressions has a value different from the others'?
a. *&ptr
b. &*ptr
c. *ptr
d. ptr
What method should be used to pass an array to a function that does not modify the
array and only looks at it using array subscript notation:
a. A nonconstant pointer to nonconstant data.
b. A nonconstant pointer to constant data.
c. A constant pointer to nonconstant data.
d. A constant pointer to constant data.
The default value for a string is ________.
a. null
b. void
page-pf2
c. blanks
d. the empty string
A string array:
a. Stores an actual string in each of its elements.
b. Can only provide access to strings of a certain length.
c. Is actually an array of pointers.
d. Is always less memory efficient than an equivalent double-subscripted array.
Pointers may be assigned which of the following values?
a. Any integer values.
b. An address.
c. nullptr.
d. Both (b) and (c).
page-pf3
Which of the following statements is true?
a. A class's body is enclosed in an opening left brace and a closing right brace.
b. A class definition terminates with a required semicolon.
c. Typically, each class definition is placed in a separate header with the .h filename
extension.
d. All of the above are ture.
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.
page-pf4
[C++11]: Which of the following statements initializes the unsigned int variable counter
to 10?
a. unsigned int counter = 10;
b. unsigned int counter = {10};
c. unsigned int counter{10};
d. All of the above.
Which of the following is true?
a. You can initialize data members of a class only in the class's constructor.
b. C++11 allows you to provide a default value for a data member when you declare it
in the class declaration.
c. You cannot initialize data members of a class.
d. None of the above
page-pf5
Which of the following statements is false?
a. Cloud computing allows you to use software, hardware and information stored on
remote computers via the Internet and available on demandrather than having it stored
on your personal computer.
b. Electronic health records enable health care providers to share patients' information
across a secure network, improving patient care, reducing the probability of error and
increasing overall efficiency of the health care system.
c. Global Positioning System (GPS) devices a single satellite to retrieve location-based
information.
d. The Human Genome Project was founded to identify and analyze the 20,000+ genes
in human DNA.
All of the following are true of functions except:
a. They define specific tasks that can be used at many points in a program.
b. A function call must specify the name and arguments of the function.
c. The definition of a function usually is visible to other functions.
d. The implementation of a function is hidden from the caller.
page-pf6
A variable that can have values only in the range 0 to 65535 is a:
a. Four-byte int.
b. Four-byte unsigned int.
c. Two-byte int.
d. Two-byte unsigned int.
Which of the following for headers produces the values from 27 through 3,
decrementing by 3?
a. for (unsigned int i{27}; i <= 3; i += 3)
b. for (unsigned int i{27}; i >= 3; i -= 3)
c. for (unsigned int i{27}; i > 3; i -= 3)
d. All of the above.
Which of the following best describes the array name n in the declaration int n[10];?
a. n is a nonconstant pointer to nonconstant data.
page-pf7
b. n is a nonconstant pointer to constant data.
c. n is a constant pointer to nonconstant data.
d. n is a constant pointer to constant data.
What is the value of result after the following C++ statements execute?
int a{4};
int b{12};
int c{37};
int d{51};
int result{d % a * c + a % b + a};
a. 119
b. 51
c. 127
d. 59
Which of the following statements is false?
page-pf8
a. Object-oriented programming is today's key programming methodology.
b. C++ is standardized worldwide through the International Organization for
Standardization.
c. Hardware controls software.
d. There are now more mobile devices than people in the world.
Which of the following is not a valid enumeration?
a. enum class Person {ME, YOU, THEM};.
b. enum class Person {ME = 1, YOU = 2, THEM = 3};.
c. enum class Person {ME = 0, YOU = 0, THEM = 0};.
d. enum class Person {ME, YOU, ME};.
Which of the following is not included in a function's activation record?
a. The return address of its caller function.
b. Parameter values received from its caller.
page-pf9
c. Local variables it has declared.
d. The name of the function.
A pointer can not be assigned to:
a. Another pointer of the same type without using the cast operator.
b. A pointer to void without using the cast operator.
c. A pointer of a type other than its own type and void without using the cast operator.
d. Any other pointer by using the cast operator.
Which of the following is not one of the C++ control structures?
a. if
b. switch
c. break
d. dowhile
page-pfa
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.
Consider the following function:
void reverse(char *string1, const char *string2)
{
int stringsize{sizeof(string1)/sizeof(char)};
*(string1 + stringsize " 1) = '\0';
string1 = string1 + stringsize " 2;
for (; *string2 != '\0'; string1--, string2++) {
*string1 = *string2;
}
}
page-pfb
What technique does the function use to refer to array elements?
a. Array subscript notation.
b. Pointer/offset notation where the pointer is actually the name of the array.
c. Pointer subscript notation.
d. Pointer/offset notation.
Which of the following statements about regular expressions is true?
a. They are used to match specific character patterns in text.
b. They can be used to replace parts of one string with another, or to split a string.
c. They can be used to validate data to ensure that it's in a particular format.
d. All of the above statements are true.
Which of the following statements would display the phrase C++ is fun?
a. std::cout << "Thisis fun\rC++ ";
b. std::cout << '++ is fun';
c. std::cout << ""C++ is fun"";
page-pfc
d. std::cout << C++ is fun;
Enumeration constants:
a. Must have unique integer values.
b. Can be assigned other values once they"ve been defined.
c. Must have unique identifiers.
d. Are declared using the keyword const.
Which of the following statements is false?
a. Variables declared in a particular function's body are local variables, which can be
used only in that function.
b. When a function terminates, the values of its local variables are preserved.
c. A function's parameters also are local variables of that function.
d. The argument types in the member function call must be consistent with the types of
the corresponding parameters in the member function's definition.
page-pfd
Which of the following is false for pointer-based strings?
a. A string may include letters, digits and various special characters (i.e., +, -, *).
b. A string in C++ is an array of characters ending in the null character ('\0').
c. String literals are written inside of single quotes.
d. A string may be assigned in a declaration to either a character array or a variable of
type char *.
Which of the following does counter-controlled iteration require?
a. An initial value.
b. A condition that tests for the final value.
c. An increment or decrement by which the control variable is modified each time
through the loop.
d. All of the above.
page-pfe
Which language was developed by Microsoft in the early 1990s to simplify the
development of Windows applications?
a. Visual C#.
b. Python.
c. Objective-C.
d. Visual Basic.
The expression if (num != 65) cannot be replaced by:
a. if (num > 65 || num < 65)
b. if (!(num == 65))
c. if (num " 65)
d. if (!(num " 65))
The unary scope resolution operator is used:
page-pff
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.
The assignment operator ________ assigns the value of the expression on its right to
the variable on its left.
a. <-
b. ->
c. =
d. #
Which of the following is false?
a. There are representational errors, when precise decimal dollar amounts and interest
rates are stored as doubles.
page-pf10
b. There are many currencies worldwide, with different conventions for thousands
separators, decimal separators, currency symbols, and more.
c. C++11's long long type supports values in the range "2,147,483,647 to 2,147,483,647
as a minimum.
d. C++11's int64_t type supports the exact range "9,223,372,036,854,775,808 to
9,223,372,036,854,775,807.

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.