C++ Programming Multiple Choice Questions - ObjectiveBooks

C++ Programming Multiple Choice Questions

Practice Test: Question Set - 07


1. Statement scanf(“%d”,80);
    (A) Assign an integer to variable i
    (B) Give an error message
    (C) Print the value of i
    (D) Assign an float to variable i

2. If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending loop block?
    (A) parentheses ( )
    (B) braces { }
    (C) brackets [ ]
    (D) arrows < >

3. Which of the following members do get inherited but become private members in child class
    (A) Public
    (B) Private
    (C) Protected
    (D) All the above

4. Which looping process is best used when the number of iterations is known?
    (A) for
    (B) while
    (C) do-while
    (D) All looping processes require that the iterations be known

5. In a C language ‘3’ represents
    (A) A digit
    (B) An integer
    (C) A character
    (D) A word

6. What’s wrong? while( (i < 10) && (i > 24))
    (A) The logical operator && cannot be used in a test condition
    (B) The while loop is an exit-condition loop
    (C) The test condition is always false
    (D) The test condition is always true

7. Which of the following is the most common way of implementing C++?
    (A) C++ programs are directly compiled into native code by a compiler
    (B) C++ programs are first compiled to intermediate code by a compiler and then executed by a virtual machine
    (C) C++ programs are interpreted by an interpreter
    (D) A C++ editor directly compiles and executes the program

8. Which of the following operators can be overloaded?
    (A) . (dot or member access operator)
    (B) & (address-of operator)
    (C) size-of operator
    (D) ?: (conditional operator)

9. If a member needs to have unique value for all the objects of that same class, declare the member as
    (A) Global variable outside class
    (B) Local variable inside constructor
    (C) Static variable inside class
    (D) Dynamic variable inside class

10. What defines a general set of operations that will be applied to various types of data?
    (A) Template class
    (B) Function template
    (C) Class template
    (D) Both (a) and (c) above

11. Under which of the following circumstances, synchronization takes place?
    (A) When the file is closed
    (B) When the buffer is empty
    (C) Explicitly, with manipulators
    (D) Both (a) and (c)

12. Which of the following functions below can be used Allocate space for array in memory?
    (A) calloc()
    (B) malloc()
    (C) Realloc()
    (D) Both (a) and (b)

13. Value of a in a = (b = 5, b + 5); is
    (A) Junk value
    (B) Syntax error
    (C) 5
    (D) 10

14. A continue statement causes execution to skip to
    (A) The return 0; statement
    (B) The first statement after the loop
    (C) The statement following the continue statement
    (D) The next iteration of the loop

15. What is deep copy?
    (A) A deep copy creates a copy of the dynamically allocated objects too
    (B) A deep copy just copies the values of the data as they are
    (C) A deep copy creates a copy of the statically allocated objects too
    (D) Both (b) and (c) above

Show and hide multiple DIV using JavaScript View All Answers

 Next Tests:

    Blogger Comment
    Facebook Comment