Mastering C++: A Comprehensive Quiz Based on 'Thinking in C++'

Disable ads (and more) with a membership for a one time $2.99 payment

Study for the C++ exam based on 'Thinking in C++'. Engage with challenging quiz questions designed to boost your understanding and proficiency in C++. Get prepared to master C++ programming concepts through an interactive and informative quiz experience!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What command is used to compile 'hello.cpp' using a macro?

  1. $(CPP) hello.cpp

  2. compile hello.cpp

  3. CPP -o hello.exe hello.cpp

  4. make hello.cpp

The correct answer is: $(CPP) hello.cpp

This answer is incorrect because the command '$(CPP)' is a shell macro and not a compiler macro. It will not compile the given C++ file. Option B, 'compile hello.cpp', is not a valid command and will not be recognized by the compiler. Option C, 'CPP -o hello.exe hello.cpp', will not work because 'CPP' is not a valid compiler command. Option D, 'make hello.cpp', will not work because 'make' is used to create executable files from multiple source files, not just one like in this case. Therefore, option A, '$(CPP) hello.cpp', is the correct command for compiling 'hello.cpp' using a macro.