Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Question answer

Which of the following languages is a subset of C++ language? C language


Which of the following correctly describes C++ language? Statically typed language
Which of the following keyword supports dynamic method
resolution? Virtual
Which of the following language is not supported by C++? Reflection
Which of the following language feature is not an access specifier in
C++? internal
What does STL stand for? Standard Template Library
C++ programs are directly compiled into native code
Which of the following is the most common way of implementingC++?
by a compiler
What is the implicit pointer that is passed as the first argument for
nonstatic member functions? ‘this’ pointer
If X is the name of the class, what is the correct way to declare copy
constructor of X? X(const X& arg)
Which of the following operator cannot be overloaded? :: (scope resolution operator)
Which of the following operators can be overloaded? & (address-ofoperator)
By providing at least one pure virtual method (function
signature followed by ==0;) in a class
How do we declare an abstract class?
By making all the methods pure virtual in a class
How do we declare an ‘interface’ class?
How many copies of a class static member are shared between objects of the class? A copy of the static member is shared by all objects of
a class
const members can be invoked on both const as well as
nonconst objects
Which of the following is true about const member functions?

When new operator cannot allocate memory


When is std::bad_alloc exception thrown?
Which header file should we include for using std::auto_ptr? <autoptr>
STL is based on which of the following programming paradigms? Functional Programming
namespaces provide facilities for organizing the names
Which of the following correctly describes the meaning of ‘namespace’ feature in C++? in a program to avoid name clashes
Which of the following is the most general exception handler that
catches exception of any type? catch(…)
Which of the following relationship is known as
inheritancerelationship? ‘is-a’ relationship
Question answer
Following is the not a correct statement for preprocessor directive #include<iostream.h> #define
declaration? LEFT 1
Originally ‘C’ was developed as: General purpose language
In C++ if return statements is written in a non-void function without any specified value, what
undefined
will be return value of the function?
In C++ how many return statements are allowed in a non-void
function? as many as you like
In C++ if program executed successfully, following value will be returned to the calling
process, if nothing specified in return 0
statement?
Individual characters in a string are accessed as following cout << S[i];
Which of the following keyword is not used in exception handling allow
Which of the following is invalid header file name? <iostring>
The pow functions returns : double
Which of the following are valid array declaration float avg[5]
char * const ptr1 = “nice”; //this is example of , constant pointer
int const *ptr1 = &m; // this is example of, pointer to a constant

In the following statement, const char * const cp = “xyz”; Both of above


In C++, symbolic constants created using Both of above
A friend class in C++, can access the " " members of the
class in which it is declared as a friend private and protected
A friend function that is a "friend" of a given class is allowed access
to data in that class. public, private, or protected
Object can be used as a function argument by.. All of above
Member function of one class can be friend function of another class TRUE
Member function of one class can be friend function of another class
is called as friend class
in C++, an object can be returned as argument TRUE
Following is the dereferencing operator ->*
Inventor of C++ language is Bjarne Stroustrup
Destructor can have following number of argument 0
While executing a program we first need to translate the source
code into object code, it is called as compiling
Array elements are accessed using Index number
Following operator cannot be used for operator overloading sizeof
A function that is called automatically when an object is created is
called as constructor
The null character will take space of 1 byte
This operator is used to allocate memory new
Enables the initialization of an object as it is created
A constructor
When a copy of an entire object is passed to a function, then it is
referred to as Pass-by-value
Consider the statements a = 13 ; c = a<< 3 ; (a and c are integers).
The result assigned to the integer c is 104
What does C++ append to the end of a string literal constant? a null character
Question answer
he statement int num[2][3]={ {1,2}, {3,4}, {5, 6} }; gives an error message
The statement fwrite ( (char*)&objl, sizeof(objl) ); writes the data in objl to fl
Which of the following type casts will convert an Integer variable
named amount to a Double type? (double) amount
You have assigned the address of Value to the pointer P, Which
statement will display the value stored in Value? cout << * < P;
The keyword used to transfer control from a function back to the
calling function is return
Which of the following can not be used as identifiers? Spaces
A function that calls itself for its processing is known as Recursive Function
Observe following function declaration and choose the best answer: int divide ( int a, int b = 2 ) Variable b will have value 2 if not specified when calling
function
Variables inside parenthesis of functions declarations have
level access. Local
Strings are character arrays. The last index of it contains the null-
terminated character \0
Which of the following identifiers is invalid? typename
A function that calls itself for its processing is known as Recursive Function
Observe following function declaration and choose the best answer: int divide ( int a, int b = 2 ) Variable b will have value 2 if not specified when calling
function
Variables inside parenthesis of functions declarations have
level access. Local
Strings are character arrays. The last index of it contains the null-
terminated character \0
Which of the following identifiers is invalid? typename

In an assignment statement All of above

It is a C++ statement that declares a constant in C++


Regarding #define which of the following statement is false?
Additional information sent when an exception is thrown may be
placed in the catch block.
have to be redefined in the
Pure virtual functions inherited class.
cannot be used in inheritance
A struct is the same as a class except that hierarchy
The operator that cannot be overloaded is ::
the data members of the
A friend function to a class, C cannot access derived class of C.
Which statement gets affected when i++ is changed to ++i? i = 20; i++;
If you wanted to sort many large objects or structures, it would be most efficient to place them in a linked list and sort the linked list.

The process of building new classes from existing one is called Inheritance
The keyword friend does not appear in the private section of a class.
the cin.get( ) function with two
You can read input that consists of multiple lines of text using arguments.
Question answer
bring together all aspects of an entity in one place.
A property which is not true for classes is that they

Which of the following cannot be legitimately passed to a function A structure


Class whose objects will be
In which case is it mandatory to provide a destructor in a class? created dynamically

You might also like