1. Which detects if x is in the range -4 to +4?
Answer: (x > -5) and (x < 5)
2. For the final else to execute, must be between 9 and 11 (both
excluded)
Answer: 10
3. y != 7 will be false because y is equal to 7
4.
numBoxes = 0;
numApples = 9;
if (numApples < 10) { // true
numBoxes = 2;
}
if (numApples < 20) { // true
numBoxes = numBoxes + 1;
}
Since both the if conditions are true, num boxes will be set to
2 in the first if block and will be increased by 1 in the second if
block.
Answer: 2 + 1 = 3
what are the answers Which detects if x is in the range -4 to +4? (x...
whats the answers What are the values of i for each iteration of: for (i = 0; i < 6; ++i) { } 1 2 3 4 5 O 012345 0 0 1 2 3 4 5 6 1 2 3 4 5 6 For the following code, indicate how many times the loop body will execute for the following input values: 2 1 0? userNum = 3; while (userNum > 0) { // Do something // Get user Num...
What will be the value of w after the following section of code executes: int w = 4, 9 = 3; if (a < 5) if (w == 7) W = 3; else W = 3; else if (w > 3) W = 2; else W = 1; Select one 2.3 0 b.o 0.2 d. 1
pic 4: Loops What is the output of the following code? int main0 ( int x = 1; while (x < 7) t İf ( (x % 2)-= 1)(1/ if x is odd x=x+1; else t x = x + 2; return 0; Select óne O a. 124 6 8 O b. 1 234 5 6 7 O c. 246 O d. 24 6 8 PREVIOUS PAGE NE
whats the answers Assuming that the variable numDogs has been declared, select the statement which doesn't contain any syntax errors. System.out.print("Amy // Michao1") System.print(numDogs); System.out.print(NumDogs) System.out.print(numDogs); Which of the following statements is a valid declaration of a constant integer variable named STEP_SIZE? int STEP SIZE = 5; final int STEP SIZE - 14: double STEP_SIZE = 5; final STEP_SIZE = 10; If the goal output is: Say "Hello" what needs to be written inside of the parenthesis in the print...
3. How many times "hello" is get printed? for(int x=-1; x<=10; x++) { if(x < 5) continue; cout<<"hello"<<endl; }* (3 Points) 5 times 11 times Infinite times 6 times
Explain ng on the particle as a function of x, for O <x < 7 meters?
question is from a java quiz Based on the following code, what is the value of y if x = 5? int x, y; if (x < 4) у 2; else if (x > 4) = { if (x > 7) y = 4; else y = 6; } else y = 8; 6 8 2 O 4
whats the answers For the following code, indicate how many times the loop body will execute for the following input values: 2 1 0? userNum - 3 while (userNum > 0) { // Do something // Get user um from input } 3 Given the following code, how many times will the inner loop body execute? int row: int col; for (row = 0; row < 2; row - row + 1) { for (col = 0; col < 3;...
5.[20] For the following joint pdf, find c, and find μΧ, Hy, Ох, and Oy. f(x,y)-(cxy for 0 < x < 3 and 0 < y <x)
Question 15 After the following code executes, what is the output if user enters 0? int x =-1; cout << "Enter O or 1:"; cin >> X; if (x) cout << true else cout << false O nothing will be displayed true O false 0