Object Oriented Programming Using C++ – Section 8

21. Which of the following is a valid condition for an if statement? (The condition should be both syntactically and logically valid.)

A. (age) > 65
B. (age > 0 and < 10)
C. (sales > 500 && < 800)
D. (sales > 100 && sales <= 1000)
E. (sales > 100 || sales <= 1000)

Correct Answer:  D. (sales > 100 && sales <= 1000)

22. A pattern for creating an object is called a(n) _____

A. class
B. attributes
C. private
D. public

Correct Answer:  A. class

23. An asterisk placed after a data type means .

A. array to
B. pointer to
C. address to
D. located to

Correct Answer:  B. pointer to

24. An object is a(n) _____ of a class

A. owner
B. function
C. definition
D. instance

Correct Answer:  D. instance

25. Which of the following statements creates and initializes a pointer named salesPtr?

A. salesPtr = NULL;
B. *salesPtr = “”;
C. float &salesPtr = NULL;
D. float *salesPtr = “”;
E. float *salesPtr = NULL;

Correct Answer:  E. float *salesPtr = NULL;

Leave A Comment?

11 + nineteen =