Recall & Review
beginner
What is the purpose of the
main function in a C++ program?The
main function is the starting point of a C++ program. When you run the program, the computer begins executing code from main.Click to reveal answer
beginner
What does the return value of
main represent?The return value of
main tells the operating system if the program ended successfully. Returning 0 usually means success, while other values can indicate errors.Click to reveal answer
intermediate
Which signature is the most common for the
main function?The most common signature is
int main() or int main(int argc, char* argv[]). The first has no parameters; the second can receive command-line arguments.Click to reveal answer
intermediate
What happens if you omit the
return statement in main?In modern C++, if you omit
return in main, the compiler assumes return 0; automatically, meaning successful program end.Click to reveal answer
beginner
Why is the
main function special compared to other functions?Because the operating system looks for
main to start running your program. Other functions are called from main or each other, but main is the entry point.Click to reveal answer
What is the return type of the
main function in C++?✗ Incorrect
The
main function must return an int to indicate the program's exit status.What does
return 0; in main usually mean?✗ Incorrect
return 0; signals to the operating system that the program finished without errors.Which of these is a valid
main function signature?✗ Incorrect
Only
int main() or int main(int, char*[]) are standard and valid.What happens if you omit
return in main in modern C++?✗ Incorrect
Modern C++ automatically adds
return 0; at the end of main if missing.What is the role of the
main function?✗ Incorrect
main is where the program starts running.Explain the role of the
main function in a C++ program and what its return value means.Think about what happens when you run a program.
You got /4 concepts.
Describe the common signatures of the
main function and why you might use parameters in it.Consider how programs can get input when they start.
You got /3 concepts.