Question
Please help. Java questions. QUESTION 1 An array's size declarator can be a negative integer expression. True False QUESTION 2 When an array is passed
Please help. Java questions.
QUESTION 1
An array's size declarator can be a negative integer expression.
True
False
QUESTION 2
When an array is passed to a method, the method has access to the original array.
True
False
QUESTION 3
A constructor can return a value of type double.
True
False
QUESTION 4
Two arrays are parallel if they hold the same type of data.
True
False
QUESTION 5
Only a fixed number of elements can be stored in an ArrayList?
True
False
QUESTION 6
Every component of an ArrayList object is a reference.
True
False
QUESTION 7
A class and its members can be described graphically using Unified Modeling Language (UML) notation.
True
False
QUESTION 8
When a return statement executes in a user-defined method, the method immediately exits.
True
False
QUESTION 9
The instance variable length is a public member of an array object and can be directly accessed using the dot operator (eg. scores.length ).
double[] scores = new double[7];
True
False
QUESTION 10
In Java, void methods return a value of type String.
True
False
QUESTION 11
A method can be defined within the body of another method. This is known as nesting methods.
True
False
QUESTION 12
The private variables of a class are accessible in any method of that class.
True
False
QUESTION 13
If a Java method does not use parameters, parentheses around the empty parameter list are still needed.
True
False
QUESTION 14
Parameters allow you to use different values each time the method is called.
True
False
QUESTION 15
In a Java class, the name of a constructor can be anything but the same as the name of the class.
True
False
QUESTION 16
A local variable is an variable that is declared within a method and that is visible only within that method.
True
False
QUESTION 17
Arrays can be initialized when they are created.
True
False
QUESTION 18
Arrays cannot be passed as parameters into methods, but their elements can be passed individually.
True
False
QUESTION 19
The Java operator new is needed to instantiate an object (i.e. create an instance of a Java class).
True
False
QUESTION 20
An exception is thrown when an array index goes out of bounds.
True
False
QUESTION 21
The class ArrayList is contained in the package java.util.
True
False
QUESTION 22
An array index can be any expression that evaluates to a non-negative integer. The value of the index must always be less than the size of the array.
True
False
QUESTION 23
In Java, [ ] is an operator, called the array subscripting operator.
True
False
QUESTION 24
To access an element of a two-dimensional array, you need a pair of indices: one for the row position, and one for the column position.
True
False
QUESTION 25
If an array index is less than zero, an InvalidIndexException exception is thrown.
True
False
QUESTION 26
You cannot override the default definition of the method toString because it is provided by Java Object class.
True
False
QUESTION 27
In a method call statement, when passing an array as an actual parameter, you use only its name.
True
False
QUESTION 28
To determine whether two reference variables of the Integer type point to the same Integer object, we can use either the method equals of the class Integer or the operator ==.
True
False
QUESTION 29
This is automatically provided for a java class if you do not write one yourself.
accessor method | ||
default instance | ||
default constructor | ||
variable declaration |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started