
Java MCQs - Variables
Variable is the name of reserved location in memory which is used in programming language. In this list of mcqs you will cover all possible mcqs for Java variables
1. Where to declare local variables ?
A. It declares inside the class and outside of method.
B. It declares inside the class with static prefix and outside of method.
C. It declares inside the method.
View Answer
2. Where to declare instance variables ?
A. It declares inside the class and outside of method.
B. It declares inside the class with static prefix and outside of method.
C. It declares inside the method.
View Answer
3. Where to declare class variables ?
A. It declares inside the class and outside of method.
B. It declares inside the class with static prefix and outside of method.
C. It declares inside the method.
View Answer
4. Which of following can not be used as variable name in Java programming language ?
A. literal
B. Keywords
C. Identifier
D. Identifier and Keywords
View Answer
5. A name of variable is known as
A. Data Type
B. Constant
C. Identifier
View Answer
6. Which is the invalid variable name ?
A. tenthTeam
B. TenthTeam
C. 10thTeam
D. None of Above
View Answer
7. A variable name should not begin with
A. A number
B. Special characters but underscore and dollar sign
C. All of above
View Answer
8. Which is the valid variable name ?
A. 5thTeam
B. &5thteam
C. _5thTeam
D. None of Above
View Answer
9. Which are the invalid variable names ?
A. 1stLevel
B. first Level
C. *firstLevel
D. All of Above
View Answer
10. Which are the valid variable names ?
A. $1stLevel
B. _1stLevel
C. £1stLevel
D. All of Above
View Answer