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

Java Array question.

Computers and Technology
1 answer:
kodGreya [7K]3 years ago
3 0

Answer:

3) 3 44 44

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 <u>indexes</u> 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] is selecting the value of array located at index '1' because i = 1.

val[i] = val[1] = 10

val[i+1] is selecting the value of array located at index 'i+1' that is (1+1) =2

val[i+1] = val[2] = 44

Finally,

val[i] = val[i + 1]; is copying the value placed at index 2 (44) to value placed at index 1 (10). Hence, the output would be {3 44 44}. So 3rd option is correct.

 

You might be interested in
What's wrong with these codes in code HS Karel challenges(7.1.2. Racing Karel) Codes: //Below is the program that have Karel mov
Viktor [21]

Answer:

The program only runs 5 five since the for loop statement is limited to loop only five times.

Explanation:

In programming, a for-loop statement is used to repeat a collection of events a definite number of times. The number of loops is specified and compared with a variable to execute a block of code.

The for-loop statement in the code above declares and initializes a variable "i" to zero, runs the block of code, and increments by one if it is less than 5.

To make it run eight times, the value five should be changed to 8 instead.

5 0
2 years ago
Chegg Suppose the heap is a full tree, size 2^n-1. what is the minimum number of steps to change a min heap to a max heap. Show
adoni [48]

Answer:

Explanation:

We start from the bottom-most and rightmost internal node of min Heap and then heapify all internal modes in the bottom-up way to build the Max heap.

To build a heap, the following algorithm is implemented for any input array.

BUILD-HEAP(A)

   heapsize := size(A)

   for i := floor(heapsize/2) downto 1

       do HEAPIFY(A, i)

   end for

Convert the given array of elements into an almost complete binary tree.

Ensure that the tree is a max heap.

Check that every non-leaf node contains a greater or equal value element than its child nodes.

If there exists any node that does not satisfy the ordering property of max heap, swap the elements.

Start checking from a non-leaf node with the highest index (bottom to top and right to left).

4 0
2 years ago
The incident results in huge losses of revenue as a result their mobile app service is withdrawn. Investigators discovered a vul
zlopas [31]

Answer:

The attackers used the code injection

Explanation:

<em>Because, the HMTL5 allows data and code to be mixed together, making code injection attacks possible. </em>

6 0
3 years ago
Why we use cluster computing and hadoop framework for big data sysetm​
Ber [7]

Answer:

Explanation:

Hadoop clusters can boost the processing speed of many big data analytics jobs, given their ability to break down large computational tasks into smaller tasks that can be run in a parallel, distributed fashion.

5 0
2 years ago
"You are working on a Debian distribution of Linux. You need to install a package, but you do not want to manually install all t
Stella [2.4K]

Answer:

apt-get

Explanation:

apt-get can be used to manually install a package, without need to manually install all the dependencies for the package.

7 0
3 years ago
Other questions:
  • True or false?
    5·1 answer
  • A major difference between digital librarians and traditional librarians is that traditional librarians rarely work with people.
    15·2 answers
  • Develop a list of privacy protection features that should be present if a website is serious about protecting privacy. Then, vis
    8·1 answer
  • I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
    12·1 answer
  • I made Pico with a Ray Gun (Next is Dad/Tankman)<br><br> Opinons?
    11·2 answers
  • Write a method that returns a String that is just the first and last character of the given string Your return value should be o
    8·1 answer
  • State five differences between Dos and Windows.​
    14·1 answer
  • Explain why this scenario could put an organization in jeopardy of losing some of its workforce.
    12·1 answer
  • Figure out what this says:<br><br> ?driew tib a kool ti seoD
    7·1 answer
  • T/F static development is the process of constructing the programs and code modules that serve as the building blocks of the inf
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!