Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam CRT-450 All Questions

View all questions & answers for the CRT-450 exam

Exam CRT-450 topic 1 question 3 discussion

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

A method is passed a list of generic sObjects as a parameter.
What should the developer do to determine which object type (Account, Lead, or Contact, for example) to cast each sObject?

  • A. Use the first three characters of the sObject ID to determine the sObject type.
  • B. Use the getSObjectType method on each generic sObject to retrieve the sObject token.
  • C. Use the getSObjectName method on the sObject class to get the sObject name.
  • D. Use a try-catch construct to cast the sObject into one of the three sObject types.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
tapasroy
Highly Voted 2 years, 7 months ago
Selected Answer: B
B seems correct
upvoted 8 times
...
TDB97
Most Recent 5 months ago
Selected Answer: A
A would be correct when also used with a query to the object EntityDefinition where all KeyPrefix are saved.
upvoted 1 times
TDB97
5 months ago
getSObjectType returns the object token, which also then has to be mapped to a name, so both are correct but can not be used without further modification.
upvoted 1 times
...
...
jagatpsingh
12 months ago
B Perfectly correct
upvoted 1 times
...
BeatrizBernardo
1 year, 5 months ago
Selected Answer: B
Account acc = new Account(name = 'Acme', description = 'Acme Account'); Schema.SObjectType expected = Schema.Account.getSObjectType(); System.assertEquals(expected, acc.getSObjectType()); System.debug('expected: ' + expected); System.debug('acc.getSObjectType(): ' + acc.getSObjectType()); try to reply on Developer Console;
upvoted 2 times
...
JustMe99
1 year, 6 months ago
Selected Answer: A
Don't believe B is available for all objects
upvoted 1 times
...
nibbler
1 year, 6 months ago
Selected Answer: A
its A
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 ...