Question

QUESTION 8 What (if anything) will be the output of the following code: int count =...

QUESTION 8

  1. What (if anything) will be the output of the following code:

    int count = 3; 
    
    while (count++ <= 6)
    {
      System.out.print(++count + " "); 
    }

    3 4 5 6

    4 5 6 7

    3 4 5 6 7

    5 7

    4 6

    The above code contains a syntax error and will not run.

8 points   

QUESTION 9

  1. What (if anything) will be the output of the following code:

    int count = 0; 
    
    while (count < 5)
    {
      System.out.print(count++ + " "); 
    }

    The above code contains a syntax error and will not run.

    0 1 2 3

    1 2 3 4 5

    0 1 2 3 4

    0 0 0 0 0

    1 2 3 4

8 points   

QUESTION 10

  1. What (if anything) will be the output of the following code:

    int count = 0; 
    
    while (++count < 5)
    {
      System.out.print(count + " "); 
    }

    0 1 2 3

    1 2 3 4 5

    The above code contains a syntax error and will not run.

    1 2 3 4

    0 1 2 3 4 5

    0 1 2 3 4

8 points   

QUESTION 11

  1. What (if anything) will be the output of the following code:

    int count = 3; 
    
    while (count-- >= 0)
    {
      System.out.print(count + " "); 
    }

    3 2 1 0 -1

    3 2 1 0

    2 1 0

    The above code contains a syntax error and will not run.

    3 2 1

    2 1 0 -1

0 0
Add a comment Improve this question Transcribed image text
Answer #1
QUESTION 8
the output of the given code
5 7

QUESTION 9
the output of the given code
0 1 2 3 4

QUESTION 10
the output of the given code
1 2 3 4

QUESTION 11
the output of the given code
2 1 0 -1 
Add a comment
Know the answer?
Add Answer to:
QUESTION 8 What (if anything) will be the output of the following code: int count =...
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
  • 1. What is the output of the following code segment? int array[] = { 8, 6,...

    1. What is the output of the following code segment? int array[] = { 8, 6, 9, 7, 6, 4, 4, 5, 8, 10 }; System.out.println( "Index Value" ); for ( int i = 0; i < array.length; i++ ) System.out.printf( "%d %d\n", i, array[ i ] ); 2. What is the output of the following code segment? char sentence[] = {'H', 'o', 'w', ' ', 'a', 'r', 'e', ' ', 'y', 'o', 'u' }; String output = "The sentence...

  • JAVA 5) What is the output of the following code? int a = 70; boolean b...

    JAVA 5) What is the output of the following code? int a = 70; boolean b = false; if(a >= 70) { System.out.print(1); if(b==true) { System.out.print(2); } } else { System.out.print(3); if(b==false) { System.out.print(4); } } System.out.print(5); 6) What is the output of the code above using these initial values? int a = 43; boolean b = false; 7) The following method is SYNTACTICALLY correct (meaning it will compile). True or false? public boolean method() { int value = 5;...

  • Thie What is the output of the following program segment? int count 1; do System.out.print(count (count-)...

    Thie What is the output of the following program segment? int count 1; do System.out.print(count (count-) + while(count++ <= 5);

  • What is the output of the following C++ code? int count = 1; int num =...

    What is the output of the following C++ code? int count = 1; int num = 25; while (count < 25) { num--; count++; } cout << count « " " « num << endl i 25 1 0 24 1 0 25 0 0 24 0 In this while loop statement, while (counter < 10), where counter is an int variable. Which statement below is an equivalent way to write this while statement? while (10 < counter) while (9...

  • QUESTION 10 What will be the output of following code snippet? char *str; str = "%s";...

    QUESTION 10 What will be the output of following code snippet? char *str; str = "%s"; printf(str, "S"); A. S B. Garbage Value C. Compile-time Error D. Run-time Error 4 points    QUESTION 11 What will be the output of the following statements assuming that the array begins at the memory address location 7002 and size of an integer is 4 bytes? int a[3][4] = { 1, 2, 3, 4,                     5, 6, 7, 8,                     9, 10, 11, 12 }; printf("%d,...

  • pic 4: Loops What is the output of the following code? int main0 ( int x...

    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

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

  • 1. (TCO 1) What is the output of the following C++ code? int list[5] = {0,...

    1. (TCO 1) What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 0; j < 5; j++)      cout << list[j]; (Points : 4)         0 1 2 3 4         0 5 10 15         0 5 10 15 20         5 10 15 20 Question 2.2. (TCO 1) What is stored in alpha after the following code executes? int alpha[5] = {0}; int j; for (j = 0; j...

  • Given the following code segment, int x = 20; int y = 7; what is the...

    Given the following code segment, int x = 20; int y = 7; what is the data type of the value of the expression (x % y) ? (3 points) Question 1 options: 1) int 2) double 3) numeric 4) Error: possible loss of precision 5) Unable to be determined Question 2 (3 points) Given the following code segment, double x = 42.3; double y = 11.7; what is the data type of the value of the expression (x %...

  • help What is the output of the code snippet below? int [ ] [ ] numarray...

    help What is the output of the code snippet below? int [ ] [ ] numarray = t 8, 7, 6, 1 0, 0, 0 li System.out.print (numarray [0] [0]) System.out.print (numary System.out.print (numarray to1 to array 1] to]); a) 00 b) 87 c) 80 d) 08

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