Tuesday 9 February 2016

C++ Placement Questions and Answers

C++ Placement Questions and Answers
1.A property which is not true for a classes
a).are removed from memory when not in use
b).permit data to be hidden from other classes.
c).bring together all aspects of an entity in one place.
d).Can closely model objects in the real world.

2.Which of the following cannot be legitimately passed to a function in c++.
a)constant           b)variable           c)structure             d)header file.

3.this pointer is
a)implicitly points to an object                                   b)can be explicitly used in a class.
c)can be used to return an object                               d)All of the above.
e)All of the above

3.To perform I/O stream with disk files in C++, you should
a)open and close files as in procedural languages.
b)use classes derived from ios.
c)use C language library functions to read and write data.
d)include the IOSTREAM.H header file.

4.RunTime Polymorphism is achieved in C++ by using______
a)friend function   b)virtual function   c)operator overloading   d)function overloading

5.In C++ dynamic binding the code matching the object under current reference will be called at.
a)Compile time          b)Run time           c)Editing time            d)Binding time

6.Following are the object oriented programming language
a)JAVA               b)C++                c)Small talk               d)All of above

7.How many characters are recognized by ANSI C++?
a)32           b)64               c)no limit               d).none of these

8.Inheritance is the process of
a).Object of one class acquires the properties of objects of another class
b).Variable of one class acquires the properties of variable of another class
c).Object of one class acquires the properties of objects of same class
d).Variable of one class acquires the properties of objects of another class

9.By default Class members are
a)Public                b)Private              c)Protected               d)nherited

10.How many words can be read by cin?
a)one                   b)Two              c)Three                d)Four

C++   Placement Questions and Answers

11.A function that is called automatically when an object is created is called as
a)constant               b)constructor             c)static            d)friend

12.The null character will take space of
a)0 byte                  b)2 byte               c)1 byte                d)8 byte

13.This operator is used to allocate memory dynamically
a)new                b)delete             c)static                  d)real

14.Which one is correct to declare an interface in a class?
a).By making all the methods pure virtual in a class
b).By making all the methods abstract using the keyword abstract in a class
c).By declaring the class as interface with the keyword interface
d).It is not possible to create interface class in C++

15.Keywords support dynamic method of resolution is
a)abstract                   b).Virtual               c)Dynamic              d)Typeid

16.Which pointer is implicit pointer passed as the first argument for non-static member functionsin C++?
a)self pointer          b)std::auto_ptr pointer                  c).Myself pointer              d)this pointer

17.Inventor of C++ language is
a)John Dell                 b)Bjarne Stroustrup                 c)Thomusn Steve             d)Karl Thomus

18.Destructor can have following number of argument
a)2            b)1                 c)0                 d)any no of arguments

19.How does code-bloating occur in C++?
ANSWER:-        Improper use of Inline functions and templates may lead to code bloating. Multiple Inheritance may also lead to code bloating


20.Explain  about a.) Function overloading b.) Operator overloading
Function overloading:
The capability of C++ to define several functions of the same name with different sets of parameters is called function overloading. While calling an overloaded function, the C++ compiler selects the proper function by examining the number, types and order of the arguments.
Function overloading is commonly used to create several functions of the same name that perform similar tasks but on different data types.
Operator overloading:
When the existing C++ operators are redefined to work on objects of user-defined classes, it is called operator overloading.
Overloaded operators form a pleasant facade which improve the understandability and reduce maintenance costs without adding anything fundamental to the language.

No comments:

Post a Comment