Top 99 interview questions and answers for C++| Part 3
These C++ Interview Questions have been designed specially to get you acquainted with the nature of questions you may encounter during your interview for the subject of C++.
Top 99 interview questions and answers for C++
67.
By default the functions are called by value.
68.
Ideally it is 32 characters and also implementation dependent.
69.
Program name.
70.
What is recursion? Function calling itself is called as recursion. |
71.
The only two permitted operations on pointers are
- Comparision ii) Addition/Substraction (excluding void pointers)
72.
How can we refer to the global variable if the local and the global variable names are same? We can apply scope resolution operator (::) to the for the scope of global variable. |
73.
sizeof
74.
Bjarne Stroustrup.
75.
No, there is no such provision available.
76.
Which compiler switch to be used for compiling the programs using math library with g++ compiler? Opiton –lm to be used as > g++ –lm <file.cpp> |
77.
What is reminder for 5.0 % 2? Error, It is invalid that either of the operands for the modulus operator (%) is a real number. |
78.
Call by value: We send only values to the function as parameters. We choose this if we do not want the actual parameters to be modified with formal parameters but just used.
79.
The arguments which we pass to the main() function while executing the program are called as command line arguments. The parameters are always strings held in the second argument (below in args) of the function which is array of character pointers. First argument represents the count of arguments (below in count) and updated automatically by operating system. (more…)
80.
A class members can gain accessibility over other class member by placing the class declaration prefixed with the keyword ‘friend’ in the destination class.
81.
What is the order of objects destroyed in the memory? The objects are destroyed in the reverse order of their creation. |
82.
A virtual destructor ensures that the objects resources are released in the reverse order of the object being constructed w.r.t inherited object.
83.
Can we nest multi line comments in a C++ code? No, we cannot. |
84.
It will be used to undefine an existing macro definition.
85.
No, it contains invalid octal digits.
86.
goto.
87.
Declaration associates type to the variable whereas definition gives the value to the variable.
88.
The parameters sent to the function at calling end are called as actual parameters while at the receiving of the function definition called as formal parameters.
89.
S++, as it is single machine instruction (INC) internally.
90.
If a header file is included with in < > then the compiler searches for the particular header file only with in the built in include path. If a header file is included with in “ “, then the compiler searches for the particular header file first in the current working directory, if not found then in the built in include path
91.
If a pointer declared for a class, which operator can be used to access its class members? Arrow (->) operator can be used for the same |
92.
What is the use of the keyword ‘using’? It is used to specify the namespace being used in. |
93.
cin is the object of istream class. The stream ‘cin’ is by default connected to console input device.
94.
What is ‘cout’? cout is the object of ostream class. The stream ‘cout’ is by default connected to console output device. |
95.
Standard template library
96.
Default namespace defined by C++.
97.
We can create an empty class and the object size will be 1.
98.
No, only the class member variables determines the size of the respective class object.
99.
seekg()
interviewquiz.net
No comments:
Post a Comment