Question

Which of the following is true? (A) A method cannot change the value of a primitive...

Which of the following is true?

(A) A method cannot change the value of a primitive type that's passed to it

(B) A method can change the data in a reference type that's passed to it

(C) A method can directly manipulate the instance variables without passing around

(D) All of the above

Homework Answers

Answer #1

Solution:-

D) All of the above

Explanation:-

When we pass primitive value to method the manipulation done by method does not effect the original variable. Here we just pass value of variable not variable.

But in case when we pass reference of variable to method the manipulation done by variable will effect the value of original variable

If we want to manipulation instance variable via method we can directly use that variable without pass it to calling method.

Hence All of the above options are correct

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Java passes arguments by value. Which of the following correctly describes how variables are passed to...
Java passes arguments by value. Which of the following correctly describes how variables are passed to a method? Select one: Both primitive and object types are passed by the value that they refer to in memory. Primitive types are passed by reference while object types are passed by values stored at the object location in the memory. A variable is passed to a method and its value will no longer exist within the scope of where the method was originally...
In the following C code, Which variable if NOT of primitive data type? A. a B....
In the following C code, Which variable if NOT of primitive data type? A. a B. b C. c D. d int a = 10; double b = 20.0; float c = false; char d[5] = "Hello"; // here we define a string In programming language C, the implementation of a string data type is limited dynamic length, which means the length of a string variable is fixed once it has been defined. A. True B. False In C# programming...
Which of the following statements is TRUE? A. A monopoly cannot set price and quantity such...
Which of the following statements is TRUE? A. A monopoly cannot set price and quantity such that the point lies above the demand curve. B. A monopoly can charge whatever it wants. C. Profit maximization occurs by setting price first. D. Both A monopoly cannot set price and quantity such that the point lies above the demand curve and A monopoly can charge whatever it wants. I answered D, but was told it was incorrect.
Which of the following is true ? a. A stable historic channel can sometimes be used...
Which of the following is true ? a. A stable historic channel can sometimes be used as a reference reach to obtain estimates for the dependent design variables of channel width and planform. b. An existing pristine or pre-settlement reach may also be used as an analog or reference reach. c. In practice, several references reaches with relatively similar channel-forming discharges may be used to develop a range of solutions using regression equations d. Only a and c is true...
      1. Which of the following is true ? A)        semaphores are usually implemented using locks...
      1. Which of the following is true ? A)        semaphores are usually implemented using locks B)        condition variables are associated with monitors C)        both of the above D)        neither of the above        2. The problem with locks is that A)        all processes need to know the key B)        they’re not applicable to more than two processes C)        they use busy-waiting D)        all of the above         3. We can prevent deadlock from occurring by ensuring that the __________...
2. Consider the following program written in C syntax: void swap(int a, int b) {   ...
2. Consider the following program written in C syntax: void swap(int a, int b) {    int temp;    temp = a;    a = b;    b = temp; } void main() {    int value = 2, list[5] = {1, 3, 5, 7, 9};    swap(value, list[0]);    swap(list[0], list[1]);    swap(value, list[value]); } For each of the following parameter-passing methods, what are all of the values of the variables value and list after each of the three...
Which of the following is NOT true of hashes? a. You cannot reverse engineer a hash...
Which of the following is NOT true of hashes? a. You cannot reverse engineer a hash to derive the input data b. It uses a fixed size string, so even if a hard drive is hashed, the hash will be the same number of bits as just a hashed text file. c. Its primary security service is confidentiality d. You cannot decrypt a hash
The following is for a Java Program Create UML Class Diagram for these 4 java classes....
The following is for a Java Program Create UML Class Diagram for these 4 java classes. The diagram should include: 1) All instance variables, including type and access specifier (+, -); 2) All methods, including parameter list, return type and access specifier (+, -); 3) Include Generalization and Aggregation where appropriate. Java Classes description: 1. User Class 1.1 Subclass of Account class. 1.2 Instance variables __ 1.2.1 username – String __ 1.2.2 fullName – String __ 1.2.3 deptCode – int...
Q1. Which of the following statements regarding Critical Path Method (CPM) networks is true? A) There...
Q1. Which of the following statements regarding Critical Path Method (CPM) networks is true? A) There can be multiple critical paths on the same project, all with different durations. B) The early finish of an activity is the latest early start of all preceding activities. C) The late start of an activity is its late finish plus its duration. D) If a specific project has multiple critical paths, all of them will not have the same duration. E) B) and...
Which of the following conditions must be true so that a firm can price discriminate? A....
Which of the following conditions must be true so that a firm can price discriminate? A. There are no other firms in the market. B. The good is a non-durable. C. The good cannot be easily resold. D. All of the above must be true.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT