Valid Assignments v1AnswerKey

Valid Assignments v1AnswerKey - Invalid 9. 6.91 = yourRate;...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Valid Assignments If myAge is an integer variable , yourRate is a float variable , and departmentCode is a string variable , which of the following statements are valid assignments? If a statement is not valid, explain why not. 1. myAge = 23; Valid 2. myAge = yourRate; Invalid, because yourRate is of float data type 3. myAge = departmentCode; Invalid 4. myAge = “departmentCode”; Invalid 5. 42 = myAge; Invalid, because the assignment statement is wrong 6. yourRate = 3.5; Valid 7. yourRate = myAge; Invalid 8. yourRate = departmentCode;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Invalid 9. 6.91 = yourRate; Invalid, because the assignment statement is wrong 10. departmentCode = Personnel; Invalid 11. departmentCode = Personnel; Valid 12. departmentCode = 413; Invalid 13. departmentCode = 413; Valid 14. departmentCode = myAge; Invalid 15. departmentCode = yourRate; Invalid 16. 413 = departmentCode; Invalid, because the assignment statement is wrong 17. 413 = departmentCode; Invalid, because the assignment statement is wrong...
View Full Document

Ask a homework question - tutors are online