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
zimovet [89]
3 years ago
7

Consider the partially-filled array named a. What does the following loop do? (cin is a Scanner object)

Computers and Technology
1 answer:
Jlenok [28]3 years ago
3 0

Answer:

3. Reads up to 3 values and places them in the array in the unused space.

Explanation:

cin.NextInt() reads the next value from the Scanner.

The while is just while the size is lesser than the capacity and the value is positive. It may read up to 3 values, and puts at the position size; Size starts at 3, that is, the first index which the value is 0, and goes up to 5. So it is the unused positions.

The correct answer is:

3. Reads up to 3 values and places them in the array in the unused space.

You might be interested in
Write a program named ArrayDemo that stores an array of 10 integers. (Note that the array is created for you and does not need t
romanna [79]

Answer:

Hi Zoom! Good question. This is particularly useful for learning sorting functions in arrays and user input handling as well. Please find the implementation below.

Explanation:

I have implemented the code in Python 2+. You can save the below code into a file called ArrayDemo.py and then run it from the command line with the command "python ArrayDemo.py". I have declared the demo_array in the code to an array of 10 unsorted integer values to test this. You can change the code if needed to have this array input by user as well and it should work fine.

Note: if you're using Python 3+ then you'll need to change the "raw_input" in the code to just "input" to make it work.

ArrayDemo.py

demo_array = [2,1,3,4,5,7,6,8,10,9]

option = 0

while (option != 4):

 option = raw_input("Enter 1 to view list in ascending order, 2 to view list in descending order, 3 to choose specific poisition to view, 4 to quit the application: ")

 try:

   option = int(option)

   if option == 1:

     sort_by = 'asc'

     print(sorted(demo_array, reverse=False))

   elif option == 2:

     sort_by = 'desc'

     print(sorted(demo_array, reverse=True))

   elif option == 3:

     position = raw_input("Enter specific position to view (0-9): ")

     try:

       position = int(position)

       if position < 0 or position > 9:

         print("Position does not exist")

       else:

         print(demo_array[position])

     except ValueError:

       print("Position does not exist!")

   elif option == 4:

     break

   else:

     break

 except ValueError:

   print("Invalid input!")

5 0
3 years ago
What does the shell of a operating system do?
gulaghasi [49]

The shell of an operating system is the programming that interprets the commands and actions of the user of the system.

6 0
3 years ago
Which of the following statements about functional programming languages is incorrect?A) In pure functional programming, there a
omeli [17]
The answer is (C)
In pure functional programming loops are replaced by recursive calls
3 0
3 years ago
The method __________ sets the font (helvetica, 20-point bold) in component
Stolb23 [73]
The method d) c.setFont(new Font("Helvetica", Font.BOLD, 20)) sets the font (Helvetica, 20­point bold) in component C. A set of instructions that can be called for execution using the method name is a method in Java that can take in data or parameters and return a value - both parameters and return values are optional.
7 0
3 years ago
The ____ is composed of tabs, each containing groups of related commands.
Mashutka [201]
Ribbon im pretty sure is your answer
3 0
4 years ago
Other questions:
  • Should i buy the Samsung s10+ or wait for s11 or any other phones you guys suggest?
    6·2 answers
  • Modern car odometers can record up to a million miles driven. What happens to the odometer reading when a car drives beyond its
    8·1 answer
  • Edhesive 3.4 question 2
    11·2 answers
  • Henry is having a problem with the electrical system on his current laptop. The battery for the laptop will not charge. Henry to
    13·1 answer
  • What types of projects require collaboration? en360
    15·1 answer
  • A stock transfer from a storage bin in one warehouse to a storage bin in another warehouse is a possible scenario under which wa
    5·1 answer
  • Free pass if you want it.
    12·2 answers
  • WILL GIVE BRAINLIST IF ANSWER IS RIGHT AND YOU TELL ME HOW YOU GOT YOUR ANSWER (dont copy and past from a site)
    10·2 answers
  • Write a program in c# that simulates the roll of two six sided dice.
    6·1 answer
  • What is the minimum amount of hard drive space required for a 64-bit Windows 10 installation?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!