The correct answer is option (4)
6
Explanation:
Here i = 2
and the for loop will continue until i<=2.
When i = 1
For loop will goes to 14 (because initial value of j is 28 and it goes to j/2)
in the next iteration it will be 7
and then last iteration will check for the i<=2 condition. This makes the evaluation to 6.
-------------------------------------------------------
PLEASE UPVOTE.
Question 68 (Mandatory) (1 point) When the Java source code below is executed, how many times...
When the Java source code below is executed, how many times is the boolean expression (j > 0) evaluated? int i 1; do { int j 35; while (j > 0) { j = j / 2; = } i += 1; } while (i <= 3); 18 none of the other answers are correct 0 6 36
Question 14 (Mandatory) (1 point) Immediately after all of the following Java source code is executed, how many bytes of memory are used to store the all of the integer values in y? int[] [] y = new int[3] []; y[0] new int [2]; y[1] new int[1]; y[2] = new int[2]; none of the other answers are correct 12 64 20 00
Question 62 (Mandatory) (1 point) Immediately after all of the following Java source code is executed, how many bits of memory are used to store all of the integer values in y? int[][] y = new int[2][2]; 00 none of the other answers are correct 20 16 64
What is printed when the following code is executed? #include <stdio.h> int main() { for (int i=3, j=5; i>=0; i-=2, j+=j*i) { printf("%d", j); منم }
14.3 How many times is the statement cout<<]<<","<</<<","; executed in the following program? int I, ); for (I = 2; I >= 0; I--) { for (] = 1; }<2; J++) cout << ) << ", << I << cout << endl; 11 } Select one O 2.3 0 6.6 O c. 2 d. None of the above are correct
In the code given below, how many times the cout statement is executed? for (int x = 0; x< 10; x++) for (int y=0; y < 10; y++) for (int z = 0; z <=10; z++) cout << X+y+z;
Java code efficiency: Look at the implementation of the method called intervalSums below. Design and implement a more efficient runtime algorithm for intervalSums. public static long intervalSums(intll A, intl0 B) long count = 0; for (int i = 0; i < A.|ength; i++) { for (int j = i; j < A.length; j++) { int sum = 0; for (int k = i; k <= j; k++) { sum += A[k]; count += 1; B[i][j] = sum; if (j >...
java by the way
What is the value of the variable y after the following code is executed? int x = 10; int y = 0; while (x > 0) { x = x / 2; y++; } 4 3 2 1
Uses Java
In this lab, you will practice using a stack as a substitute for recursion. Your task is to implement a non-recursive stack-based version of the following method: public void drawGasket(int x, int y, int side) t int sub -side / 3; //Draw center square g2d.fill (new Rectangle2D. Double(x + sub, y + sub, sub - 1, sub - 1)); if (sub >= 3) { //Draw 8 surrounding squares for (int i = 0; i < 3; i++){ for...
Compute the Big O notation. Explain how you got the answer.
on W NA 1 public String modify (String str) { if (str.length() <= 1) return ""; int half = str.length() / 2; modify(str.substring(half)); 5} 1 2 3 for (int i = 0; i<n; i++) { for (int j 0; j < 5; j++) { for (int k = 0; k<n; k++) { 4 if ((i != j) && (i != k)) { 5 System.out.println(k); 6 } 7 } 8...