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
Ganezh [65]
2 years ago
10

Consider the partially-filled array named a. What does the following loop do? (cin is a Scanner object)int[] a = {1, 3, 7, 0, 0,

0};int size = 3, capacity = 6;int value = cin.nextInt();while (value > 0){a[size] = value;size++;value = cin.nextInt();}1. May crashe at runtime because it can input more elements than the array can hold2. Reads up to 3 values and inserts them in the array in the correct position.3. Reads one value and places it in the remaining first unused space endlessly.4. Reads up to 3 values and places them in the array in the unused space.
Computers and Technology
1 answer:
boyakko [2]2 years ago
8 0

Answer:

Option 1: May crash at runtime because it can input more elements than the array can hold

Explanation:

Given the code as follows:

  1.        int[] a = {1, 3, 7, 0, 0, 0};
  2.        int size = 3, capacity = 6;
  3.        int value = cin.nextInt();
  4.        while (value > 0)
  5.        {
  6.            a[size] = value;
  7.            size++;
  8.            value = cin.nextInt();
  9.        }

From the code above, we know the <em>a</em> is an array with six elements (Line 1). Since the array has been initialized with six elements, the capacity of the array cannot be altered in later stage.

However, a while loop is created to keep prompting for user input an integer and overwrite the value in the array started from index 3 (Line 4- 9). In every round of loop, the index is incremented by 1 (Line 7). If the user input for variable <em>value</em> is always above zero, the while loop will persist.  This may reach a point where the index value is out of bound and crash the program. Please note the maximum index value for the array is supposedly be 5.  

You might be interested in
Which is an example of a zero-point perspective?
kap26 [50]

i think its b sorry if  wrong

4 0
3 years ago
When saving a memo you created in Word, which one of the following extensions is automatically assigned to the document?
VMariaS [17]
What are the options and if it's meaning like when you save something it has .pdf .jpg or .doc after the title then it would be ".doc"
8 0
2 years ago
Which is true regarding pseudocode?
bearhunter [10]

Answer:

It uses simple words and symbols to communicate the design of a program

Explanation:

A software can be defined as a set of executable instructions (codes) or collection of data that is used typically to instruct a computer on how to perform a specific task and solve a particular problem.

A software development life cycle (SDLC) can be defined as a strategic process or methodology that defines the key steps or stages for creating and implementing high quality software applications. There are seven (7) main stages in the creation of a software and these are;

1. Planning.

2. Analysis.

3. Design.

4. Development (coding).

5. Testing.

6. Implementation and execution.

7. Maintenance.

A pseudocode refers to the description of the steps contained in an algorithm using a plain or natural language. Also, a pseudocode gives a summary of the steps adopted during a software development process using simple (concise) words and symbols.

This ultimately implies that, a pseudocode uses simple words and symbols to communicate the design of a program.

8 0
2 years ago
Read 2 more answers
What is the effect of this line of CSS code?
Semenov [28]
The correct answer is C
6 0
2 years ago
You want to substitute one word with another throughout your
Hitman42 [59]
I’m pretty sure it’s “Find and paste”
8 0
3 years ago
Other questions:
  • You have a Bluetooth headset that integrates with your computer so that you can talk to partners through Microsoft Lync. This is
    6·2 answers
  • Your school computer library has a network that connects computers and devices within a few small rooms. what type of network do
    7·1 answer
  • What document type would be best to communicate sales items from a business to potential customer?
    12·1 answer
  • Need help writing a program that reads a string if the option "E" (enter a string) is chosen, and checks if parentheses (), brac
    14·1 answer
  • What is the acronym that helps you remember the order of math operations?
    9·2 answers
  • Computer piracy occurs when what is violated
    6·1 answer
  • Write a program that prints the following text: In C, lowercase letters are significant. main() is where program execution begin
    14·1 answer
  • What formatting has been applied to this title?
    8·1 answer
  • How many levels of full body protective clothing are there? A. Four B. Seven C. Six D. Two
    14·2 answers
  • Alfred works in the human resources department, and he uses a management information system to find applicants' résumés on the w
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!