6 Questions
What is the output of the following C++ code?
20
In C++, what is the purpose of the 'void' keyword in a function declaration?
To specify that the function doesn't return a value
Which of the following is not a valid C++ identifier?
2ndValue
Which of the following best describes the 'void' keyword in a C++ function declaration?
It indicates that the function does not return any value
Which of the following is a valid C++ identifier?
_myVariable
What does the 'const' keyword signify when used in a C++ function declaration?
The function cannot modify any of its parameters
Study Notes
C++ Basics
- The 'void' keyword in a C++ function declaration indicates that the function does not return any value.
- The purpose of the 'void' keyword is to specify that the function does not return any value.
- The 'void' keyword does not indicate the absence of parameters, but rather the absence of a return value.
Valid C++ Identifiers
- A valid C++ identifier is a name given to a variable, function, or label.
- C++ identifiers must start with a letter (a-z or A-Z) or an underscore (_).
- C++ identifiers cannot start with a digit (0-9).
'const' Keyword
- When used in a C++ function declaration, the 'const' keyword signifies that the function does not modify the object it is called on.
- The 'const' keyword is used to specify that a function is a "read-only" function, meaning it does not modify the state of the object.
Test your knowledge of C++ function output, the purpose of the 'void' keyword in a function declaration, and valid C++ identifiers.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free