Question: QUESTION 1 If the array myArray is declared as int[ ][ ] myArray = {{2,3},{3,4},{4,5}} How many rows and columns does it have? a. 2
QUESTION 1
If the array myArray is declared as int[ ][ ] myArray = {{2,3},{3,4},{4,5}} How many rows and columns does it have?
| a. | 2 rows, 3 columns | |
| b. | 3 rows, 2 columns | |
| c. | 1 row, 3 columns | |
| d. | 3 rows, 1 column |
QUESTION 2
If the array myArray is declared as
int[][] myArray = {{2,3},{3,4},{4,5}}
What is the value of myArray[1][1]?
a.2
b.5
c.3
d.4
QUESTION 3
If the array myArray is declared as
int[][] myArray = {{2,3,4,5},{3,4,5,6},{4,5,6,7}}
What is the value of myArray.length?
QUESTION 5
If the array myArray is declared as
int[][] myArray = {{2,3},{3,4,5,6},{4,5,6}}
What is the value of
myArray[1].length
QUESTION 7
Consider the following segment of Java code. What will be the output?
String cat = "Cat";
System.out.println(cat.charAt(1));
changeCat(cat);
System.out.println(cat.charAt(1));
-----------------------------------
public static void changeCat(String dog) {
dog = "Cut";
}
a.Cat
Dog
b.u
a
c.a
u
d.a
a
QUESTION 8
Assertions are used during --?-- and exceptions are used during --?--.
a.running of the program; compilation of the program
b.compilation of the program; running of the program
c.program execution for users; program development
d.program development; program execution for users
QUESTION 9
Suppose in the following program segment, x is supposed to be less than 5. Which of the following is the correct code for
if (! x<5)
a.assert (x<5):"x must be < 5";
b,throw new IllegalArgumentException("x must be < 5");
c.throw an IllegalArgumentException("x must be < 5");
d.x = new IllegalArgumentException("x must be < 5");
QUESTION 10
Exceptions in Java are
a.Objects
b.Primitives
c.Never encountered by the programmer.
d.Applications
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
