Question: Where are variables declared in a C++ program?
Instructor answer: Variables can be declared anywhere in a program. They can be declared inside a function (local variables) or outside the functions (global variables)

Student answer: They can be declared right before they are used, but it is a good practice to declare them at the beginning of the program and label what they are food.
Score (0-5): 2

Student answer: In the Function main() before using the variable.
Score (0-5): 3

Student answer: Local variables are declared inside the method or function they will be used in at the beginning of the method. Global variables are declared outside of any function or method, generally before functions are defined.
Score (0-5): 5

Student answer: Variables are declared where ever it is defined either inside a block locally or outside a block globally.
Score (0-5): 4.5

Student answer: Variables are declared before they are actually used. They can be declared before main() to use globally
Score (0-5): 4

Student answer: For good programing practice they should be declared before main(), but should at least be declared before they are used.
Score (0-5): 2.5

Student answer: They can be declared globally just before the main method (but also outside of it)... or variables can be subject to only the method they're scoped within, but would still be declared at the beginning of that method (but inside of it).
Score (0-5): 5

Student answer: local variables are declared inside the method while global variables are declared in the body.
Score (0-5): 5

Student answer: -Any where in the main function.
Score (0-5): 2

Student answer: Globally for an entire program, and locally for individual functions (including FOR statements)
Score (0-5): 4.5

Student answer: They are usually declared at the beginning before they can be used in the program. They always contain a name and a data type.<br>
Score (0-5): 3

Student answer: Inside the method.
Score (0-5): 2.5

Student answer: at the top
Score (0-5): 1.5

Student answer: Global variables are declared in the body of the code. Local variables are declared in the function they are to be used (unless the function is being passed a variable). Variables should always be declared before use.
Score (0-5): 5

Student answer: Variables are usually declared at the beginning of a module of C++ code.
Score (0-5): 2.5

Student answer: In the main function, usually at the top of code.<br><br>They can be declared almost anywhere, but must be declared before the code can use or act upon them.
Score (0-5): 3.5

Student answer: in the very beginning of the program. Before the main() starts.
Score (0-5): 2

Student answer: In the declaration of Functions, for statements, and while statements.<br>in the body of If, For, while, do while, statements, in namespaces, headers, etc  ( almost anywhere. )<br>anywhere in the program, as long as it is on it's own line.
Score (0-5): 2.5

Student answer: After declaration of the variable's data type.
Score (0-5): 1

Student answer: anywhere in the code, can be at the top, or in the middle of the code, or anywhere.
Score (0-5): 3

Student answer: Before they are used.
Score (0-5): 2

Student answer: Anywhere in the same scope before they are used
Score (0-5): 3.5

Student answer: variables can be declared in classes and methods.
Score (0-5): 2.5

Student answer: inside the function scope and outside of the function scope in case of global variables
Score (0-5): 5

Student answer: global variables are declared in the main function<br>local variables are declared in any other function
Score (0-5): 4

Student answer: Variables are usually declared at the very beginning of a C++ program, but can be declared any in the program as long as they appear before they are called upon.
Score (0-5): 4

Student answer: Variables are declared in the main function, before any operation is <br><br>attempted with the variables.
Score (0-5): 2

Student answer: anywhere, but where you declare them depends on where you want them to be accessible (their scope)
Score (0-5): 4.5

Student answer: It depends if it’s a global then they have to be declared out side the source code to be used in every scope however a local variable is one declared in a local function etc. which obviously doesn’t need to be declared outside the variable seeing how it is used for the function or block its being called for.
Score (0-5): 4.5