Question
What is the index variable for the element at the first row and first column in array a? a[0][1] a[1][0] a[1][1] a[0][0] Question 2 1
-
What is the index variable for the element at the first row and first column in array a?
-
a[0][1]
-
a[1][0]
-
a[1][1]
-
a[0][0]
-
- Question 2
1 Point
When assigning a literal to a variable of the byte type, if the literal is too large to be stored as a byte value, it _____________.
-
causes underflow
-
causes compile error
-
causes overflow
-
no error
-
- Question 3
1 Point
To declare a constant MAX_LENGTH inside a method with value 99.98, you write
-
final float MAX_LENGTH = 99.98;
-
final MAX_LENGTH = 99.98;
-
double MAX_LENGTH = 99.98;
-
final double MAX_LENGTH = 99.98;
-
- Question 4
1 Point
-25 % 5 is ______?
-
5
-
0
-
4
-
1
-
- Question 5
1 Point
The __________ method returns a raised to the power of b.
-
Math.pow(a, b)
-
Math.pow(b, a)
-
Math.exponent(a, b)
-
Math.power(a, b)
-
- Question 6
1 Point
Suppose a Scanner object is created as follows:
Scanner input = new Scanner(System.in);
What method do you use to read a real number?
-
input.double();
-
input.nextdouble();
-
input.Double();
-
input.nextDouble();
-
- Question 7
1 Point
When you invoke a method with a parameter, the value of the argument is passed to the parameter. This is referred to as _________.
-
method invocation
-
pass by value
-
pass by reference
-
pass by name
-
- Question 8
1 Point
A Java character is stored in __________
-
two bytes
-
four bytes
-
one byte
-
three bytes
-
- Question 9
1 Point
How many elements are array matrix (int[][] matrix = new int[5][5])?
-
14
-
10
-
20
-
25
-
- Question 10
1 Point
What is y displayed in the following code?
public class Test {
public static void main(String[] args) {
int x = 1;
int y = x++ + x;
System.out.println("y is " + y);
}
}
-
y is 1
-
y is 4
-
y is 3
-
y is 2
-
- Question 11
1 Point
The signature of a method consists of ____________.
-
parameter list
-
method name
-
return type, method name, and parameter list
-
method name and parameter list
-
- Question 12
1 Point
What will be displayed when the following code is executed?
int number = 6;
while (number > 0) {
number -= 3;
System.out.print(number + " ");
}
-
3 0
-
3 0 -3
-
6 3
-
6 3 0
-
- Question 13
1 Point
How many times will the following code print "Welcome to Java"?
int count = 0;
while (count < 10) {
System.out.println("Welcome to Java");
count++;
}
-
11
-
10
-
0
-
9
-
- Question 14
1 Point
Each time a method is invoked, the system stores parameters and local variables in an area of memory, known as _______, which stores elements in last-in first-out fashion.
-
an array
-
a heap
-
a stack
-
storage area
-
- Question 15
1 Point
"abc".compareTo("aba") returns ___________.
-
2
-
-1
-
1
-
-1
-
- Question 16
1 Point
Suppose x is 1. What is x after x += 2?
-
3
-
2
-
4
-
1
-
- Question 17
1 Point
Assume x = 4, which of the following is true?
-
x != 5
-
x == 5
-
!(x == 4)
-
x != 4
-
- Question 18
1 Point
Which of the following is the correct statement to return JAVA?
-
"Java".toUpperCase("Java")
-
String.toUpperCase("Java")
-
toUpperCase("Java")
-
"Java".toUpperCase()
-
- Question 19
1 Point
The expression "Java " + 1 + 2 + 3 evaluates to ________.
-
Java6
-
illegal expression
-
Java123
-
Java 123
-
- Question 20
1 Point
What is the exact output of the following code?
double area = 3.5;
System.out.print("area");
System.out.print(area);
-
3.53.5
-
area 3.5
-
area3.5
-
3.5 3.5
-
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