exam questions

Exam CRT-450 All Questions

View all questions & answers for the CRT-450 exam

Exam CRT-450 topic 1 question 98 discussion

Actual exam question from Salesforce's CRT-450
Question #: 98
Topic #: 1
[All CRT-450 Questions]

The Account object has a custom Percent field, Rating, defined with a length of 2 with 0 decimal places. An Account record has the value of 50% in its Rating field and is processed in the Apex code below after being retrieved from the database with SOQL.

What is the value of acctScore after this code executes?

  • A. 5
  • B. 50
  • C. 500
  • D. 5000
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
questmajor
Highly Voted 2 years, 11 months ago
Correct. Percentage in apex is translated as numbers, so 50% is 50 in apex
upvoted 7 times
...
R11112
Most Recent 1 month, 3 weeks ago
Selected Answer: D
It explicitly said the object is with length 2 and 0 decimal places. So the custom object is between 0-99. So it's 50. And then the acctScore is custom object * 100. Therefore it will be 5000 in this case.
upvoted 1 times
...
Ke_James0302
3 months, 1 week ago
Selected Answer: D
D Correct
upvoted 1 times
...
Tristelo
11 months, 3 weeks ago
Selected Answer: D
I tried this on an opp with a percent field of 100%. Result was 10000. Opportunity opp = [SELECT Id, Probability FROM Opportunity WHERE Id='[INSERT ID HERE]' LIMIT 1]; Decimal result = opp.Probability * 100; System.debug(result);
upvoted 3 times
...
Nikospa11
1 year ago
Selected Answer: D
D 100%. I tested it
upvoted 1 times
...
briccoli11
1 year, 7 months ago
Selected Answer: B
Percents are also their own data type—a number with a percent sign attached. A Percent is stored as a number divided by 100, meaning that 100% is represented as 1, 90% as 0.9, and so on. Source: https://trailhead.salesforce.com/content/learn/modules/advanced_formulas/numbers_formulas
upvoted 2 times
...
BaptisteBerard
1 year, 7 months ago
Can we get a source for the answer D?
upvoted 1 times
...
smoota
2 years ago
Selected Answer: B
https://trailhead.salesforce.com/content/learn/modules/advanced_formulas/numbers_formulas Percents are also their own data type—a number with a percent sign attached. A Percent is stored as a number divided by 100, meaning that 100% is represented as 1, 90% as 0.9, and so on.
upvoted 2 times
KAALISHAN
2 years ago
Not right, answer is D. When a percentage field is retrieved, it retrieves just the number part. So 50% will show as 50, which when multiplied by 100 will be 5000.
upvoted 5 times
...
Nand072
1 year, 5 months ago
This is wrong because in Formula, it behaves like an actual percentage but in Apex, it behave like a number, without the "%"
upvoted 3 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