C++ is a successful and most widely used Object Oriented Programming language. It is an extension of C language that not only adds Object Oriented concepts but also readdress some of the weaknesses of C language. The Object Oriented features in C++ helps the programmer to build large and complex programs with greater efficiency, extensibility and ease of maintenance. It allows a programmer to follow a structured and disciplined approach for making complex computer programs.
Index:
- [#1] – Introduction to C++ – Questions
- [#2] – Preparing and Running C++ Program – Questions
- [#3] – C++ Fundamentals – Questions
- [#4] – Data Input and Output – Questions
- [#5] – Control Structures – Questions
- [#6] – Functions – Questions
- [#7] – Arrays and Strings – Questions
- [#8] – Structures and Unions – Questions
- [#9] – Pointers – Questions
- [#10] – Object and Classes – Questions
- [#11] – Constructors and Destructors – Questions
- [#12] – Operator Overloading and Type Conversion – Questions
- [#13] – Inheritance – Questions
- [#14] – Virtual Functions – Questions
- [#15] – C++ Streams and Files – Questions
- [#16] – Templates – Questions
- [#17] – Exception Handling – Questions
C++ is a strongly typed language developed by Bjarne Stroustrup in 1983 at Bell Laboratories. C++ is a hybrid language as it is possible to write programs in C++ in either C language style, Object Oriented style or both.
It can be used for developing any kind of applications like interactive computer graphics, expert systems, simulation, databases, artificial intelligence, system program application and for making compilers.
Key Points To Remember –
- C++ is a universal language. It can be used to write programs for MS- Window, Linux, Macintosh, Unix system etc.
- The basic structure of C++ program contains documentation section, Preprocessor Directive Section. Global Declaration Section, Class Section, Main Program Section, Subprogram section.
- Preprocessor is a part of a computer which is used to replace each # include directive with the contents of the specified file. It also processes macro definitions.
- Turbo C++ compiler contains the directories such as BIN, INCLUDE, BGI, LIB, CLASSLIB, DOC etc.
- The following steps are used to write and executing the C++ program.
- Invoke the Turbo C++ editor by executing TC.EXE file in the TCC/BIN directory.
- Write the Program and save it by pressing F2.
- After saving the program compile it by pressing Alt+F9 or Alt+C and then selecting compile option from it.
- Then execute or run the program by pressing Ctrl+X.
- To exit from Turbo C++ IDE press Alt+X.
- Errors are illegal operations performed by the user. Syntax Errors, Run time errors and logical errors are some common type of errors.
- The process of correcting errors is known as debugging. The Trace Into (F7) and Step Over (F8) are two common techniques used for debugging.
- All the C++ programs begin their execution from main. As such function returns a value, similarly main also returns an integer value that indicate whether the program is executed successfully or not. A value O indicates successful execution while a non zero value indicates that an error occurred during the execution of the program. The value from the main function is returning using the following statement:
return 0;// it returns a value o
Viva Voce Questions –
Here are commonly asked questions with answers:
- Why every program begins with main function ?
- It is because this is from where the computer knows that program execution actually starts.
- Why is the message function should return a value generated when the () is compiled ?
- When you do not specify the return type void of the main() function.
OR - When you don’t give return 0, statement in the body of main() in case int return type.
- When you do not specify the return type void of the main() function.
- Is converting a source file into executable file a two step process ?
- Yes, firstly the program is compiled to an object file with .obj extension and then linking is performed which generates an executable (.exe) file. Linking combines more than one object files into a single executable file.
- What is the user screen area ?
- The default user screen area is
Rows=80 and Columns=25
- The default user screen area is
- What is the difference between Turbo C++ and Borland C++ compilers ?
- Both Turbo C++ and Borland C++ work in the same way except that some additional features such as TD (a debugger), Turbo Assembler (TASM), a profiler (TROF), a profiler (TROF) are supported by Borland C++.
- What are the different type of file extensions associated during the creation a C++ program ?
- .cpp – When the source file is saved E.g. sum.cpp
- .obj – When the source program is compiled. E.g. sum.obj
- .exe – When we run the program. E.g. sum.exe
- .bak – When the already existing source file is modified and saved. E.g. sum.bak
- Name any five C++ compilers ?
- Turbo C++, Borland C++, C front, GNU C++, Zortech C++ (ZTC++)
- .What does a header file contains ?
- A header file contains the declarations of all the related functions whose definitions are stored in its library file. E.g. iostream.h contains declarations of all console Input/Output operations of C++.
Other Similar Questions –
- Discuss the characteristics of C++ language .
- Explain the structure of C++ program ?
- What is comment ? What are different types of comments ?
- What is preprocessor ? What are different types of comments ?
- What are the general rules for defining preprocessors ?
- What is difference between #include and #define directives ?
- Explain the significance of main() ?
- What are the different ways by which you can open C++ compiler ?
- How will you compile and run a program in C++ ?
- How can you make multiple copies of a program made in C++ Editor ?
- Explain the steps required to run a program in C++ ?
- What is an error ? What are different types of errors ?
- What is a difference between Trace into and Step over options of debugging ?
- What is the difference between breakpoint and tracing ?
- What is the difference between linker error and logical errors ?
- How will you change the output directory ?
- What is difference between error and warning ?
- Top 30 Linux Questions (MCQs) with Answers and Explanations
- 75 Important Cybersecurity Questions (MCQs with Answers)
- 260 One-Liner Information Security Questions and Answers for Fast Learning
- Top 20 HTML5 Interview Questions with Answers
- 80 Most Important Network Fundamentals Questions With Answers
- 100 Most Important SOC Analyst Interview Questions
- Top 40 Cyber Security Questions and Answers
- Top 10 React JS Interview Theory Questions and Answers
- CISSP – Practice Test Questions – 2024 – Set 20 (53 Questions)
- Part 2: Exploring Deeper into CCNA – Wireless (145 Practice Test Questions)