1. The declaration int **var1; shows that
(a) var1 can not be accessed
(b) var1 is a pointer to a pointer of type int
(c) var1 is a protected data type of integer
(d) this type declaration shows an error
Answer: (b) var1 is a pointer to a pointer of type int
2. In C++, the keyword auto can be used for
(a) Automatic assignment of data to object during instantiation
(b) Automatic call of a function
(c) To declare a local variable
(d) It is not a keyword in C++
Answer: (c) To declare a local variable
3. By default, C++ uses the following method of passing arguments
(a) Call-by-Reference
(b) Call-by-Value
(c) Call-by-Pointer
(d) None of the above
Answer: (b) Call-by-Value
4. Pick out the most appropriate statement from the following
(a) references are pointers
(b) array of references can be created
(c) you can not reference a reference variable
(d) all of the above
Answer: (c) you can not reference a reference variable
5. The ?: can be used to replace
(a) if-else statement
(b) wild cards
(c) no meaning in C++
(d) returns the value
Answer: (a) if-else statement
6. Dynamic memory can be allocated by the following declaration
(a) new
(b) volatile
(c) static
(d) ==
Answer: (a) new
7. The member of a structure can be directly accessed by
(a) ->
(b) dot operator
(c) ::
(d) >>
Answer: (b) dot operator
8. The member of a structure can be accessed through a pointer by
(a) ->
(b) dot operator
(c) ::
(d) >>
Answer: (a) ->
9. The members of a class can be made private by
(a) declaring them private
(b) by default they are private
(c) by declaring them in the beginning of the program immediately after main()
(d) they are always public
Answer: (a) declaring them private
10. A function that is called automatically when an object is created is known as
(a) instantiation
(b) function prototype
(c) constructor
(d) structure
Answer: (c) constructor
11. A function that is called automatically when an object is destroyed is known as
(a) instantiation
(b) function prototype
(c) constructor
(d) destructor
Answer: (d) destructor
12. It is possible to allow non member function access to private members of a class by declaring it as
(a) public
(b) friend
(c) private
(d) not possible
Answer: (b) friend
13. When one object initializes another object the following function is invoked
(a) copy constructor
(b) new
(c) instantiation
(d) none of the above
Answer: (a) copy constructor
14. A base class is inherited by
(a) derived class
(b) inline function
(c) constructor
(d) none of the above
Answer: (a) derived class
15. By using protected, one can create class members that are private to their class but
(a) that can not be inherited and accessed by a derived class
(b) that can still be inherited and accessed by a derived class
(c) that can be public
(d) none of the above
Answer: (b) that can still be inherited and accessed by a derived class
16. A pure virtual function is a virtual function that has
(a) no definition in its base class
(b) a definition in its base class
(c) a definition in at least one derived class
(d) definition in base class and at least one derived class
Answer: (a) no definition in its base class
17. A class that contains at least one pure virtual function is called as
(a) pure class
(b) abstract class
(c) base class
(d) derived class
Answer: (b) abstract class
18. The binding that binds a function call at run time is called
(a) early binding
(b) run time binding
(c) late binding
(d) linking
Answer: (c) late binding
19. One of the major disadvantage with late binding is
(a) the source code should be made available at compile time
(b) the program runs slower
(c) dynamic variables can not be used in the program
(d) static variables can not be used
Answer: (b) the program runs slower
20. One of the important features of an abstract class is
(a) it need not have any object
(b) it should be used only as a derived class
(c) it need not have any members
(d) none of the above
Answer: (a) it need not have any object
No comments:
Post a Comment