Object Oriented Programming in c++ Class Online - Set 25 - ObjectiveBooks

Object Oriented Programming in c++ Class Online - Set 25

Practice Test: Question Set - 25


1. Two access specifers in C++ are
    (A) public and private
    (B) int and double
    (C) formal and informal
    (D) void and free

2. The general form of do-while statement is
    (A) do expression while statement;
    (B) do while expression;
    (C) do statement while (expression);
    (D) do statement while statement;

3. 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)

4. Some Streams work with input, and some with output
    (A) True
    (B) False

5. The comma operator (,) is used to
    (A) Permit two different expressions to appear in situations where only one expression would ordinarily be used
    (B) Terminate loops or to exit from switch
    (C) Alter the normal sequence of program execution by transferring control to some other part of the program
    (D) Carry out a logical test and then take one of two possible actions, depending upon the outcome of the test

6. The data type listed at the beginning of a value-returning function's header indicates the type of data the function will _______
    (A) Return
    (B) Pass
    (C) Receive
    (D) All of the above

7. The keyword used to define a structure is _______
    (A) stru
    (B) stt
    (C) struct
    (D) structure

8. The element of an array is
    (A) The name of the array
    (B) A member of an array
    (C) A value assigned to an array
    (D) All of the above

9. A measure of the strength of the connection between two functions is
    (A) Cohesion
    (B) Coupling
    (C) Dependence
    (D) Subjection

10. If you create an instantiation of a class template with an int, and then create a second instantiation with a double, then
    (A) You must precede each function call with the word int or double
    (B) Once a function is used as one type, it becomes unavailable for use with the other type
    (C) There is no difference in the procedure to call a member function
    (D) You cannot perform this operation in C++

11. A function's single most important role is to
    (A) Give a name to a block of code
    (B) Reduce program size
    (C) Accept arguments and provide a return value
    (D) Help organize a program into conceptual units

12. Access specifiers are followed by
    (A) A comma
    (B) A semicolon
    (C) A colon
    (D) Two colons

13. To enter a comment in a C++ program, you begin the comment with ________
    (A) **
    (B) &&
    (C) \\
    (D) //

14. The 'continue' statement is used to
    (A) Permit two different expressions to appear in situations where only one expression would ordinarily be used
    (B) Terminate loops or to exit from a switch
    (C) Alter the normal sequence of program execution by transferring control to some other part of the program
    (D) None of the above

15. Declaring variables is advantageous because it
    (A) Avoids errors from misspelled variable names {b) helps the linker work efficiently
    (B) Simplifies the writing of very short programs
    (C) Both (a) & (b) above
    (D) None of the above

Show and hide multiple DIV using JavaScript View All Answers

 Next Tests: