Question: Question 15 (1.5 points) Given the code: public class Test1 { private int method1(int x, int y) { return x + y; } private int
Question 15 (1.5 points)
Given the code:
public class Test1 { private int method1(int x, int y) { return x + y; }
private int method2(int x, int y) { if (x > y) return x; else return y; }
public static void main(String[] args) { Test1 test1 = new Test1(); System.out.println(test1.method1(test1.method2(3, 5), 10)); } }
What is the output?
Question 15 options:
| 13 | |
| 10 | |
| 15 | |
| 8 |
Question 16 (1.5 points)
Assume that your main method called method A and B, method A called method C and method B called method D. What happens right after method D returns?
Question 16 options:
| The control returns to method B | |
| The control returns to main method | |
| The program ends | |
| The control returns to method A |
Question 17 (1.5 points)
What is the value of the expression:
(int) (7.5 / 3) + 2.0
Question 17 options:
| 4.5 | |
| 4 | |
| 4.0 | |
| 5.5 |
Question 18 (1.5 points)
The correct expression to check if an index i is an valid index for an array array1?
Question 18 options:
| array1.length > i && i >= 0 | |
| i <= array1.length - 1 && i >= 0 | |
| array1.length > i || i >= 0 | |
| array1.length() > i && i >= 0 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
