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
77julia77 [94]
4 years ago
12

Assume you have the following array: int[] values = new int[15]; What will happen if the following code is executed? int[15] = 2

0;
a. The value will be added to the array.
b. You will get an ArrayIndexOutOfBoundsException
c. Nothing will happen
d. The array will grow in size by one and the value will be added to the array.
Computers and Technology
1 answer:
andrey2020 [161]4 years ago
3 0

Answer:

You are creating an array "values" which stores 15 integers. And if we will write int[15]=20, we are not following correct syntax. Hence, nothing will happen, and it might however, throw an error that the syntax is wrong.

Explanation:

int[15]=20 is a wrong syntax, and hence nothing will happen or computer might throw an error like that not correct syntax is being used. And if we write values[15]=20,  It will certainly throw ArrayIndexOutOfBoundsException as the maximum length is fixed to 15 and values[14] and not more than that.  

You might be interested in
Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follo
kakasveta [241]

A program that lets the user play the game of Rock, Paper, Scissors against the computer.

Explanation:

a. When the program begins, the user enters his or her choice of "rock", "paper", or "scissors" at the keyboard using a menu in a function, userChoice, that returns a character.

b. Next, there should be a function, computerChoice, that generates the computer’s play. A random number in the range of 1 through 3 is generated. (NOTE: You’ll have to do some research on how to create random numbers correctly.) If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. The computer’s choice is returned as a character

c. After, a function, determineWinner, will determine the winner between the user’s choice vs. the computer’s choice.The result is selected according to the following rules:

d. Finally, after a result is selected, there should be a function, playAgain, in which the player should have the option of playing again. This should return a boolean.

#include <iostream>

#include <stdlib.h>

int main() {

srand (time(NULL));

int computer = rand() % 3 + 1;

int user = 0;

 std::string roc = "1) Rock\n";

 std::string pap = "2)Paper\n";

 std::string sci = "3) Scissors\n";

std::cout << "rock paper scissors!\n";

std::cout << roc;

std::cout << pap;

std::cout << sci;

std::cout << "Choose: ";

std::cin >> user;

std::cout << "\nYou  choose ";

 switch(user){

   case 1 :

    std::cout << roc;

    break;

   case 2 :

    std::cout << pap;

    break;

   case 3 :

    std::cout << sci;

    break;

   default :

    std::cout << "Invalid Option\n";

 }

std::cout << "Comp choose ";

   switch(computer){

   case 1 :

    std::cout << roc;

    break;

   case 2 :

    std::cout << pap;

    break;

   case 3 :

    std::cout << sci;

    break;

   default :

    std::cout << "Invalid Option\n";

 }

 if(user == computer){

   std::cout << "Draw Game\n";

 }

 else if(user == 1 && computer == 3){

   std::cout << "You Win\n";

 }

 else if(user == 3 && computer == 2){

   std::cout << "You Win\n";

 }

 else if(user == 2 && computer == 1){

   std::cout << "You Win\n";

 }

 else{

   std::cout << "Computer Wins!\n";

 }

}

7 0
3 years ago
What is the purpose of citations?
Elina [12.6K]

Answer: Citiations areto show where you got information from.

Explanation:

6 0
4 years ago
Encoding in the information processing theory is the process of _____
Katyanochek1 [597]

Encoding in the information processing theory is the process of inputting of information into the memory system.

<h3>What is encoding?</h3>

Encoding is an act or a system method that is used in the inputting of information into the computer memory system.

It entails the storage in the retention of encoded information. After encoding is the Retrieval method that is the act of getting the information out of memory.

Learn more about encoding from

brainly.com/question/3926211

8 0
2 years ago
What needs to be true of data used in consolidation
Dahasolnce [82]

Data consolidation is a collection and integration of data from multiple sources into a single destination.

Explanation:

Data consolidation allows you collect all your datas together from seperate worksheet into a master worksheet. Its function is to take data from a series of worksheet or workbooks and summaries it into a worksheet that can be updated easily.

During the process of data consolidation the different data sources are gathered together or consolidated into a single data source.

To consolidate first step is to open all files that contains data then ensure that data is organized in the same way and the third step is on the data ribbons select data tools and then consolidate. In the final step select the method of consolidation .

Consolidation is important strategically as the company looks to grow important share and market.

5 0
4 years ago
If a web page visitor clears the analytics cookie from their browser, what will occur?
katrin2010 [14]

Answer:

If a web page visitor clears the Analytics cookie from their browser, Analytics will not be able to associate user behavior data with past data collected. ... It will set a new browser cookie the next time a browser loads a tracked page.

6 0
3 years ago
Other questions:
  • Where is the bubble level on a tripod?
    6·2 answers
  • Timing circuits are a crucial component of VLSI chips. Here’s a simple model of such a timing circuit. Consider a complete balan
    10·1 answer
  • Which option enables you to keep the last grammatical change
    15·2 answers
  • Spreadsheet software creates a ____, composed of a grid of columns and rows
    6·1 answer
  • Assume TCP is operating in steady state congestion avoidance phase (no slow start) and the maximum congestion window size is 220
    8·1 answer
  • ______design A plan for the actual implementation of the system.
    9·2 answers
  • In a well-developed paragraph - using domain-specific vocabulary and academic writing - address the following writing prompt:
    12·1 answer
  • What happens when you run a program in Python? ​
    12·2 answers
  • Which of the follow efficiencies would be considered unreasonable?
    13·1 answer
  • In which languages the dynamic web pages are written?<br>​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!