Question

In: Computer Science

Indicate which of the following are valid C++ variable names and which are not. If not,...

Indicate which of the following are valid C++ variable names and which are not. If not, state the reason the name is invalid.

Variable Name

Valid – Yes/No

If Invalid – Reason

income

2time

int

Tom's

two fold

c3po

income#1

item

Solutions

Expert Solution

Answer:

Variable Name

Valid – Yes/No

If Invalid – Reason

income

Yes

2time

No

Variable name should start with character or _

int

No

int is a reserved keyword to define an integer variables. So we should not use

Tom's

No

' character is no a valid escapte char for variable name. Only _ underscore allowed

two fold

No

Space should be there in variable name

c3po

Yes

income#1

No

Only _ allowed in variabe name

item

Yes


Related Solutions

Create program which verifies if input string is a valid variable declaration or not. Use C...
Create program which verifies if input string is a valid variable declaration or not. Use C programming language. - This program can only use the following variable types: char, float, and int - Remove any newline \n from input string - The input prompt should say ">>> " - If input declaration is valid, it should print "Valid dec\n" - If input declaration is invalid, it should print "Invalid dec\n" - Make sure the identifier entered matches the rules of...
Which of the following is a valid C statement? Explain what each valid statement does. For invalid statements, explain the problem.
  Which of the following is a valid C statement? Explain what each valid statement does. For invalid statements, explain the problem.  a. int items [5];  b. int items [];  c. int items = {3, 7,2 };  d. int items [] = {3, 7, 2};  e. int items [3] = {3, 7,2};  
Which following statement(s) about SAS names is/are correct? Check all that apply. A. A SAS variable...
Which following statement(s) about SAS names is/are correct? Check all that apply. A. A SAS variable name starts with a letter or an underscore and continues with any combination of numbers, letters, or underscores as the same as library reference names and data set names. B. A SAS library references name must be 8 characters or less and begin with a letter or an underscore. C. A SAS data set names are 1 to 32 characters in length and are...
Write the procedure for using Stipites Laminaria drug. Indicate the species names from which drug was...
Write the procedure for using Stipites Laminaria drug. Indicate the species names from which drug was obtained.
For a reaction to be endothermic, which of the following relationships is valid? For a reaction...
For a reaction to be endothermic, which of the following relationships is valid? For a reaction to be endothermic, which of the following relationships is valid?   The energy required to break bonds is greater than the energy involved in bond formation.   The energy required to break bonds is less than the energy involved in bond formation.   The energy required to break bonds is the same as the energy involved in bond formation.   The number of bonds...
Which of the following statements is true? a. It is possible that the APT is valid...
Which of the following statements is true? a. It is possible that the APT is valid and the CAPM is not. True False b. It is possible that the CAPM is valid and the APT is not. True False
Suppose the economy is in a recession. Which of the following is a valid argument for...
Suppose the economy is in a recession. Which of the following is a valid argument for using expansionary fiscal policy, instead of monetary policy? Select one: a. Fiscal policy is more effective than monetary policy in a deep recession b. Fiscal policy is slower than monetary policy c. Fiscal policymakers are subject to more political influence, so some of their spending tends to be wasteful. d. Government spending could lead to lower growth through the crowding-out effect
1.Which of the following is not a requirement of a valid contract in the context of...
1.Which of the following is not a requirement of a valid contract in the context of revenue recognition? a. In writing b. Commercial substance c. Terms for payments d. Enforceable rights and obligations 2.Which of the following does not identify a good or service as "distinct"? a. The customer can benefit from the good or service on its own. b. The entity regularly sells the good or service separately. c. The customer can benefit from the good or service together...
A) Which of the following sets of quantum numbers are valid (enter V) and which are...
A) Which of the following sets of quantum numbers are valid (enter V) and which are invalid for the known elements? n = 2, l = 3, ml = 0, ms = +½ : B) write the corresponding orbital notation for n = 6, l = 0?
THIS IS A PYTHON ASSIGNMENT 1. The following are invalid variable names: 3g, 87 and 2h....
THIS IS A PYTHON ASSIGNMENT 1. The following are invalid variable names: 3g, 87 and 2h. 2. The operator != is an example of a relational operator. 3. A variable name identifies the kind of information stored in the object. 4. Python treats the variable names, a1 and A1, as the same variable. 5. The if/else selection structure is a single-selection structure. 6 A fatal logic error causes a program to execute and produce incorrect results. 7) A repetition structure...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT