Object Oriented Programming Using C++ MCQ Test - Set 01 - ObjectiveBooks

Object Oriented Programming Using C++ MCQ Test - Set 01

Practice Test: Question Set - 01


1. The functions go in the _______ section of a class definition
    (A) Declaration
    (B) Implementation
    (C) Prototype
    (D) Functioning

2. The number of structures than can be declared in a single statement is
    (A) One
    (B) Two
    (C) Three
    (D) Unlimited

3. Which of the following calls a function named displayName, passing it no actual arguments?
    (A) call displayName;
    (B) call displayName ();
    (C) displayName;
    (D) displayName();

4. To use the this pointer with a member function, you ________
    (A) Declare this as static
    (B) Declare this as global
    (C) Define this as equal to the address of the appropriate object
    (D) Do nothing; it is automatically supplied for you

5. The C++ keyword for declaring a variable that contains a decimal point is ________
    (A) dec
    (B) decimal
    (C) float
    (D) floater

6. An auxiliary function ________
    (A) Return information about data members
    (B) Changes the state of data members
    (C) Performs an action or service
    (D) Creates and destroys objects

7. Programmers prefer to declare almost all variables ________
    (A) At the beginning of each function
    (B) Globally
    (C) On one line
    (D) With cryptic names

8. An advantage of using local variables is that ________
    (A) They are known to all functions in the file
    (B) Names used in one function do not affect data stored in variables with the same names in other functions
    (C) Values given to local variables are retained when those parameters go out of scope
    (D) The program does not become "crowded" with too many variable names

9. When accessing a structure member, the identifier to the left of the dot operator is the name of
    (A) A structure member
    (B) A structure tag
    (C) A structure variable
    (D) The keyword structure

10. The printer can be accessed using the predefined filename ________
    (A) printer file
    (B) print
    (C) cout
    (D) PRN, LPT1, etc

11. A C++ term meaning "generic" is
    (A) Argument
    (B) Parameterized
    (C) Universal
    (D) Global

12. Assume a program contains a void function named displayName, which requires no formal parameters. Which of the following is a correct function prototype for this function?
    (A) displayName;
    (B) displayName(void);
    (C) void displayName;
    (D) void displayName();

13. Which of the following will increase the value stored in the first element of the fee array by 2?
    (A) amount[0] = amount[0] + 2;
    (B) amount, fee[0] = amount, fee [0] + 2;
    (C) feelnfo.amount[0] = feelnfo.amount[0] + 2;
    (D) fee[0].amount = fee[0].amount + 2;

14. A constructor initialization list produces similar results to
    (A) Overriding
    (B) Assignment
    (C) Redeclaring
    (D) Output

15. The most common operation used in constructors is
    (A) Addition
    (B) Overloading
    (C) Assignment
    (D) Polymorphism

Show and hide multiple DIV using JavaScript View All Answers

 Next Tests: