exam questions

Exam FC0-U61 All Questions

View all questions & answers for the FC0-U61 exam

Exam FC0-U61 topic 1 question 160 discussion

Actual exam question from CompTIA's FC0-U61
Question #: 160
Topic #: 1
[All FC0-U61 Questions]

A developer is troubleshooting code in an application. The code is supposed to return the word `vegetables` if the category id is only 2. However, the code is returning vegetables for all values except category id 1. Which of the following code statements would BEST correct the issue?

  • A. If category id = 1 then 'Fruit' Else 'Vegetables'
  • B. If category id = 1 then 'Fruit' Else if category id = 2 then 'Vegetables' Else 'Candy'
  • C. If category id <> 1 then 'Vegetables' Else 'Fruit'
  • D. If category id = 1 then 'Fruit' Else if category id >= 2 then 'Vegetables' Else 'Candy'
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
Esty8586
8 months ago
ONLY IS KEY WORD
upvoted 1 times
...
[Removed]
1 year, 7 months ago
Only the value = 2 will give the correct results
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