CDA 38315

subject Type Homework Help
subject Pages 9
subject Words 1703
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
Q2: When deriving a class from a protected base class, the public members of the base
class become _________ and the protected members of the base class become
__________?
a. protected, private
b. public, private
c. protected, protected
d. public, protected
A linked list is a __________ collection of self-referential structures, called nodes,
connected by pointer links.
a) hierachical
b) linear
c) branching
d) constant
All of the following are reasons to use recursion except:
(a) an iterative solution is not apparent
page-pf2
(b) the resulting program is easier to debug
(c) it more naturally mirrors the problem
(d) it maximizes software performance
Which of the following is not true of static local variables?
(a) They"re accessible outside of the function in which they are defined.
(b) They retain their values when the function is exited.
(c) They"re initialized to zero if not explicitly initialized by the programmer.
(d) They can be pointers.
Which of the following is a poor programming practice?
(a) indenting the statements in the body of each control statement
(b) using floating-point values as the counter in counter-controlled iteration
(c) using more than two levels of nesting
(d) placing vertical spacing above and below control statements
page-pf3
Which of the following statements correctly prints "Passed" if the student's grade is
greater than or equal to 60 and "Failed" if the student's grade is less than 60? [The
quotes, of course, should not print.]
a) printf("%s\n", grade >= 60 : "Passed" : "Failed");
b) grade >= 60 : puts("Passed ") ? puts("Failed ");
c) printf("%s\n", grade >= 60 ? "Passed" : "Failed");
d) grade >= 60 ? puts("Passed ") ? puts("Failed ");
Which of the following gives the number of elements in the array int r[]?
(a) sizeof (r)
(b) sizeof (*r)
(c) sizeof (r) / sizeof (int)
(d) sizeof (*r) / sizeof (int)
page-pf4
A stack is initially empty, then the following commands are performed.
push 5
push 7
pop
push 10
push 5
pop
Which of the following is the correct stack (assume the top of the stack is on the left).
(a) 5 10 7 5
(b) 5 10
(c) 7 5
(d) 10 5
Which of the following is not an advantage of object-oriented programming?
(a) Software is more reusable.
(b) Software is more understandable, correct and modify.
(c) Using a modular, object-oriented design-and-implementation approach can make
software-development groups much more productive.
(d) None of the abovethese are all advantages of object-oriented programming.
page-pf5
Q1: To rethrow an exception, the exception handler must:
a. Use the throw; statement.
b. Use the throw command with the same parameters as the original exception.
c. Return a reference to whatever caused the original exception.
d. Not have attempted to process that exception at all.
Which statement is false?
a) A pointer can always be assigned to another pointer of the same type.
b) A cast operator must always be used to convert the pointer on the right of an
assignment to the pointer type on the left of the assignment.
c) Variables of all pointer types can be assigned a pointer to void.
d) A pointer to void can be assigned a pointer of any type.
page-pf6
Q4: catch blocks are not required to contain:
a. Braces { }.
b. Parentheses ( ).
c. Some form of parameter type indication.
d. A parameter name.
The # preprocessor operator causes a replacement text token to be converted to
a) an integer
b) a string
c) a string surrounded by quotes
d) an integer surrounded by quotes
A two-dimensional array element incorrectly referenced as a[x, y] is actually evaluated
as
(a) a[x][y]
(b) a[y]
page-pf7
(c) a[x]
(d) a[0]
Which statement is false?
a) The operand of the address operator must be a variable.
b) The address operator cannot be applied to constants or to expressions.
c) The address operator can be applied to variables defined with the storage class
register.
d) The address operator can be applied to variables defined with the storage class static.
The first element in every array is the __________ element.
a) null
b) 1
c) 0
d) empty
page-pf8
Conditional compilation cannot be used to
(a) perform loops.
(b) ignore large blocks of code.
(c) debug programs.
(d) selectively define symbolic constants.
Which of the following is false?
(a) the first element of an array is the zeroth
(b) the last element of an array is the array size - 1
(c) the position number contained within square brackets is called a subscript
(d) a subscript cannot be an expression.
page-pf9
Q3: The main difference between a pure virtual function and a virtual function is:
a. The return type.
b. The member access specifier.
c. That a pure virtual function cannot have an implementation.
d. The location in the class.
Which of the following is false?
(a) break and continue statements alter the flow of control.
(b) continue statements skip the remaining statements in the body of the loop in which
they are embedded.
(c) break statements exit from the loop in which they are embedded.
(d) a continue statement can never appear in the else part of an if statement.
Which is not an iteration statement?
a) continue
b) for
page-pfa
c) while
d) do while
Which is not an input formatting capability of scanf?
a) inputting all types of data
b) inputting specific characters from an input stream
c) skipping specific characters in the input stream
d) replacing specific characters in the input stream
What is a problem with the preprocessor statement:
#define PI 3.14159;
a) It will make a program run slower.
b) #define should be #def
c) PI should be spelled with lowercase letters.
d) The semicolon is part of the substitution text, so 3.14159; will be substituted
whereever PI is used and this could lead to syntax errors.
page-pfb
With the %g conversion specifier, the value 0.0000875 prints as
a) 8.75e-05
b) 87.5e-06
c) 0.875e-04
d) 0 (because of truncation)
Which of the following is not a keyword?
a) int
b) return
c) if
d) main
page-pfc
Q1: The line:
virtual double earnings() const = 0;
appears in a class definition. You cannot deduce that:
a. All classes that directly inherit from this class will override this method.
b. This class is an abstract class.
c. Any concrete class derived from this class will have an earnings function.
d. This class will probably be used as a base class for other classes.
If you have a 1000-element balanced binary search tree, what is the maximum number
of comparisons that may be needed to find an element in the tree?
(a) 500
(b) 10
(c) 20
(d) 8
page-pfd
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.
Which of the following is not a predefined symbolic constant?
(a) __ERROR__
(b) __FILE__
(c) __TIME__
(d) __LINE__
page-pfe
Q5: For operators overloaded as non-static member functions:
a. Binary operators can have two arguments and unary operators can have one.
b. Both binary and unary operators take one argument.
c. Binary operators can have one argument, and unary operators cannot have any.
d. Neither binary nor unary operators can have arguments.
Which statement is correct?
a) Expressions with side effects (i.e., variable values are modified) should not be passed
to a macro because macro arguments may be evaluated more than once.
b) Expressions with side effects (i.e., variable values are modified) should not be passed
to a macro because macro arguments are evaluated only once.
c) Expressions with side effects (i.e., variable values are modified) should be passed to
a macro because macro arguments may be evaluated more than once.
d) Expressions with side effects (i.e., variable values are modified) should be passed to
a macro because macro arguments are evaluated only once.
If an error occurs while opening a file in any mode, fopen __________.
page-pff
a) causes program termination
b) returns NULL
c) issues the message "can"t open file"
d) diagnoses the error, waits five minutes and retries

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.