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
fgiga [73]
2 years ago
12

Int [] val = { 3, 10, 44 };

Computers and Technology
1 answer:
irina1246 [14]2 years ago
4 0

Answer:

5) 3 0 0

Explanation:

Given data

int [] val = { 3, 10, 44 };

The total number of parameters of given array are 3, so total length of array is also 3.

The indexing of array starts with '0', Therefore the indexes of array with length zero are: {0,1,2}

The value of array at index 0 is = 3

similarly

value at index 1 = 10

value at index 2 = 44

Here, Int i = 1 is storing the value '1' in integer variable i.

In addition to that, any value of index 'i' of an array is selected using array[i].

Therefore,

val[i] = i-1 is copying the value (i-1 = 1-1 = 0) to the index '1'  of the array because i = 1.

So value at index 1 would be = val[1] = 0

The term i++ is incrementing the value of i, it makes i =2

val[i] = i-1 is copying the value (i-1 = 1-1 = 0) to the index '2' of the array because i = 2 now.

So value at index 2 would be = val[2] = 0

Hence, the output would be {3 0 0}. So 5th option is correct.

You might be interested in
To insert a clip art you must do the following
Elis [28]

In word (.docx) or powerpoint (.ppt), one can insert images. These images may come from the internet online and other avenues for inserting images. If one does not have internet at home, he could opt to using the ‘clip arts’ where you click ‘Insert’ in the home bar up, and click clip art.

<span> </span>

5 0
3 years ago
What do I need to write ??
Alexxx [7]

print('Welcome')

name = input('Please enter your name : ')

age = int(input('Your age : '))

print('Your name is',name,'and you have',age,'years old')

8 0
3 years ago
What is the recommended secure protocol for voice and video applications? secure real-time transport protocol (srtp) hypertext t
snow_tiger [21]
The recommended secure protocol for voice and video applications is the Secure<span> Real-time Transport </span>Protocol<span> (SRTP) protocol. SRTP is a Real-time Transport </span>Protocol (RTP) profile used to  to provide encryption, message authentication and integrity.
The default cipher of SRTP is the Advanced Encryption Standard<span> (AES) .</span>
8 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
Which cpu type would most likely be found in a smartphone?.
dlinn [17]

Answer:

dual-core (two), quad-core (four) and octa-core (eight)

Explanation:

These are the most common according to my research.

If I helped you, can I please have brainliest?

Have a great day/night!

4 0
2 years ago
Other questions:
  • To check whether your writing is clear , you can
    15·2 answers
  • In a video, a motionless image is called
    7·2 answers
  • What can you do to make sure you have a healthy credit report
    13·2 answers
  • You receive $50 as a birthday gift and choose to spend it all on new wallpaper for your room. The opportunity cost of this decis
    7·1 answer
  • When protecting a worksheet all cells are locked by default.?
    10·1 answer
  • When you're working on an image, it's a good idea to make a ____________ of the image, so that you'll have the original image in
    12·2 answers
  • If you define a destructor, are you required to define an operator '=' and a copy constructor?
    9·1 answer
  • Superclass in python explanation
    7·1 answer
  • Which feature allows you to copy attributes of
    11·1 answer
  • Reesa works for a large real estate company. She is responsible for installing and supporting the company's internet systems, in
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!