1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Bingel [31]
3 years ago
11

What is the value of i printed? j = i = 1 i += j + j * 5 print("What is i?", i)

Computers and Technology
1 answer:
Maurinko [17]3 years ago
4 0

Answer:

7

Explanation:

Given the codes as follows:

  1. j = i = 1  
  2. i += j + j * 5  
  3. print("What is i?", i)

In line 1, the value of 1 is assigned to variable i and then the variable i is assigned to variable j. This means j will hold the value of 1 as well.

In line 2, j will be multiplied with 5 prior to the addition with j itself. So, j + j * 5 -> 1 + (1 * 5) -> 1 + 5 -> 6

Next, value of 6 will be added with i. i = i + 6  ->  i = 1 + 6 -> 7#

Eventually, value of 7 will be printed out (Line 3).

You might be interested in
How to Create a while loop
Marta_Voda [28]
While (condition) ( < > =< => = !+) 
{
    code block
<span>}

some think like this 

</span>
6 0
3 years ago
Read 2 more answers
How do you know if you get a phone call that is a scam
Kamila [148]

It might have a really weird phone number, also if it sounds like its too good to be true it probably is. Good luck, and don't fall for scams!! XD

5 0
3 years ago
Read 2 more answers
Communication of a message between two processes implies which of the following? (A) Synchronization (B) Atomic operation (C) Bl
solong [7]

Answer: Synchronization

Explanation:

In communication of messages between processes we have a mechanism called as the interprocess communication (IPC) using which it is required to achieve synchronization between the process. These synchronization helps to prevent collision of the processes for the shared resources. Examples can be of mechanism of producer consumer problem .

6 0
3 years ago
Assume that getPlayer2Move works as specified, regardless of what you wrote in part (a) . You must use getPlayer1Move and getPla
kakasveta [241]

Answer:

(1)

public int getPlayer2Move(int round)

{

  int result = 0;

 

  //If round is divided by 3

  if(round%3 == 0) {

      result= 3;

  }

  //if round is not divided by 3 and is divided by 2

  else if(round%3 != 0 && round%2 == 0) {

      result = 2;

  }

  //if round is not divided by 3 or 2

  else {

      result = 1;

  }

 

  return result;

}

(2)

public void playGame()

{

 

  //Initializing player 1 coins

  int player1Coins = startingCoins;

 

  //Initializing player 2 coins

  int player2Coins = startingCoins;

 

 

  for ( int round = 1 ; round <= maxRounds ; round++) {

     

      //if the player 1 or player 2 coins are less than 3

      if(player1Coins < 3 || player2Coins < 3) {

          break;

      }

     

      //The number of coins player 1 spends

      int player1Spends = getPlayer1Move();

     

      //The number of coins player 2 spends

      int player2Spends = getPlayer2Move(round);

     

      //Remaining coins of player 1

      player1Coins -= player1Spends;

     

      //Remaining coins of player 2

      player2Coins -= player2Spends;

     

      //If player 2 spends the same number of coins as player 2 spends

      if ( player1Spends == player2Spends) {

          player2Coins += 1;

          continue;

      }

     

      //positive difference between the number of coins spent by the two players

      int difference = Math.abs(player1Spends - player2Spends) ;

     

      //if difference is 1

      if( difference == 1) {

          player2Coins += 1;

          continue;

      }

     

      //If difference is 2

      if(difference == 2) {

          player1Coins += 2;

          continue;

      }

     

     

  }

 

  // At the end of the game

  //If player 1 coins is equal to player two coins

  if(player1Coins == player2Coins) {

      System.out.println("tie game");

  }

  //If player 1 coins are greater than player 2 coins

  else if(player1Coins > player2Coins) {

      System.out.println("player 1 wins");

  }

  //If player 2 coins is grater than player 2 coins

  else if(player1Coins < player2Coins) {

      System.out.println("player 2 wins");

  }

}

3 0
3 years ago
what could a company do if it was using a commercial wan and a vulnerability appered thst allowed attackers
Radda [10]

Answer:

The answer is below

Explanation :

If a company was using a commercial WAN and a vulnerability appeared that allowed attackers find routing information and therefore be able to eavesdrop on corporate transmissions "It is expected that such a company should try to formulate and establish Virtual Private Networks between corporate sites.

This will ultimately lead to intercepted transmissions to be unreadable. Though such means have been seen as time-consuming."

4 0
3 years ago
Other questions:
  • Question: A famous Disney Movie partially takes place in this city.
    15·2 answers
  • Why is the keyboard arranged in the QWERTY style?
    6·2 answers
  • How are economics<br> and scarcity related?
    14·1 answer
  • True or False: <br> The object reference can be used to polymorphically store any class in Java.
    13·1 answer
  • Select the correct answer. Which is the bottom-most layer in the OSI model?
    9·1 answer
  • Write an algorithm for finding the perimeter of a rectangle
    6·1 answer
  • What is the most vulnerable information that should be protected to prevent unauthorized access to your online files and records
    8·1 answer
  • Find the distance between the points.<br><br><br>(5,-2),(-6,-2)
    12·1 answer
  • In java I need help on this specific code for this lab.
    5·1 answer
  • How to test someone elese internet speed from a distance
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!