Question

for java

5. What is the Output? (2 x 5p each -10p) For cach of the following code snippets write down what will be printed on the scre

Comments
    0 0
    Add a comment Improve this question Transcribed image text
    Answer #1

    autput

    Add a comment
    Know the answer?
    Add Answer to:
    5. What is the Output? (2 x 5p each -10p) For cach of the following code snippets write down what...
    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...

    • [10pts] 7) What is the output of the following program? In other words, what is printed...

      [10pts] 7) What is the output of the following program? In other words, what is printed to the screen when you run it? #include <iostream> #include <queue> using namespace std int main) char qu[5] ('a, 'b',c'd','e' queue <char> q int N = 4; char ch for(int í - 0:ì < 5;++1) q.push(qu (]) for (int ǐ 0;i < N;++i) { = ch q.front); q push(ch): q.pop while(!q.emptyO) f cout << q.front ) <<endl; q.pop )

    • Exercise 1: For each of the following high-level language code snippets, write the SRO assembly code....

      Exercise 1: For each of the following high-level language code snippets, write the SRO assembly code. Assume that the variables A, B, C, X. are in memory locations MA, MB, MC, MX, respectively. a) XA+ 2B- 4C; b) if (A <0) else if (A> 0) else c) for (int i 1; 10; i++) X A+B+C (Hint: Use branch instructions to set up the loop)

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

    • 1. What is the output of each of the following code segments if the inputs are...

      1. What is the output of each of the following code segments if the inputs are as follows: 5 0 15 -5 2 Scanner input = new Scanner(System.in); int sum = 0; for(int i = 0; i < 5; i++){ System.out.print( “Enter a number”); int number = input.nextInt(); if(number <= 0) break; sum += number; } System.out.println(sum); Second Segment: Scanner input = new Scanner(System.in); int sum = 0; for(int i = 0; i < 5; i++){ System.out.print( “Enter a number”);...

    • Assuming the following code is part of an error-free program, what is the output on the...

      Assuming the following code is part of an error-free program, what is the output on the screen vector<char> example(4,'a'); example[2]='b'; example.at(1)-c'; for (int i-0; I <example.size); i++) cout << examplelil<<""

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

      QUESTION 8 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 What (if anything) will be the output of the following code: int count = 0; while (count < 5) {...

    • For each of the below code snippets, identify the bounding function (the big O) of the...

      For each of the below code snippets, identify the bounding function (the big O) of the number of times the indicated line is run (justify your answer briefly): int i = 1: while (i < n) { printf ("Insert difficult work here!") i = i + i: } for(i = 0: i < n: i++) { for (j = 0: j < n: j++) { for (k = 0: k < n: k++) { if(i==j && j==k) arr[i] [j] [k]...

    • Java What keyword would you write in the --?-- place, to get this code to write...

      Java What keyword would you write in the --?-- place, to get this code to write the output 10210? int j = 20; for (int i = 0; i < 5; i++) { j = j/2; if (j == 5) --?--; System.out.print(j); }

    • Please explain how you get the output for each case. 3. What is the output of...

      Please explain how you get the output for each case. 3. What is the output of the following jave code fragments: a. intl A-(1,3,0,2,4) int temp = A[0]; for (int í=0; i< A.length-l; i++) A(幻-A(1+1); AI4]-temp; for (int i: A) System.out.print(ALi]" b. intll A-(3,0,2,4,1) int B new int [51: for(int i-o; ǐ< A.length; ǐ++) for (int i: B)System.out.print (B[i]"" C. int A A-new intl for (int i-0: i A.length-1; 1++) AI4] -temp; for (int i: A)System.out.print (A[ +"

    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