SOQL & SOSL Flashcards

1
Q

SOQL statement results can evaluate to which of the following data types:

choose 3:

A. Single SObject
B. String
C. Integer
D. List of SObjects

A

A. Single SObject
C. Integer
D. List of SObjects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When can SOQL return an Integer?

A

if a Count method is used

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does this DML statement do?
List accs;
insert accs;

A

Inserts accounts. No records will be committed to the database if any of them throws an exception.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does this DML statement do?
List accs;
Database.insert(accs);

A

Inserts accounts. No records will be committed to the database if any of them throws an exception.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does this DML statement do?
List accs;
Database.insert(accs, true);

A

Inserts accounts. No records will be committed to the database if any of them throws an exception. The second parameter in Database.insert is a Boolean that means “all or none?”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does this DML statement do?
List accs;
Database.insert(accs, false);

A

Inserts accounts. Only the good records will be inserted. The second parameter in Database.insert is a Boolean that means “all or none?”

You’ll get a list back of all the good records in Database.SaveResult

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A developer has written the following code to do a SOSL search

FIND {New York}

What will be returned?

A. A list of Contacts that match the search term
B. A map of Accounts or Contacts that match the search term
C. A map of sObjects that match the search term
D. A list of lists of sObjects and their records that match the search term

A

D. A list of lists of sObjects and their records that match the search term

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How would a developer write a query to return the number of leads for each lead source?

A. SELECT LeadSource, COUNT(Name) FROM Lead GROUP BY Leadsource
B. SELECT COUNT(LeadSource) FROM Lead
C. SELECT GROUP(LeadSource) FROM Lead
D. SELECT Count(*) FROM Lead GROUP BY LeadSource

A

A. SELECT LeadSource, COUNT(Name) FROM Lead GROUP BY Leadsource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly