Practice Test: Question Set - 08
1. Element doubleArray[7] is which element of the array?
- (A) The
sixth
- (B) The
seventh
- (C) The
eighth
- (D) Impossible
to tell
2. The rules of a programming language are called its ________
- (A) Code
- (B) Guidelines
- (C) Procedures
- (D) Syntax
3. The cout << sales[0] + sales[1]; statement will ________
- (A) Display
22000
- (B) Display
10000 + 12000
- (C) Display
sales[0] + sales[l]
- (D) Result in an
error
4. Which of the following is the insertion operator?
- (A) >>
- (B) <<
- (C) //
- (D) /*
5. Which of the following tells C++ to display numbers with two decimal places?
- (A) setdecimal(2)
- (B) setiosflags(2)
- (C) setiosflags(2.00)
- (D) setprecision(2)
6. To pass an array by reference, you
- (A) Must
include the address-of (&) operator before the array's name
- (B) Must
include the number symbol (#) before the array's name
- (C) Do
not have to do anything because arrays are automatically passed by reference
- (D) None
of the above
7. Many programmers separate a class into two files: _______
- (A) One
for the declarations and one for the implementations
- (B) One
for the void functions and one for the other functions
- (C) One
for the public data and one for the private data
- (D) One
for the primary functions and one for the auxiliary functions
8. When you write to a file rather than the screen, you use the C++ class _______
- (A) iostream
- (B) filed
- (C) fstream
- (D) diskclass
9. Which function is most likely to have procedural cohesion?
- (A) main()
- (B) findSquareRoot()
- (C) getSaleSubtractDiscountAddTax()
- (D) openFiles()
10. If two types of errors may be thrown, you should write _______
- (A) No catch
blocks
- (B) One
catch block with two arguments
- (C) Two
catch block-one with an argument, and one without
- (D) Two
catch blocks with one argument each
11. A(n) _______ is always incremented by a constant amount, whereas a(n) _______ is incremented by an amount that varies
- (A) Accumulator,
counter
- (B) Counter,
accumulator
- (C) Both (a) and
(b)
- (D) None of
these
12. An array element is accessed using
- (A) A
first-in-first-out approach
- (B) The dot
operator
- (C) A member
name
- (D) An
index number
13. If you want only one memory location to be reserved for a class variable, no matter how many objects are instantiated, you should declare the variable as
- (A) Static
- (B) Unary
- (C) Dynamic
- (D) Volatile
14. We can output text to an object of class of stream using the insertion operator « because
- (A) The of
stream class is a stream
- (B) The
insertion operator works with all classes
- (C) We are
actually outputting to cout
- (D) The
insertion operator is overloaded in ofstream
15. Assume that your version of C++ can recognize only the first 8 characters of an identifier name, through identifier names may be arbitrarily long. Which of the following identifier names is not distinct?
- (A) list, list2
- (B) address,
Address
- (C) identifier_l,
identifier_2
- (D) answer,
ANSWER
Next Tests:
Blogger Comment
Facebook Comment