Question
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
In the following expression: (y == 3) || (x > 2) What value of y results in short circuit evaluation (skips evaluating the se
Convert this if-else statement to a single assignment statement using a conditional expression. if (x <20) YX ) else { Y = 20
Question 25 (Mandatory) (3.2 points) If userText is March 17, 2034, what does userText.indexOf(April) return? - 1 00 2
What is the index of the last letter in the string Hey? 3 1 02
Which expression results in true? Assume strl is Apples and str2 is apples. Ostr1.equals(str2) str1.equals(apples) Ostr
istall, isRich, and is famous are Boolean variables. What is is Famous after executing the following statements? istall - fal
numItems and userval are int types. What is the final value of numItems if userval=3? switch (userval) { case 1: numItems - 5
Which operator is evaluated first? W + 3 > x- y z +
0 0
Add a comment Improve this question Transcribed image text
Answer #1

What are the values of i for each iteration of:

for(i=0;i<6;++i) {
...
}

ANSWER: option - B

0 1 2 3 4 5

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 userNum from input


ANSWER: option -A
2




in the following expression:
( y== 3) || (x > 2)

What value of y results in short circuit evaluation (skips evaluating second operand

ANSWER: option -D
3

Convert this if-else statement to a single assignment statement using a conditional expression.

if ( x < 20) {
y = x;
}
else {
y = 20;
}

ANSWER: option -B
y = (x < 20) ? x: 20;

Question 25:
if userText is "March 17, 2034". what does userText.indexOf("April") return?

ANSWER: option -A
-1


What is the index of the last letter in the string "Hey"?

ANSWER: option -D
2

Which expression result in true? Assume str1 is "Apples" and str2 is "apples".


ANSWER: option -D
str1.equlas("Apples")


isTall, isRich and isFamous are Boolean variables. What is isFamous after executing the following statements?

isTall = false;
isRich = true;
isFamous = false;

if(isTall && isRich) {
isFamous=true;
}

ANSWER: option -A
false


numItems and userVal are int types. What is the final value of numItems if userVal=3?

switch (userVal) {
case 1:
numItems = 5;
break;
case 3:
numItems = 12;
break;
case 4:
numItems = 99;
break;
default:
numItems = 55;
break;
}


ANSWER: option -B
12

Which operator is evaluated first?
w + 3 > x - y * z

ANSWER: option -D

*

Add a comment
Know the answer?
Add Answer to:
whats the answers What are the values of i for each iteration of: for (i =...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • need help whats the answers numItems and userVal are int types. What is the final value...

    need help whats the answers numItems and userVal are int types. What is the final value of numItems if userval=3? switch (userval) { case 1: numItems - 5; break; case 3: numItems - 12; break; case 4: num Items - 99 break; default numItems - 55; break; } O 12 55 5 99 istall, isRich, and isFamous are Boolean variables. What is isFamous after executing the following statements? istall - false; Rich = true; inFamous - false; sf (istall &&...

  • what are the answers Which detects if x is in the range -4 to +4? (x...

    what are the answers Which detects if x is in the range -4 to +4? (x < -5) AND (* < 5) O (x >-5) AND (* < 5) O (X <-5) OR (x < 5) O (x > -5) OR (* < 5) If the final else branch executes, what must userNum have been? Type "unknown" if appropriate. if (userNum < 9) { > else if (userNum > 11) -- > else { ... // userNum if this executes...

  • C program take values to 9 and the second can take values to 12 if (x...

    C program take values to 9 and the second can take values to 12 if (x > 2^3) printf("d", x); Int s-e; 21. LOST) Write a statement that declare an array of doubles with two indices, such that the first index can 22 (LOL) The following code will print out: 23. (L02.) The following code will print out: PART 2 Fill in the banks questions 3 marts x + 5; else x -- 2; char "stri - "abcd"; char str2[]...

  • Can i get the answers for 1,2,3 and 4 1. What are the values of int...

    Can i get the answers for 1,2,3 and 4 1. What are the values of int x in the following C++ statement? 2 each a) x = 18 % 5; b)x= (4/5)==0.8; c)X =( 4 - 3 * 2 == 2) ?0:1; 2. What will x and y be when each part starts out with integers x = 6, y = -4 and z=5? 2 each a) x *= 12 - x; x becomes b) z= x++ + x; x...

  • whats the answers For the following code, indicate how many times the loop body will execute...

    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...

    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)

  • Draw a picture of array A, showing the values stored in it after execution of each...

    Draw a picture of array A, showing the values stored in it after execution of each code segment below. Use the following data: 0 1 2 3 4 5 6 7 8 9 int A[4][2]: int k, m: for (int i = 0: i < = 3: i++) for (int j = 0: j < = 1: j++) A[i][j] = 0: for (int j = 1: j < = 10: j++) { cin > > k: switch (k) { case...

  • Problem with C++ program. Visual Studio say when I try to debug "Run-Time Check Failure #2...

    Problem with C++ program. Visual Studio say when I try to debug "Run-Time Check Failure #2 - Stack around the variable 'string4b' was corrupted. I need some help because if the arrays for string4a and string4b have different sizes. Also if I put different sizes in string3a and string4b it will say that those arrays for 3a and 3b are corrupted. But for the assigment I need to put arrays of different sizes so that they can do their work...

  • 8 Suppose the following declarations and statement are in effect. What are the values of x...

    8 Suppose the following declarations and statement are in effect. What are the values of x and y in each case? *p *q; = (b) int x = 1, y = 3, *m = &x, *n = &у; *n = 5; *a += 2; (8)Please solve written in details. (4)Notice the semi colon and explain. PLEASE NO CODING(both) 4 Determine the output produced by each of the following statements: (a) for (i = 6; 1 > 0;-1) print (-") (b)...

  • 20) What is the output of the following segment of C code: int avg(int n, int*...

    20) What is the output of the following segment of C code: int avg(int n, int* a); int main () {             int array[4]={1,0,6,9};             printf("%d", avg(4, array)+ 1);             system("pause");             return 0; } int avg(int n, int* a) { int i, sum=0; for (i=0;i<n;i++) { sum+=a[i]; } return sum/n; } a) 16 b) 5 c) 4 d) 8 21) What is the output of the following segment of C code: int x = 2; int y = 3;...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT