Top C-plus-plus Interview Questions

Mobiprep handbooks are free downloadable placement preparation resources that can help you ace any company placement process. We have curated a list of the 40 most important MCQ questions which are asked in most companies such as Infosys, TCS, Wipro, Accenture, etc. The placement handbooks also have detailed explanations for every question ensuring you revise all the questions with detailed answers and explanations.




What is the diffrence between C and C++?

1. C, being a procedural programming, it is a function driven language. While, C++, being an object oriented programming, it is an object driven language.
2. C does not support function and operator overloading. While, C++ supports both function and operator overloading.

3. C does not support reference variables. C++ supports reference variables
4. C provides malloc() and calloc() functions for dynamic memory allocation, and free() for memory de-allocation. C++ provides new operator for
memory allocation and free operator for memory de-allocation.
5. C programs use top-down approach. While, C++ programs use bottom-up approach.
6. C has no support for virtual and friend functions. C++ supports virtual and friend functions.




Write some applications of C++

1. Internet browser Firefox is written in C++ programming language.
2. Some of the Google app. such as Google file system, Google Chromium are developed using C++.
3. C++ is used for design database like MySQL.
4. To Develop Graphical application like computer and mobile games.
5.To evaluate any kind of mathematical equation one can use C++ language.
6. C++ Language are also used to design OS. Like window xp.
7. Few parts of apple OS X are written in C++ programming language.




What do you mean by tokens in C++? Give examples

Tokens are the basic buildings blocks in language which are constructed together to write a program. Each and every smallest individual units in a program are known as tokens.

C++ tokens are of six types:
1. Keywords (int, while)
2. Identifiers (main, total),
3. Constants (10, 20),
4. Strings (“Rootworkz”, “hello”),
5. Special symbols ( (), {}),
6. Operators (+, /,-,*)




Write and explain structure of a C++ program.

General format of a C++ program:
Preprocessor commands
Globe declaration.
void main()

Preprocessor Commands:
These are the instructions which we want to give to our compiler (Its preprocessor). They indicate how the program is to be compiled. A preprocessor commands s tarts with the symbol #. Example #include, #define, #ifdef etc.

Global declaration:
In this section we can define variables, functions, Structures, classes etc. Variables define in this section are accessible anywhere within the program.

main() Function:
This is the entry point of our program. Execution of the program being with function main.