exam questions

Exam 1z0-829 All Questions

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

Exam 1z0-829 topic 1 question 40 discussion

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

Which two code fragments compile? (Choose two.)

  • A.
  • B.
  • C.
  • D.
  • E.
  • F.
Show Suggested Answer Hide Answer
Suggested Answer: AE 🗳️

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
SrinivasJasti
2 weeks, 1 day ago
Selected Answer: AE
B---> initialized as Int but assigned string,C &F --> cannot assign null as var looks for typed initialization, D --> var should be used as local or inside methods
upvoted 1 times
SrinivasJasti
2 weeks, 1 day ago
F --> var x already defined in the scope
upvoted 1 times
...
...
xplorerpj
6 months, 3 weeks ago
A & E are correct. B cannot compile because var a is initialized as integer and then a string value is assigned. C cannot compile because var cannot be initialized to null. D - Doesn't have main() F - Variable x already defined in scope
upvoted 1 times
...
supersquax
11 months, 2 weeks ago
A and E correct. C D F all wrong cuz they're missing a "public static void main(String[] args)" method B wrong cuz "var a = 10" means "a" is an "int". trying to assign a string to "a" on the next line is invalid.
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