Professional Documents
Culture Documents
Java Mcqs PDF
Java Mcqs PDF
3) A variable is a
a) name that represents a value
b) reference to the memory location that holds a value
c) both a) and b)
d) none of the above
Answer: c
3) Code can be better organized if the programmer defines an appropriate set of methods.
Answer: True
5) A variable can be used anywhere in the program, even before the declaration.
Answer: False
7) Expressions can be used for calculations and use the current values of variables.
Answer: True
8) The random number generation program can only produce numbers within the range 0 to 1.
Answer: False
4) Each variable must have a _____ that is a reference to its memory location.
Answer: name
5) ________ and ______ _____ are two types of numeric data that a variable can hold.
Answer: integer, floating point
10) Current values of variables can be used in a __________ _________ to calculate the value
of another variable
Answer: mathematical expression
11) Methods used for object manipulation are either _______ or _________.
Answer: built-in, custom
12) The random number function generates numbers within the ____ , and it is controlled by
some parameters accepted by that function.
Answer: range
13) To make an object behave differently over time, the programmer needs to make some
parameter _______.
Answer: random
14) Writing methods based on the parameters’ values passed to them makes them more _____.
Answer: useful
15) For every parameter added to a method, _____ and _____ need to be specified.
Answer: name, type