Question
please help me on 12

106 Java Concepts Advanced Placement CS Study Guide 3 12. Consider the following code segment. int count = 0; for (int x = 0;
0 0
Add a comment Improve this question Transcribed image text
Answer #1
Trace:
When x=0, y=0, z=0, the value of count is 1
When x=0, y=0, z=1, the value of count is 2
When x=0, y=0, z=2, the value of count is 3
When x=0, y=1, z=1, the value of count is 4
When x=0, y=1, z=2, the value of count is 5
When x=0, y=2, z=2, the value of count is 6
When x=1, y=1, z=1, the value of count is 7
When x=1, y=1, z=2, the value of count is 8
When x=1, y=2, z=2, the value of count is 9
When x=2, y=2, z=2, the value of count is 10

Answer:

So, the final value of count is 10

Add a comment
Know the answer?
Add Answer to:
please help me on 12 106 Java Concepts Advanced Placement CS Study Guide 3 12. Consider...
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
  • 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;...

  • 31. The following code segment is syntactically correct:              int number{20};          cout << number <<...

    31. The following code segment is syntactically correct:              int number{20};          cout << number << setbase(16) << " " << number                               << setbase(10) << " " << number                                 << showpos << " " << number << endl;                 T__   F__       32. The following statement wants to determine if ‘count’ is outside the     range of 0 through 100:             if (count < 0 && count > 100)                                             T__   F__ 33. There is...

  • need help with a few excercises on general concepts using JAVA language. Try it: what is...

    need help with a few excercises on general concepts using JAVA language. Try it: what is the value of x after each operation? int x = 9; int y = 5; x = x/y; x += 6; x++; x--;I x %= 5; Try it: • What do these evaluate to? int x = 4; int y = ++X – 3 * 2; int z = x++ - 3 * 2; int w = x + 6/2; int t = x+...

  • Please help me with this Java project. I'm trying to create a loop so if user...

    Please help me with this Java project. I'm trying to create a loop so if user enter value > 12, will prompt them a message and take them back to "How many elements do you wan to enter?". Thanks public static void main(String[] args) {        Scanner sc = new Scanner(System.in);           int i, j;       System.out.print("\n How meny elements do you want to enter? (N should be no more than 12) ");    int num...

  • I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I...

    I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I just have to explain a lot so you understand how the program should work. In C programming, write a simple program to take a text file as input and encrypt/decrypt it by reading the text bit by bit, and swap the bits if it is specified by the first line of the text file to do so (will explain below, and please let me...

  • no other details are given, its asking for the invariant programming language: Java Question 3. [15...

    no other details are given, its asking for the invariant programming language: Java Question 3. [15 marks in total Consider the following code fragment with missing statements at ????. Assume that A is a nonempty array of integers and has length N. Assume that it has already been initialised. Refer to this code in parts (a-e) below. A [0] int count 1; int i- 1 while (i< NI1 count> N/2 ) if (xAi]) count++ int x else ???? i+ if...

  • hello there. can you please help me to complete this code. thank you. Lab #3 -...

    hello there. can you please help me to complete this code. thank you. Lab #3 - Classes/Constructors Part I - Fill in the missing parts of this code #include<iostream> #include<string> #include<fstream> using namespace std; class classGrades      {      public:            void printlist() const;            void inputGrades(ifstream &);            double returnAvg() const;            void setName(string);            void setNumStudents(int);            classGrades();            classGrades(int);      private:            int gradeList[30];            int numStudents;            string name;      }; int main() {          ...

  • State true or false: (6 x 2 = 12 pts) Using -- with a reverse iterator...

    State true or false: (6 x 2 = 12 pts) Using -- with a reverse iterator moves it from the back toward the front of a list b) The body of a do-while loop is always executed at least once. c) If p points to the array element a[j], then p + i points to a[i+j]. d) Any number of pointer variables may point to the same object. In terms of both execution speed and memory usage usually iterative solutions...

  • IT Review    JAVASCRIPT (Can someone please help me answer the below questions. It would be nice...

    IT Review    JAVASCRIPT (Can someone please help me answer the below questions. It would be nice if you add comments explaining what you are doing? If unable to add comments the answer would be fantastic. Thank you. Given the following function definition: function percent(x) {      return x / 100; } Which of the following statements correctly calls the percent function: percent(10); percent: 10; percent(); percent = 10; Indicate whether each of the following evaluates to true or false, given...

  • QUIZ 2.3 EXAMPLE 2.25 Please help me build the MATLAB code Use MATLAB to build a...

    QUIZ 2.3 EXAMPLE 2.25 Please help me build the MATLAB code Use MATLAB to build a simulation of Quiz 2.3. Simulate the transmission of 10000 packets, each containing 100 bits. Count the number of packets that contain no error, one, two, three- bit errors, calculate their probabilities. Also calculate the probability of a packet is decoded correctly. Compare your numbers from MATLAB with your theoretical calculation. (Hint: look at Example 2.25.) Data packets containing 100 bits are transmitted over 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