CAS CS 91764

subject Type Homework Help
subject Pages 10
subject Words 1424
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
Q1: In the source-code file containing a class's member function definitions, each
member function definition must be tied to the class definition by preceding the
member function name with the class name and ::, which is known as the:
a. Member definition linker.
b. Class implementation connector.
c. Source code resolver.
d. Scope resolution operator.
Which statement is true?
a) The conversion specifier %7.2f prints a floating-point value with a field width of 10
positions.
b) The conversion specifier %7.2f prints a floating-point value with 7 positions to the
left of the decimal point.
c) The conversion specifier %7.2f prints a floating-point value with 5 positions to the
left of the decimal point.
d) The conversion specifier %7.2f prints a floating-point value with 4 positions to the
left of the decimal point.
Which statement is false?
page-pf2
a) In C, a string is essentially a pointer to its first character.
b) Arrays may contain pointers.
c) Each entry in an array of strings is actually a pointer to the first character of a string.
d) The size of an array of strings is the sum of the lengths of the strings.
Q1: Select the false statement. Outputs are:
a. Flushed automatically at the end of a program.
b. Flushed when the buffer fills.
c. Able to be synchronized with inputs.
d. Never automatically tied to inputs.
Q1: A header file is typically given the filename extension:
a. .h
b. .hdr
c. .header
page-pf3
d. .cpp
In C, it is appropriate to say that a string is a(n) __________.
a) pointer
b) integer
c) double quote
d) sequence of characters contained in single quotes
The __________ is called a double selection statement.
a) if
b) when
c) if else
d) switch
page-pf4
What is the highest value assumed by the loop counter in a correct for statement with
the following header?
for (i = 7; i <= 72; i += 7)
a) 7
b) 77
c) 70
d) 72
Q4: A copy constructor must receive its argument by reference because:
a. Otherwise the constructor will only make a copy of a pointer to an object.
b. Otherwise infinite recursion occurs.
c. The copy of the argument passed by value has function scope.
d. The pointer needs to know the address of the original data, not a temporary copy of
it.
page-pf5
Arrays and structures are __________ entities in that they remain the same size
throughout program execution.
a) dynamic
b) automatic
c) register
d) static
Which statement is false?
a) A pointer may be incremented or decremented.
b) An integer may be added to a pointer.
c) All operators normally used in arithmetic expressions, assignment expressions and
comparison expressions are valid in conjunction with pointer variables.
d) A pointer may not be added to a pointer.
Which statement is true?
a) Programs should be written as collections of small functions.
page-pf6
b) A function must be no longer than one page.
c) The best engineered functions have many parameters and perform many distinct
tasks.
d) Every function must include an explicit return statement.
Q2: Inside a function definition for a member function of an object with data member x,
which of the following is not equivalent to this->x:
a. *this.x
b. (*this).x
c. x
d. None of the above are equivalent.
Various C statements enable you to specify that the next statement to be executed may
be other than the next one in sequence. This is called __________.
a) change of order
b) instruction skipping
c) transfer of control
page-pf7
d) rerouting
An identifier's __________ is where the identifier can be referenced in a program.
a) locality
b) vicinity
c) neighborhood
d) scope
Which statement is false?
a) Counter-controlled repetion is sometimes called definite iteration.
b) Sentinel-controlled iteration is sometimes called indefinite iteration.
c) The sentinel value typically indicates "end of data."
d) In counter-controlled iteration, the control variable is always incremented by 1 each
time the group of instructions is performed.
page-pf8
If an existing file is opened for writing __________.
a) the contents of the file are preserved
b) the contents of the file are discarded and an error code is returned
c) the contents of the file are discarded without warning
d) the newly written data is appended to the end of the file
The strlen function returns ________.
(a) the number of characters in a string excluding the null character
(b) the number of characters in a string including the null character
(c) the ASCII representation of the character
(d) none of these
page-pf9
Q1: Assuming the definition,
class BasePlusCommissionEmployee : public CommissionEmployee
which of the following is false?
a. The colon ( : ) in the header of the class definition indicates inheritance.
b. The keyword public indicates the type of inheritance.
c. All the public and protected members of class BasePlusCommissionEmployee are
inherited as public and protected members, respectively, into class
CommissionEmployee.
d. CommissionEmployee is the base class and BasePlusCommissionEmployee is the
derived class.
Which of the following is false?
a) Each variable being input in a scanf statement is generally preceded by an &.
b) Each variable being output in a printf statement is generally not preceded by an &.
c) In a printf statement, the comma that separates the format control string from the
expressions to be printed is placed inside the format control string.
d) Calculations can be performed inside printf statements.
page-pfa
What does the statement typedef struct card Card; do?
a) Defines card as a synonym for Card.
b) Defines Card as a synonym for card.
c) Defines Card as a synonym for struct card.
d) Defines Card as a synonym for typedef struct card.
Which statement about a correct for statement with an initialization expression, a
loop-continuation test, an increment expression and a loop body is false?
a) The initialization expression is executed only once.
b) The loop-continuation test is evaluated each time through the loop.
c) The initialization is performed each time through the loop.
d) The increment expression is performed after the loop body.
The compile stage is when ____________.
(a) the object code is linked with code for functions in other files
page-pfb
(b) the C program is translated into machine language code
(c) the program is executed one instruction at a time
(d) the program is placed in memory
Which function does not read data from standard input?
(a) scanf
(b) sscanf
(c) sprintf
(d) getchar
Which of the following will not produce a syntax error?
(a) Omitting a return type from a function definition if the function prototype specifies
a return type other than int
(b) Returning a value from a function defined as void
(c) Defining a function parameter again inside a function
(d) Using the same names for arguments passed to a function and the corresponding
parameters in the function definition
page-pfc
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).
fread and fwrite
a) can not read and write arrays of data
b) process all their data in human readable format
c) process all their data in the same format used by fscanf and fprintf, respectively
d) process all their data in "raw data" format
page-pfd
Which of the following is false? Macros
(a) must be defined with arguments.
(b) are replaced by their replacement text during execution time.
(c) cannot be redefined once defined.
(d) have no data type checking.
The highest level of data access is granted by a
a) non-constant pointer to non-constant data.
b) non-constant pointer to constant data.
c) constant pointer to non-constant data.
d) constant pointer to constant data.
A statement is called a block if it ________.
(a) is a compound statement
(b) contains definitions
page-pfe
(c) is a compound statement that contains definitions
(d) does not contain definitions
When programming in C you"ll typically use all of the following building blocks
except __________.
(a) functions from the standard library
(b) functions you create yourself
(c) functions other people have created for you
(d) functions provided by ANSI / ISO
Which expression raises x to the y power?
a) x ** y
b) x ^ y
c) x pow y
d) pow(x, y)
page-pff
Assuming the following pseudocode for the Fibonacci series, what is the value of
fibonacci(5)?
fibonacci(0) = 0
fibonacci(1) = 1
fibonacci(n) = fibonacci(n " 1) + fibonacci(n " 2)
(a) 8
(b) 1
(c) 3
(d) 5
The number 4 typically takes up _________ bit(s) when stored as a character on most
of today's computers.
(a) 1
(b) 2
(c) 3
(d) 8

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.