[#2] – Preparing and Running C++ Program – Questions


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.


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 –

  1. C++ is a universal language. It can be used to write programs for MS- Window, Linux, Macintosh, Unix system etc.
  2. The basic structure of C++ program contains documentation section, Preprocessor Directive Section. Global Declaration Section, Class Section, Main Program Section, Subprogram section.
  3. 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.
  4. Turbo C++ compiler contains the directories such as BIN, INCLUDE, BGI, LIB, CLASSLIB, DOC etc.
  5. 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.
  6. Errors are illegal operations performed by the user. Syntax Errors, Run time errors and logical errors are some common type of errors.
  7. The process of correcting errors is known as debugging. The Trace Into (F7) and Step Over (F8) are two common techniques used for debugging.
  8. 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:

  1. Why every program begins with main function ?
    • It is because this is from where the computer knows that program execution actually starts.
  2. 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.
    • When you don’t give return 0, statement in the body of main() in case int return type.
  3. 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.
  4. What is the user screen area ?
    • The default user screen area is
      Rows=80 and Columns=25
  5. 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++.
  6. 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
  7. Name any five C++ compilers ?
    • Turbo C++, Borland C++, C front, GNU C++, Zortech C++ (ZTC++)
  8. .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 – 

    1. Discuss the characteristics of C++ language .
    2. Explain the structure of C++ program ?
    3. What is comment ? What are different types of comments ?
    4. What is preprocessor ? What are different types of comments ?
    5. What are the general rules for defining preprocessors ?
    6. What is difference between #include and #define directives ?
    7. Explain the significance of main() ?
    8. What are the different ways by which you can open C++ compiler ?
    9. How will you compile and run a program in C++ ?
    10. How can you make multiple copies of a program made in C++ Editor ?
    11. Explain the steps required to run a program in C++ ?
    12. What is an error ? What are different types of errors ?
    13. What is a difference between Trace into and Step over options of debugging ?
    14. What is the difference between breakpoint and tracing ?
    15. What is the difference between linker error and logical errors ?
    16. How will you change the output directory ?
    17. What is difference between error and warning ?
    You may also like:

    Related Posts

    Leave a Reply