When the number of records in a recordset is unknown, which control statement should a developer use to implement a set of code that executes for every record in the recordset, without performing a .size() or .length() method call? correct answers FOR (VARIABLE : LIST_OR_SET) { ... }
List or se...
When the number of records in a recordset is unknown, which control statement should
a developer use to implement a set of code that executes for every record in the
recordset, without performing a .size() or .length() method call? correct answers FOR
(VARIABLE : LIST_OR_SET) { ... }
List or set iteration for loops do not need the size of the collection to run.
What is the value of x after the code segment executes?
String x = 'A';
Integer i = 10;
if ( i < 15 ){
i = 15; x = 'B';
} else if ( i < 20 ){
x = 'C';
} else {
x = 'D';
} correct answers B
These if statements are evaluating the value of i. Since i is equal to 10 then i is less
than 15 and i will be reassigned the value 15 and x will be equal to 'B'. Once the values
are assigned the if statement is no longer run.
TRUE or FALSE: Say if below is an accurate statement about variable scope.
A VARIABLE CAN BE DEFINED AT ANY POINT IN A BLOCK. correct answers TRUE
A variable is valid from the point where it is declared inside of the code.
TRUE or FALSE: Say if below is an accurate statement about variable scope.
TRUE or FALSE: Say if below is an accurate statement about variable scope.
PARALLEL BLOCKS CAN USE THE SAME VARIABLE NAME. correct answers TRUE
TRUE or FALSE: Say if below is an accurate statement about variable scope.
SUB-BLOCKS CAN REUSE A PARENT BLOCK'S VARIABLE NAME IF ITS VALUE IS
NULL. correct answers FALSE
,TRUE or FALSE: Say if below is an accurate statement about variable scope.
A STATIC VARIABLE CAN RESTRICT THE SCOPE TO THE CURRENT BLOCK IF
ITS VALUE IS NULL. correct answers FALSE
Which two users can edit a record after it has been locked for approval? correct
answers An administrator and a user who is assigned as the current approver
What happens to changes in the result when a Visualforce page calls an Apex
controller, which calls another Apex class, and then hits a governor limit? correct
answers Any changes up to the error are rolled back
A developer in a Salesforce org with 100 accounts executes the following code using
the Developer Console.
Account myAccount = new Account(Name='MyAccount');
insert myAccount;
for (Integer x = 0; x < 150; x++){
Account newAccount = new Account(Name='MyAccount' + x);
try{
insert newAccount;
}catch (Exception ex){
System.Debug(ex);
}
}
insert new Account(Name='MyAccount');
How many accounts are in the org after this code is run? correct answers 100
Salesforce has a governor limit of 150 DML statements per transaction. The Salesforce
org originally starts with 100 accounts. The first DML statement inserts the first account
leaving 149 DML statements available. Inside the for loop it tries to make 150 DML
statements. But the limit is reached when x = 149. When this happens the transaction
aborts and all data changes are rolled back. The only thing that is left is the original 100
accounts. Since the error happened the last insert statement is never reached. Best
practice is to avoid DML statements inside for loops.
TRUE or FALSE: Should developers avoid using the statement below inside procedural
loops?
LIST CONTACTS = [SELECT ID, SALUTATION, FIRSTNAME, LASTNAME, EMAIL
FROM CONTACT WHERE ACCOUNTID = :A.ID]; correct answers TRUE
Avoid using SOQL in loops since there is a governor limit that enforces a maximum
number of SOQL queries. When these operations are placed inside a loop, database
operations are invoked once per iteration of the loop making it very easy to reach these
, governor limits. Best practice is to query once to obtain all results, and then iterate over
the results.
TRUE or FALSE: Should developers avoid using the statement below inside procedural
loops?
UPDATE CONTACTLIST; correct answers TRUE
Avoid using DML in loops since there is a governor limit that enforces a maximum
number of DML statements. When these operations are placed inside a loop, database
operations are invoked once per iteration of the loop making it very easy to reach these
governor limits.
TRUE or FALSE: Should developers avoid using the statement below inside procedural
loops?
SYSTEM.DEBUG('AMOUNT OF CPU TIME (IN MS) USED SO FAR: ' +
LIMITS.GETCPUTIME()); correct answers FALSE
System.debug is a great way to test the output especially in loops.
TRUE or FALSE: Should developers avoid using the statement below inside procedural
loops?
IF (O.ACCOUNTID == A.ID) correct answers FALSE
An if statement can be used inside of a loop to create a condition.
Which data structure is returned to a developer when performing a SOSL search?
correct answers A list of lists of sObjects
A developer runs the following anonymous code block.
Alle Vorteile der Zusammenfassungen von Stuvia auf einen Blick:
Garantiert gute Qualität durch Reviews
Stuvia Verkäufer haben mehr als 700.000 Zusammenfassungen beurteilt. Deshalb weißt du dass du das beste Dokument kaufst.
Schnell und einfach kaufen
Man bezahlt schnell und einfach mit iDeal, Kreditkarte oder Stuvia-Kredit für die Zusammenfassungen. Man braucht keine Mitgliedschaft.
Konzentration auf den Kern der Sache
Deine Mitstudenten schreiben die Zusammenfassungen. Deshalb enthalten die Zusammenfassungen immer aktuelle, zuverlässige und up-to-date Informationen. Damit kommst du schnell zum Kern der Sache.
Häufig gestellte Fragen
Was bekomme ich, wenn ich dieses Dokument kaufe?
Du erhältst eine PDF-Datei, die sofort nach dem Kauf verfügbar ist. Das gekaufte Dokument ist jederzeit, überall und unbegrenzt über dein Profil zugänglich.
Zufriedenheitsgarantie: Wie funktioniert das?
Unsere Zufriedenheitsgarantie sorgt dafür, dass du immer eine Lernunterlage findest, die zu dir passt. Du füllst ein Formular aus und unser Kundendienstteam kümmert sich um den Rest.
Wem kaufe ich diese Zusammenfassung ab?
Stuvia ist ein Marktplatz, du kaufst dieses Dokument also nicht von uns, sondern vom Verkäufer HopeJewels. Stuvia erleichtert die Zahlung an den Verkäufer.
Werde ich an ein Abonnement gebunden sein?
Nein, du kaufst diese Zusammenfassung nur für 12,71 €. Du bist nach deinem Kauf an nichts gebunden.