الأربعاء، 19 ديسمبر 2012

MCQ of C++ with answer Set-2


1. The ……………. Operator is known as insertion operator.
A) >>
B) >
C) <<
D) <

2. State True or False.
i) A satic function can have access to only other static members (functions or variables) declared in the same class.
ii) A static member function can be called using the class name (instead of its objects)
A) True, True
B) True, False
C) False, True
D) False, False

3. Which of the following condition is true for an object used as a function argument?
i) A copy of the entire objects is passed to the function.
ii) Only the address of the object is transferred to the function.
A) Only i
B) Only ii
C) Both i and ii
D) None of them


4. …………… enable us to hide, inside the object, both the data fields and the methods that act on that data.
A) Encapsulation
B) Polymorphism
C) Inheritance
D) Overloading

5. Which of the following is/ are the characteristics of friend function.
A) It is not in the scope of the class to which it has been declared as friend.
B) It can invoke like a normal function without the help of any object.
C) Usually, it has the objects as arguments.
D) All of the above.

6. The dereferencing operator ………….. is used to access a member when we use pointers to both the object and the member.
A) ->*
B) .*
C) Any of the above
D) None of the above

7. A ………………. Is a class whose instances themselves are classes.
A) Subclass
B) Abstract Class
C) Meta Class
D) Object Class

8. The dereferencing operator ……… is used when the object itself is used width in the member pointer.
A) ->*
B) .*
C) Any of the above
D) None of the above

9. A constructor that accepts no parameters is called the ……………….
A) Paramless constructor
B) No parameter constructor
C) Default constructor
D) Argumentless constructor

10. Automatic initialization of object is carried out using a special member function called …………
A) Friend
B) Casting
C) Reference Parameter
D) Constructor

11. Which of the following characteristics of constructor are true.
i) They should be declared in the public section.
ii) They are invoked automatically when the objects are created.
iii) They do not have return type and void also.
iv) We cannot refer their address.
v) Constructors cannot virtual.
A) Only i, ii, iii and v
B) Only ii, iii, iv, and v
C) Only i, iii, iv and v
D) All i, ii, iii, iv and v

12. A ……………. takes a reference to an object of the same class as itself as an argument.
A) Reference constructor
B) Copy Constructor
C) Self Constructor
D) None of the above

13. State True or False
i) A destructor never takes any argument nor does it return any value.
ii) It releases memory space for future use.
A) True, True
B) True, False
C) False, True
D) False, False

14. Which of the following operates cannot be overloaded?
i) Size of operator (sizeof)            ii) Scope resolution Operator
iii) Conditional operator (?:)        iv) Assignment Operator (=)
A) i, ii, iii only
B) ii, iii, iv only
C) i, iii, iv only
D) all i, ii, iii, iv

15. …………. Is the process of creating new classes, called derived classes from existing classes called base class.
A) Inheritance
B) Encapsulation
C) Polymorphism
D) Overloading

16. State True or False.
i) While overloading operators new operator can be overloaded.
ii) The binary operator such as +, -, * and must explicitly return a value.
A) True, True
B) True, False
C) False, True
D) False, False

17. ………… function writes a string of text to a window.
A) cputs ()
B) put ()
C) gets ()
D) tputs ()

18. Which of the following condition (s) should satisfy the casting operator.
i) It must be a class member.
ii) It must not satisfy a return type.
iii) It must have any arguments.
iv) All of the above.

19. Find the Hierarchy of Data Types.
i) Long double   ii) Double             iii) Float                                iv) Long                                v) Int         vi) Char
A) 1-2-3-4-5-6
B) 1-3-2-4-5-6
C) 1-2-3-5-4-6
D) 1-2-4-3-5-6

20. ………….. function sets the fill pattern and color.
A) floodfill ()
B) setcolor()
C) setfillstyle()
D) fillstyle ()

 Answers:
1.       C) <<
2.       B) True, False
3.       C) Both i and ii
4.       A) Encapsulation
5.       D) All of the above.
6.       A) ->*
7.       C) Meta Class
8.       B) .*
9.       C) Default constructor
10.   D) Constructor
11.   D) All i, ii, iii, iv and v
12.   B) Copy Constructor
13.   A) True, True
14.   A) i, ii, iii only
15.   A) Inheritance
16.   C) False, True
17.   A) cputs ()
18.   iv) All of the above.
19.   A) 1-2-3-4-5-6
20.   C) setfillstyle()


You might also view the following related posts
For other more posts: Click Here

ليست هناك تعليقات:

إرسال تعليق