exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 18 discussion

Actual exam question from Oracle's 1z0-819
Question #: 18
Topic #: 1
[All 1z0-819 Questions]

Given:

Which two lines of code when inserted in line 1 correctly modifies instance variables? (Choose two.)

  • A. cCount = setCCount(c);
  • B. setCCount(c) = cCount;
  • C. setGCount(g);
  • D. tCount = tCount;
  • E. aCount = a;
Show Suggested Answer Hide Answer
Suggested Answer: CE 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Samps
1 year, 1 month ago
ACE is correct
upvoted 2 times
...
d7bb0b2
1 year, 1 month ago
A. cCount = setCCount(c); C. setGCount(g); E. aCount = a; have 3 correct answers
upvoted 1 times
...
[Removed]
1 year, 4 months ago
Selected Answer: CE
Correct answer should be A, C and E. If you would take into account that the return-statement in method setCCount is misspelled, then the code would not compile and that answer is not an option. If you can only choose two then it should be C and E but in that case the code would not work at all.
upvoted 1 times
...
Stavok
1 year, 8 months ago
Selected Answer: CE
A is incorrect because -The method setCCount(int) is undefined for the type B is incorrect because - The left-hand side of an assignment must be a variable D is incorrect because - The assignment to variable tCount has no effect... C& E Are correct answers
upvoted 2 times
...
RoxyFoxy
1 year, 8 months ago
Selected Answer: AE
public class DNASynth { int aCount; int tCount; int cCount; int gCount; DNASynth(int a, int tCount, int c, int g){ cCount = setCCount(c); aCount = a; setGCount(g); } int setCCount(int c){ return c; } void setGCount(int gCount){ this.gCount = gCount; } public static void main(String[] args) { DNASynth pop = new DNASynth(1,2,3,4); System.out.println(pop.aCount+" "+pop.cCount+" "+pop.gCount); // 1 3 4 } } The correct answers: A C E
upvoted 3 times
...
Mukes877
1 year, 8 months ago
Selected Answer: AC
ACE are correct
upvoted 3 times
...
SuperDabicho
1 year, 9 months ago
Selected Answer: CE
A is not correct because it has "retutn". B is not correct because setC returns an int and it doesn't set anything. D is not correct because both refer to the parameter variable, not the class variable.
upvoted 4 times
yokito
6 months ago
but if A is wrong because of retutn this answer maybe should be "compile error"?
upvoted 1 times
...
...
Ankit1010
1 year, 12 months ago
A, C, E are the correct answers.
upvoted 4 times
...
RP384
2 years ago
Selected Answer: AC
A, C and E are valid answers
upvoted 3 times
...
UcefSoft
2 years, 2 months ago
C. setGCount(g); also
upvoted 1 times
...
UcefSoft
2 years, 2 months ago
SetGcount also
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago