nerdexam
Salesforce

PDI · Question #225

Which statement generates a list of Leads and Contacts that have a field with the phrase 'ACME'?

The correct answer is B. List<List <sObject>> searchList = [FIND '*ACME*" IN ALL FIELDS RETURNING Contact, Lead]. This question asks for an Apex statement that performs a full-text search across multiple Salesforce objects (Leads and Contacts) for a specific phrase.

Submitted by klara.se· Apr 18, 2026Salesforce Fundamentals

Question

Which statement generates a list of Leads and Contacts that have a field with the phrase 'ACME'?

Options

  • AList<List <sObject>> searchList = [SELECT Name, ID FROM Contact, Lead WHERE Name like
  • BList<List <sObject>> searchList = [FIND 'ACME" IN ALL FIELDS RETURNING Contact, Lead];
  • CMap <sObject> searchList = [FIND 'ACME' IN ALL FIELDS RETURNING Contact, Lead];
  • DList <sObject> searchList = [FIND 'ACME' IN ALL FIELDS RETURNING Contact, Lead];

How the community answered

(52 responses)
  • A
    2% (1)
  • B
    90% (47)
  • C
    2% (1)
  • D
    6% (3)

Why each option

This question asks for an Apex statement that performs a full-text search across multiple Salesforce objects (Leads and Contacts) for a specific phrase.

AList<List <sObject>> searchList = [SELECT Name, ID FROM Contact, Lead WHERE Name like

This is an invalid SOQL query syntax; SOQL cannot query multiple unrelated objects in a single `FROM` clause like this, nor is it designed for full-text searches across all fields.

BList<List <sObject>> searchList = [FIND '*ACME*" IN ALL FIELDS RETURNING Contact, Lead];Correct

The `FIND '*ACME*' IN ALL FIELDS RETURNING Contact, Lead` statement uses Salesforce Object Search Language (SOSL), which is specifically designed for full-text searches across multiple objects and their fields. The `RETURNING` clause specifies the objects to include in the search, and the result type `List<List<sObject>>` is appropriate for multi-object SOSL queries.

CMap <sObject> searchList = [FIND '*ACME*' IN ALL FIELDS RETURNING Contact, Lead];

While using SOSL is correct for the search, the return type for a multi-object SOSL query is `List<List<sObject>>`, not `Map<sObject>`.

DList <sObject> searchList = [FIND '*ACME*' IN ALL FIELDS RETURNING Contact, Lead];

While using SOSL is correct for the search, the return type for a multi-object SOSL query is `List<List<sObject>>`, not a flat `List<sObject>`.

Concept tested: SOSL syntax for multi-object search

Source: https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl.htm

Topics

#SOSL#Apex Query Language#Data Retrieval#Search

Community Discussion

No community discussion yet for this question.

Full PDI Practice