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
Kipish [7]
3 years ago
9

Which of the following statements represents the number of columns in a regular two-dimensional array named values?

Computers and Technology
1 answer:
puteri [66]3 years ago
5 0

Answer:

(a) values[0].length

Explanation:

In programming languages such as Java, an array is a collection of data of the same type. For example, a and b below are an example of an array.

a = {5, 6, 7, 9}

b = {{2,3,4}, {3,5,4}, {6,8,5}, {1,4,6}}

But while a is a one-dimensional array, b is a regular two-dimensional array. A two-dimensional array is typically an array of one-dimensional arrays.

Now, a few thing to note about a two-dimensional array:

(i) The number of rows in a 2-dimensional array is given by;

<em>arrayname.length</em>

For example, to get the number of rows in array b above, we simply write;

<em>b.length </em>which will give 4

(ii) The number of columns in a 2-dimensional array is given by;

<em>arrayname[0].length</em>

This is with an assumption that all rows have same number of columns.

To get the number of columns in array b above, we simply write;

<em>b[0].length </em>which will give 3

Therefore, for a regular two-dimensional array named values, the number of columns is represented by: values[0].length

You might be interested in
What is the standard internet protocol, which provides the technical foundation for the public internet?
luda_lava [24]
You have to be carefull no bulling cuiberbulling people hurt there self for stuff like that
3 0
3 years ago
Yall like portal 1 or 2
balu736 [363]

yessir i like 2 better cause the plot is better

8 0
2 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
____ is suitable for what are called "high-volume service control applications" such as dial-in access to a corporate network.
Levart [38]

Answer: a. RADIUS

Explanation:

RADIUS as developed with the idea of allowing its users or clients to be able to authenticate to a dial-in access server. So basically it is a client server protocol and he client here is the firebox and the server is the RADIUS server.  

The authentication mechanism start by user who sends a message to the RADIUS server. Then the RADIUS server upon receiving the message accept or denies it. It accepts if the client is configured to the server.

A large amount of additional information can be sent by the RADIUS server in its Access-Accept messages with users so we can say that RADIUS is uitable for what are called "high-volume service control applications" such as dial-in access to a corporate network.

3 0
3 years ago
Using the program below, explain what the output will be at LINE A. 1 #include 2#include 3#include 4 5 int value - 128; 6 7 int
slega [8]

Answer:

This is the complete correct program:

#include <stdio.h>

#include<sys/types.h>

#include<unistd.h>

int value = 128;

int main()

{

  pid_t pid;

  pid=fork();

  if (pid==0) /* child process */

  {

  value +=8;

  return 0; }

  else if (pid > 0) {/* parent process */

 wait (NULL);

 printf ("PARENT: value =%d\n" ,value); /* LINEA */

 return 0;

}

}

The output of the LINE A is:

PARENT: value = 128

Explanation:

The fork() function used in the program creates a new process and this process is the child process. The child process is same as the original process having its own address space or memory.

In the child process the value of pid is 0. So the if condition checks if pid==0. Then the child process adds 8 to the value of its variable according to the following statement  

value +=8;

Now the original process has value = 128. In else if part the parents process has the value of pid greater than zero and this portion of the program is of the parent process :

else if (pid > 0)

{ wait (NULL);

printf ("PARENT: value =%d\n" ,value);

return 0; }

So the value 128 is printed at the end in the output.

wait(NULL) is used to wait for the child process to terminate so the parent process waits untill child process completes.

So the conclusion is that even if the value of the variable pid is changed in the child process but it will not affect the value in the variable of the parent process.

5 0
2 years ago
Other questions:
  • The set of specific, sequential steps that describe exactly what a computer program must do to complete the work is called a(n)
    10·2 answers
  • Lucy has to move data from column A to column N in a worksheet. Which keys should she select to move data in the same worksheet?
    7·2 answers
  • What part of a file name does windows use to know which application to open to manage the file?
    13·2 answers
  • A Windows application which demands a lot of raw processing power to execute repetitive complex calculations is a good candidate
    9·1 answer
  • What is a third variable condition that could create the following correlation?
    10·2 answers
  • Diverting an attacker from accessing critical systems, collecting information about the attacker's activity and encouraging the
    8·1 answer
  • Convertbinary(111100)to decimal​​​​
    13·2 answers
  • To make changes to how UAC operates, you must be logged in as administrator true or false
    6·1 answer
  • Meta is a penetration testing engineer assigned to pen test the security firm's network. So far, she cannot tunnel through the n
    12·1 answer
  • What would a good digital citizen do if he sees his classmate left her email account open on a school computer by mistake?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!