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

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

Test your C++ skills with our quiz based on Bruce Eckel's 'Thinking in C++'. Dive into object-oriented programming, advanced topics, and fundamentals. Perfect for learners and experts alike. Assess your knowledge and become a C++ master!

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.


Which of the following is NOT a valid reason for a linker error in C++ due to function misdeclaration?

  1. Mismatch in argument types

  2. Mismatch in the number of arguments

  3. Mismatch in return type only

  4. Function not defined

The correct answer is: Mismatch in return type only

A linker error occurs when the code of a program is executed, not when the code is compiled. This means that it occurs when the program attempts to combine different parts of the code to create a single, executable file. A function misdeclaration can cause linker errors if the declaration of the function does not match its definition, such as a mismatch in argument types or the number of arguments. However, a mismatch in return type only is not a valid reason for a linker error because it does not affect the process of combining the code. Options A, B, and D are all valid reasons for linker errors, while option C is not.