subject

This code fragment uses arrays in java. the first line declares and allocates an array of two integers. the next two lines initialize it. (java arrays are indexed starting from 0.)

int[] a = new int[2];

a[0] = 0; a[1] = 2;

f(a[0], a[a[0]});

function f is defined as:

void f(int x, int y) {

x=1;

y=3;

}

for each of the following parameter-passing methods, say what the final values in the array a would be, after the call to f. (there may be more than one correct answer)

a. by value.

b. by reference.

c. by value-result.

d. by macro expansion.

e. by name.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:00
Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. after the loop terminates, it prints out, on a line by itself and separated by spaces, the sum of all the even integers read, the sum of all the odd integers read, a count of the number of even integers read, and a count of the number of odd integers read, all separated by at least one space. declare any variables that are needed. assume the availability of a variable, stdin, that references a scanner object associated with standard input. that is, stdin = new scanner(system.in); is given.
Answers: 3
question
Computers and Technology, 22.06.2019 22:50
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
question
Computers and Technology, 23.06.2019 08:00
The managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an .
Answers: 3
question
Computers and Technology, 24.06.2019 05:30
Cómo pongo un tomo de llamada sin pagar?
Answers: 1
You know the right answer?
This code fragment uses arrays in java. the first line declares and allocates an array of two intege...
Questions
question
English, 04.10.2021 14:00
question
Biology, 04.10.2021 14:00
question
History, 04.10.2021 14:00
question
Mathematics, 04.10.2021 14:00
Questions on the website: 13722361