Ch. 5- Data Types, Variables and Arithmetic #1-6

Ace your homework & exams now with Quizwiz!

Which of the following statements prints a backslash?

B

Which variables in a class have global scope access?

B

The scope of a variable is determined when the program is ___________? (compiled, executed)

Compiled

If a local variable in a method and a field have the same name, the compiler reports a syntax error T or F?

False; Java allowed the usage of local variables in both methods and fields, but this creates bugs that may be hard to find.

The scope of the variable is the largest range of its values T or F?

False; The scope of a variable is defined only within a certain space.

k is always a stylistically bad name for a variable because it is too short T or F?

False; single letters are predominantly used to represent variables.

Which of the following lines are synthetically valid declarations of fields? Of local variables?

Fields: a,b,c Local Variables: d,e,f

Name three good reasons for using symbolic constants as opposed to literal constants.

Make code more readable/ more self-explanatory, easier to change into a variable, and simplifies program maintenance

Each Variable must be explained on a separate line T or F?

True; A variable can only be declared once within the space where the where the variable is "visible"

Local variables in different methods of the same class are allowed to have the same name T or F?

True; As long as they aren't within the same scope.


Related study sets

Chapter 8: Body Mechanics and Patient Mobility

View Set

Exam Fx Mock License Exam (Texas)

View Set

CFA L3 2020 - Study Session 15.3 (Reading 36): Investment Manager Selection

View Set

Chapter 5: The Integumentary System Study Questions

View Set

Chapter 15 - Businessowners Coverage Form

View Set

Language arts 8A- Words and how to use them~ STANDARD AND NONSTANDARD USAGE!!

View Set

Chapter 12 (Pre-quiz) : Lymphatic system

View Set