Courseiva

Salesforce Certified Platform Developer I (SALESFORCE-PD1) (SALESFORCE-PD1) — Questions 175

493 questions total · 7pages · All types, answers revealed

Page 1 of 7

Page 2
1
MCQhard

A developer implements a Queueable class that makes an external REST callout. The developer needs to test this class using Test.startTest() and Test.stopTest(). What is required for the callout to succeed in the test method?

A.Set the remote site setting active in the test context.
B.Implement the HttpCalloutMock interface and assign it using Test.setMock()
C.Use the Database.AllowsCallouts interface on the test class.
D.Wrap the callout in a try-catch block to bypass test restrictions.
AnswerB

Salesforce requires callouts in tests to be mocked using Test.setMock().

Why this answer

Callouts are not allowed in test methods unless mocked. The test must implement the HttpCalloutMock interface to simulate the response.

2
MCQeasy

A developer is writing a Visualforce page and wants to include standard Salesforce styling and icons. What tag should be added to the top of the Visualforce page?

A.<apex:lightningStyleguide />
B.<apex:stylesheet value="{!$Resource.SLDS}" />
C.<apex:includeLightning />
D.<apex:slds />
AnswerD

Correct because <apex:slds /> includes SLDS resources in Visualforce.

Why this answer

<apex:slds /> includes the Salesforce Lightning Design System styles and assets in a Visualforce page.

3
MCQmedium

What must be true for a developer to deploy Apex code to a production environment?

A.The code must have 100% test coverage
B.Tests do not need to be run if the code was tested in sandbox
C.Only the new classes require coverage
D.All tests must pass and coverage must be at least 75%
AnswerD

This is the mandatory requirement for production deployments.

Why this answer

The code must have at least 75% coverage and all tests must pass.

4
Multi-Selectmedium

Which TWO criteria help a developer decide between using a Record-Triggered Flow and an Apex Trigger? (Choose two.)

Select 2 answers
A.Apex Triggers cannot be deactivated without deploying code changes.
B.Record-Triggered Flows provide declarative maintenance and faster build times for standard business logic.
C.Record-Triggered Flows cannot run asynchronously.
D.Flows cannot execute before-save updates.
E.Apex Triggers are required when implementing complex recursive controls across multiple objects and external web service integrations.
AnswersB, E

Correct. Flows offer powerful declarative capabilities.

Why this answer

Flow vs Apex decisions often depend on declarative preference, complexity, skill set, and architectural needs.

5
Multi-Selectmedium

Which TWO statements are true about the Apex order of execution?

Select 2 answers
A.Before-save triggers run before validation rules
B.Validation rules run before before-save triggers
C.Record-triggered flows run after validation rules
D.After-save triggers run before system validation
E.Email alerts are sent before after-save triggers
AnswersA, C

Before-save triggers are among the first items to execute.

Why this answer

Before triggers and validation rules occur before the record is saved to the database.

6
MCQmedium

A developer is writing a Batch Apex class to update 50,000 records. Which method must be implemented to define the scope of records to be processed?

A.initialize
B.execute
C.finish
D.start
AnswerD

The start method provides the record set to the batch job.

Why this answer

The start method in the Database.Batchable interface returns a QueryLocator or Iterable to define the records.

7
MCQmedium

When evaluating whether to use Flow Builder or an Apex trigger for record automation, which scenario best justifies choosing an Apex trigger over a Record-Triggered Flow?

A.Sending a simple email alert when a Case status changes.
B.Executing custom callouts and complex recursive logic across multiple related parent and child objects in bulk.
C.Displaying a custom validation error message on a field.
D.Updating a field on the same record before it is saved.
AnswerB

Correct. Complex multi-object transactions and asynchronous queuing are well-suited for Apex triggers.

Why this answer

Apex triggers are recommended over flows when handling complex multi-object transactional logic, callouts, or heavy bulk operations where performance and fine-grained control are paramount.

8
MCQeasy

Which lifecycle hook in a Lightning Web Component is called after every render of the component?

A.constructor
B.connectedCallback
C.errorCallback
D.renderedCallback
AnswerD

Called after every render of the component.

Why this answer

renderedCallback() is called after every render of the component, useful for DOM manipulation after rendering.

9
MCQeasy

A developer wants to retrieve the developer name of the current user's profile in Apex. Which object relationship should be queried via SOQL?

A.SELECT Name FROM Profile WHERE UserId = :UserInfo.getUserId()
B.SELECT Profile.Name FROM User WHERE Id = :UserInfo.getUserId()
C.SELECT ProfileId.Name FROM User WHERE Id = :UserInfo.getUserId()
D.SELECT ProfileName FROM User WHERE Id = :UserInfo.getUserId()
AnswerB

User records contain a Profile relationship, allowing traversal to the Profile Name field.

Why this answer

The User object relates to the Profile object through the ProfileId foreign key field.

10
MCQeasy

What is the primary purpose of the Model-View-Controller (MVC) design pattern implementation in Lightning Web Components (LWC)?

A.To convert Apex triggers into asynchronous jobs
B.To bypass Salesforce governor limits automatically
C.To separate data, user interface, and application logic into distinct components
D.To enforce field-level security without writing code
AnswerC

The MVC pattern isolates business logic from user interface presentation and data storage.

Why this answer

MVC separates application data (Model), user interface (View), and business logic/event handling (Controller) to promote modularity and maintainability.

11
MCQmedium

An LWC component uses a wire adapter to fetch account records. The developer needs to update the parameters passed to the wire adapter dynamically based on user input. How should this be implemented?

A.Call the wire adapter imperatively inside a JavaScript function.
B.Mark the property as @track and reference it in a reactive wire property or function.
C.Use standard hidden HTML inputs to store state.
D.Reload the entire browser page using window.location.reload().
AnswerB

Reactive properties in wire arguments cause the wire to re-provision data when changed.

Why this answer

Using a getter property or tracked reactive property referenced in a @wire decorator allows dynamic parameter updates.

12
MCQeasy

A developer needs to invoke an asynchronous method from a standard synchronous Apex trigger. The asynchronous method must be annotated with which keyword?

A.@AuraEnabled
B.@future
C.@InvocableMethod
D.@testVisible
AnswerB

The @future annotation designates a method to execute asynchronously when resources are available.

Why this answer

Methods intended to run asynchronously outside the current request must be annotated with @future.

13
MCQmedium

A developer wants to test an asynchronous future method. Where must the developer place the asynchronous code execution so that it runs synchronously and within the test context?

A.Inside a System.runAs() block
B.Within a try-catch block
C.Inside a Database.executeBatch block
D.Between Test.startTest() and Test.stopTest()
AnswerD

Placing code between startTest and stopTest resets governor limits and forces async processing to complete.

Why this answer

Test.startTest() and Test.stopTest() bracket the code block where asynchronous processes like future methods, batch jobs, and queueables are forced to execute synchronously.

14
MCQeasy

A developer needs to schedule a class to run nightly at midnight to clean up stale audit records. Which interface must the class implement?

A.System.Schedulable
B.Database.AllowsCallouts
C.Queueable
D.Database.Batchable<SObject>
AnswerA

Schedulable is the required interface for scheduling Apex jobs.

Why this answer

To use Schedulable Apex, the class must implement the Schedulable interface, which contains the execute(SchedulableContext SC) method.

15
Multi-Selecthard

Which THREE techniques help prevent hitting governor limits when writing SOQL queries in Apex? Choose 3 answers.

Select 3 answers
A.Omitting LIMIT clauses on large queries to ensure all records are fetched at once.
B.Filtering queries using indexed fields (such as Id, Name, or external IDs) where possible.
C.Querying records into lists rather than single sObject variables when multiple records match.
D.Using bind variables to pass collection criteria into SOQL WHERE clauses.
E.Placing SOQL queries inside helper methods called within loops.
AnswersB, C, D

Using indexed fields improves query performance and reduces CPU overhead.

Why this answer

Best practices include querying into collections, using bind variables, and filtering with indexed fields.

16
MCQmedium

A developer needs to pass a custom SObject record with related child lists into an asynchronous execution context. Which asynchronous Apex feature supports passing non-primitive types such as custom Apex objects or sObject collections?

A.Scheduled Apex
B.Future methods
C.Queueable Apex
D.Trigger asynchronous execution blocks
AnswerC

Queueable Apex supports complex data types, including sObjects and custom Apex classes.

Why this answer

Queueable Apex supports member variables of non-primitive types, including sObjects and custom classes.

17
MCQeasy

A developer is building a Lightning Web Component and wants to define a property that can be set by a parent component. Which decorator is required?

A.@track
B.@api
C.@auraEnabled
D.@wire
AnswerB

Correct because @api exposes public properties to parent components.

Why this answer

The @api decorator exposes a public property or method, making it accessible to parent components.

18
Multi-Selecteasy

Which THREE statements are true regarding the standard Salesforce Lightning Design System (SLDS)? Choose 3 answers.

Select 3 answers
A.SLDS relies on external third-party UI frameworks like Bootstrap for grid styling.
B.SLDS is automatically included in Lightning experience pages to maintain a consistent UI.
C.SLDS classes can be used in Lightning Web Components, Aura components, and Visualforce pages.
D.SLDS provides a design token system that allows customization using styling hooks.
E.Developers must manually upload all SLDS CSS and image files as static resources for every project.
AnswersB, C, D

Correct. The platform automatically includes SLDS styling context for Lightning components.

Why this answer

SLDS is built into the Salesforce platform, provides CSS framework styling matching the Salesforce look-and-feel, and can be used in both LWC and Visualforce.

19
MCQhard

Which of the following describes the behavior of a static variable in Apex?

A.It is stored in the database
B.It is reset for each trigger event
C.It is shared across all users
D.It persists for the duration of the transaction
AnswerD

Static variables maintain state until the transaction finishes.

Why this answer

Static variables are scoped to the transaction and persist across the entire trigger execution.

20
MCQmedium

Which type of Apex class is best suited for performing complex calculations on large data sets that must run overnight?

A.Batch Apex
B.Future method
C.Queueable Apex
D.Controller extension
AnswerA

Batch Apex manages large volumes effectively.

Why this answer

Batch Apex is specifically designed for processing large data sets in chunks over time.

21
MCQeasy

A developer is writing a Visualforce page and wants to display messages generated by controllers or validation rules. Which component should be used?

A.<apex:pageMessages />
B.<apex:errorMessages />
C.<apex:outputPanel type="messages" />
D.<apex:messageLog />
AnswerA

Correct because <apex:pageMessages> renders system and custom error messages.

Why this answer

<apex:pageMessages /> displays all messages queued on the page for the current request.

22
MCQmedium

In the order of execution, when are custom validation rules evaluated relative to Before Triggers?

A.After After Triggers
B.Before Before Triggers
C.Concurrently with After Triggers
D.After Before Triggers
AnswerD

Custom validation rules execute after the execution of Before Triggers.

Why this answer

Custom validation rules are evaluated after Before Triggers complete.

23
MCQmedium

A developer needs to access private methods in an Apex class for unit testing without making them public. Which annotation is the most appropriate?

A.@RemoteAction
B.@isTest
C.@TestVisible
D.@ReadOnly
AnswerC

This allows test methods to access the private or protected members of a class.

Why this answer

@TestVisible allows test classes to access private and protected members of a class.

24
MCQmedium

A developer is deploying metadata from a sandbox to a production org using Salesforce CLI. Which command should the developer use to validate the deployment without actually saving components to the target organization?

A.sf project retrieve start --validate
B.sf project deploy validate
C.sf org check deploy
D.sf project deploy start --dry-run
AnswerD

The --dry-run flag validates the deployment against the target org without making permanent changes.

Why this answer

The sf project deploy start command includes a dry-run or check-only validation flag. In modern Salesforce CLI (sf), it is --dry-run.

25
Multi-Selectmedium

Which TWO best practices should a developer follow when writing bulkified Apex triggers? (Choose TWO.)

Select 2 answers
A.Perform DML statements and SOQL queries outside of loops by utilizing collections.
B.Hardcode record IDs in trigger logic to route specific test accounts.
C.Use synchronous callouts directly inside before insert triggers.
D.Design code to process collections of records (Trigger.new) rather than single records.
E.Place SOQL queries inside loops to ensure every record gets fresh data.
AnswersA, D

Bulkifying queries and DML ensures governor limits are respected.

Why this answer

Bulkified triggers must operate on collections (Trigger.new) and avoid SOQL/DML inside loops.

26
Multi-Selecteasy

Which TWO statements are true regarding the differences between Aura components and Lightning Web Components (LWC)? (Choose TWO)

Select 2 answers
A.LWC components cannot contain HTML markup tags.
B.Aura components are required for all modern mobile app development while LWC is restricted to desktop only.
C.Lightning Web Components take advantage of native web standards built directly into modern browsers.
D.Aura components use standard Shadow DOM encapsulation without component-specific framework abstractions.
E.Lightning Web Components execute with better performance because they run on native browser engine features.
AnswersC, E

Correct because LWC leverages standard web components and modern ECMAScript.

Why this answer

LWC builds on native web standards and modern JS, whereas Aura relies on an older framework architecture.

27
Multi-Selecthard

Which THREE features or capabilities are supported by the Lightning Message Service (LMS)? Choose 3 answers.

Select 3 answers
A.Communication between unrelated components on the same Lightning page.
B.Communication between Visualforce pages and Lightning Web Components.
C.Communication across components in different browser tabs.
D.Communication between Aura components and Lightning Web Components.
E.Executing asynchronous server-side database updates automatically.
AnswersA, B, D

LMS enables publisher-subscriber pattern across the page.

Why this answer

LMS supports communication across DOM boundaries, between Visualforce, Aura, and LWC.

28
MCQhard

A developer is configuring a Lightning Web Component to be used as a Quick Action on a record page. Which target configuration must be added to the component's metadata file?

A.lightning__AppPage
B.lightning__RecordAction
C.lightning__RecordPage
D.lightning__Tab
AnswerB

Enables the component as a record quick action.

Why this answer

lightning__RecordAction enables a component to be used as a record-level quick action.

29
MCQmedium

A developer is building a Visualforce page and wants to execute an action method on the controller when a user clicks a button, without performing a full page reload. Which component should be wrapped around the area to be updated?

A.apex:pageBlock
B.apex:form
C.apex:outputPanel with rerender attribute
D.apex:actionFunction
AnswerC

Enables AJAX partial page rendering.

Why this answer

<apex:actionRegion> or <apex:outputPanel> with <apex:actionSupport> or <apex:commandButton rerender=...> performs partial page updates.

30
MCQhard

A developer is troubleshooting an issue where a Lightning Web Component is not picking up changes to the internal fields of an object property. What is the cause of this behavior in LWC reactivity?

A.Reactive properties must be declared as constants using const instead of let.
B.LWC reactivity is shallow, so nested object property mutations require creating a new object reference or using @track.
C.The component must be wrapped in an Aura container to enable deep object tracking.
D.LWC does not support objects as reactive properties under any circumstances.
AnswerB

Correct because LWC tracks changes at the reference level for plain objects unless observed via @track.

Why this answer

LWC reactivity is shallow; mutating properties of a nested object without reassigning the reference requires @track or creating a new object reference.

31
MCQeasy

Which context variable should be used in an after update trigger to compare old field values with new field values?

A.Trigger.operationType
B.Trigger.newMap and Trigger.oldMap
C.Trigger.size
D.Trigger.new and Trigger.old
AnswerB, D

Trigger.newMap and Trigger.oldMap allow direct ID-based comparison of old and new field values.

Why this answer

Trigger.oldMap combined with Trigger.newMap allows comparing old and new values by record ID.

32
Multi-Selecteasy

Which TWO tools or features are recommended for styling Lightning Web Components according to best practices? Choose 2 answers.

Select 2 answers
A.Global un-scoped CSS stylesheets loaded in every page
B.Component-scoped CSS style files (.css)
C.Salesforce Lightning Design System (SLDS) utility classes
D.Inline style tags in HTML templates
E.Bootstrap CSS framework via static resource
AnswersB, C

LWC automatically scopes CSS styles defined in a companion .css file.

Why this answer

SLDS utility classes and scoped CSS stylesheets are the standard ways to style LWC.

33
MCQeasy

A developer needs to execute logic before a record is saved to the database, with the ability to modify field values on the same record without issuing a DML statement. Which trigger event should be used?

A.Before Insert
B.After Insert
C.After Update
D.Before Undelete
AnswerA

Before insert triggers allow developers to modify field values directly on the Trigger.new records without DML.

Why this answer

Before triggers are specifically designed for updating or validating record fields prior to persistence without requiring an explicit DML statement.

34
MCQhard

In the Salesforce Order of Execution, when are validation rules evaluated relative to Apex triggers?

A.Before any Before triggers fire
B.Concurrently with After triggers
C.After Before triggers fire and before the record is saved to the database
D.After the record is committed to the database and After triggers complete
AnswerC

Validation rules run after all Before triggers have completed.

Why this answer

Validation rules are executed after the 'Before' triggers fire and before the record is saved to the database.

35
MCQeasy

A developer creates a Visualforce page and wants to include standard Salesforce styling. Which attribute on the <apex:page> tag enables this?

A.lightningStylesheets="true"
B.standardStylesheets="true"
C.applyHtmlTag="true"
D.sidebar="true"
AnswerB

Includs standard Salesforce styles on the page.

Why this answer

The standardStylesheets attribute controls whether standard Salesforce styling is applied.

36
MCQmedium

A developer needs to retrieve Account records along with their associated Contacts in a single query. Which query syntax is correct?

A.SELECT Id, Name, CONCAT(Contacts) FROM Account
B.SELECT Id, Name, (SELECT Id, LastName FROM Contact) FROM Account
C.SELECT Id, Name, Contacts__r FROM Account
D.SELECT Id, Name, (SELECT Id, LastName FROM Contacts) FROM Account
AnswerD

This is the correct syntax for a child subquery in SOQL.

Why this answer

Parent-to-child subqueries use plural child relationship names enclosed in parentheses inside the SELECT clause.

37
Multi-Selectmedium

A developer is working with component styling and design tokens in Lightning Web Components. Which TWO practices apply when working with SLDS styling in LWC? (Choose TWO)

Select 2 answers
A.Use the !important declaration on every CSS rule to bypass Salesforce CSS encapsulation.
B.Prefer standard SLDS utility classes over custom hardcoded CSS rules for padding and margins.
C.Write global CSS stylesheets in static resources and include them in every component using standard HTML <link> tags.
D.Override component-internal shadow DOM styles from a parent component's CSS file without styling hooks.
E.Use SLDS design tokens via CSS custom properties (e.g., var(--lwc-spacingMedium)).
AnswersB, E

Correct because SLDS utility classes ensure consistency and theme adaptability.

Why this answer

SLDS design tokens can be used via var() CSS variables, and standard SLDS classes should be preferred over custom CSS where possible.

38
MCQmedium

A developer is building a Lightning Web Component and wants to iterate over a list of items in the HTML template. Which directive should be used?

A.<template repeat={item in items}>
B.<aura:iteration items="{!v.items}" var="item">
C.<apex:repeat value="{!items}" var="item">
D.<template for:each={items} for:item="item">
AnswerD

Correct because for:each is the standard iteration directive in LWC.

Why this answer

Iteration in LWC templates uses the <template for:each={list} for:item={item}> construct.

39
MCQeasy

A developer needs to write an Apex trigger that fires before an Account is inserted and accesses the value of the custom field 'Rating__c'. Which collection type is best suited to iterate over the incoming records in the trigger context variable?

A.Account[]
B.List<Account>
C.Set<Account>
D.Map<Id, Account>
AnswerB

Trigger.new returns a List of sObjects, which can be directly iterated over using a List.

Why this answer

Trigger.new provides a List of sObjects, making a standard List or for-loop iteration the correct approach for handling trigger context records.

40
MCQmedium

A developer needs to convert a JSON string representing a list of Account records into an actual List<Account> in Apex. Which method should be used?

A.JSON.parse(jsonString)
B.(List<Account>) JSON.deserialize(jsonString, List<Account>.class)
C.List<Account>.parse(jsonString)
D.JSON.deserializeUntyped(jsonString)
AnswerB

JSON.deserialize requires the JSON string and the target type token (.class) to cast the result correctly.

Why this answer

JSON.deserialize() parses a JSON string into strongly typed Apex objects or collections.

41
MCQhard

A developer is writing a trigger on the Contact object that needs to reference old field values during an update operation. In which trigger context variable are these previous values stored?

A.Trigger.new
B.Trigger.previousValues
C.Trigger.newMap
D.Trigger.old
AnswerD

Trigger.old provides the pre-update state of the records during update and delete triggers.

Why this answer

Trigger.old contains a list of sObject records prior to the update or delete operation.

42
MCQeasy

Which base Lightning component should be used in an LWC to display a standard button?

A.lightning:button
B.apex:commandButton
C.lightning-button
D.ui:button
AnswerC

Standard LWC component for buttons.

Why this answer

lightning-button is the standard base component for buttons in LWC.

43
MCQeasy

A developer needs to create a Lightning Web Component configuration file. What is the required file extension and naming convention?

A.componentName.cmp-meta.xml
B.componentName.xml
C.componentName.config.xml
D.componentName.js-meta.xml
AnswerD

Correct because .js-meta.xml is the required extension and format for LWC metadata files.

Why this answer

LWC configuration files are named componentName.js-meta.xml.

44
MCQhard

When deploying via Metadata API, what happens if a test class fails during the deployment?

A.Only the failing test class is ignored.
B.The deployment succeeds but flags a warning.
C.The deployment fails and rolls back all changes.
D.The deployment continues but prevents Apex compilation.
AnswerC

Transactional deployment ensures no partial changes if tests fail.

Why this answer

The entire deployment fails by default unless specified otherwise.

45
Multi-Selectmedium

Which TWO statements about SOQL relationship queries are true? Choose 2 options.

Select 2 answers
A.SOQL supports traversing up to 10 levels of parent relationships.
B.Parent-to-child queries use dot notation on the parent object.
C.Child-to-parent queries require subqueries.
D.Child-to-parent queries use dot notation (e.g., Account.Name).
E.Parent-to-child queries use a subquery inside parentheses.
AnswersD, E

Traversing from child to parent uses dot notation.

Why this answer

Parent-to-child queries use subqueries in parentheses, and child-to-parent queries use dot notation.

46
Multi-Selectmedium

Which TWO tools or features are part of the Model-View-Controller (MVC) architecture implementation in Salesforce declarative and programmatic development? Choose 2 answers.

Select 2 answers
A.Profiles and Permission Sets
B.Lightning Web Components and Visualforce pages
C.Salesforce Sharing Rules
D.Governor Limits
E.Custom Objects and Fields (Database schema)
AnswersB, E

UI frameworks like LWC and Visualforce act as the View layer.

Why this answer

Custom objects/database tables represent the Model, and Lightning components/Visualforce pages represent the View.

47
Multi-Selecthard

A developer implements a custom Apex controller for a Visualforce page that performs DML operations. Which THREE best practices should be followed to ensure robust data management and security? (Choose three.)

Select 3 answers
A.Check object CRUD and field-level security permissions before executing DML.
B.Handle DML exceptions properly using try-catch blocks or Database methods.
C.Enforce sharing rules by using 'with sharing' on the controller class.
D.Hardcode record type IDs directly in the controller class.
E.Bypass all triggers by using custom settings during Visualforce execution.
AnswersA, B, C

Validating user permissions prevents unauthorized data modifications.

Why this answer

Secure controllers must check CRUD/FLS, enforce sharing rules, and handle DML errors gracefully.

48
MCQeasy

A developer has written a test method that requires a large volume of test data to be set up. To avoid writing duplicate data setup code across multiple test methods in the same class, which annotation should the developer use?

A.@isTest(SeeAllData=true)
B.@TestVisible
C.@TestSetup
D.@Future
AnswerC

TestSetup is used to create test records once and roll back changes between test methods automatically.

Why this answer

The @TestVisible annotation is incorrect for data setup. The @TestSetup annotation executes once per test class and creates data for all test methods in that class.

49
MCQhard

Why must you use Test.startTest() when testing asynchronous Apex code?

A.To increase the execution time allowed for tests.
B.To save the test data to the database immediately.
C.To ensure asynchronous processes complete within the test execution context.
D.To bypass user permission checks.
AnswerC

Test.stopTest triggers all queued asynchronous jobs.

Why this answer

Asynchronous code like @future or Queueable is queued; Test.startTest ensures it executes when Test.stopTest is called.

50
MCQeasy

What is the result of using a recursive trigger without a proper exit condition?

A.The trigger executes until the governor limit is hit
B.The trigger stops after 100 iterations
C.The trigger is automatically disabled
D.Infinite loop until memory runs out
AnswerA

Salesforce limits execution depth to prevent system loops.

Why this answer

Recursive triggers without exit conditions hit the Apex governor limit, causing the transaction to fail.

51
MCQhard

A developer is using the Lightning Message Service and needs to unsubscribe from a message channel when a component is destroyed. In which lifecycle hook should unsubscribe be called?

A.connectedCallback
B.constructor
C.disconnectedCallback
D.renderedCallback
AnswerC

Used for cleanup and unsubscription.

Why this answer

disconnectedCallback is used for cleanup tasks like unsubscribing from message channels or removing event listeners when a component is removed from the DOM.

52
MCQmedium

A developer is writing an Aura component and needs to handle an event fired by a child component. Which attribute is required in the aura:handler tag on the parent component?

A.name
B.method
C.controller
D.event
AnswerD

Specifies the fully qualified name of the event.

Why this answer

The event attribute on aura:handler specifies the event name to handle.

53
MCQeasy

Which base Lightning component is used to show a progress indicator or spinner in LWC?

A.ui:spinner
B.lightning-spinner
C.apex:spinner
D.lightning-progress
AnswerB

Standard component for loading indicators.

Why this answer

lightning-spinner is the standard component for loading spinners in LWC.

54
Multi-Selecteasy

Which TWO tools or environments are officially supported for developing Lightning Web Components? (Choose TWO)

Select 2 answers
A.Microsoft FrontPage 2003
B.Visual Studio Code with the Salesforce Extension Pack
C.Eclipse IDE with the Force.com IDE v1 plugin
D.Salesforce CLI (sfdx / sf)
E.Dreamweaver MX with custom snippet extensions
AnswersB, D

Correct because VS Code is the primary supported IDE for LWC.

Why this answer

Visual Studio Code with the Salesforce Extension Pack and Salesforce CLI are standard tools for LWC development.

55
MCQmedium

A developer needs to process 500,000 records daily and update a custom field based on complex business logic. Which asynchronous Apex feature is specifically designed to handle large batch data processing with flexible scope sizes and built-in transaction monitoring?

A.Future Methods
B.Queueable Apex
C.Batch Apex
D.Schedulable Apex
AnswerC

Correct. Batch Apex implements Database.Batchable and handles large volumes of records systematically through chunks.

Why this answer

Batch Apex is designed for processing large numbers of records (millions) by breaking them down into manageable batches and running them asynchronously.

56
MCQhard

A developer is writing a unit test and needs to assert that a specific custom exception was thrown during invalid input processing. Which pattern should the developer use?

A.Wrap the target code in a try block, add Assert.fail('Expected exception') after the target code, and catch the exception.
B.Use Test.expectException() before calling the method.
C.Check Limits.getScriptStatements() after the method call.
D.Use System.assert(false, e.getMessage()) inside the catch block.
AnswerA

Placing Assert.fail after the code ensures that if the exception is not thrown, the test fails immediately.

Why this answer

Using try-catch blocks with System.assert or Assert.fail inside the try block ensures that if the exception is not thrown, the test fails.

57
MCQmedium

A developer is writing a test class that requires several custom objects to be populated with data. What is the most efficient way to handle this across multiple test methods?

A.Use the @TestSetup annotation
B.Create a static method and call it at the start of every test method
C.Insert the data inside the constructor of the test class
D.Use the Test.loadData() method for all objects
AnswerA

This annotation ensures data is inserted once for all test methods in the class.

Why this answer

The @TestSetup annotation allows creating data once for all test methods within a class, reducing execution time.

58
Multi-Selectmedium

Which TWO circumstances will cause an Apex unit test method to fail? (Choose two.)

Select 2 answers
A.The test method executes in read-only mode.
B.The test class code coverage is exactly 75%.
C.The test method finishes executing with zero assertions.
D.A System.assert() or Assert.areEqual() statement evaluates to false.
E.An uncaught exception such as a NullPointerException is thrown during test execution.
AnswersD, E

Failed assertions throw an exception that fails the test method.

Why this answer

Uncaught exceptions and failed system assertions cause test method failures.

59
MCQeasy

A developer needs to write a test class for an Apex class that performs DML operations. Which annotation must be used to define the class as a test class?

A.@TestSetup
B.@TestVisible
C.@Test
D.@isTest
AnswerD

The @isTest annotation is the standard way to define test classes.

Why this answer

The @isTest annotation is required to define a class as a test class in Apex.

60
MCQmedium

A developer needs to execute a lightweight background task that does not require complex chaining or monitoring. Which asynchronous feature is easiest to implement for a single method call?

A.Batch Apex
B.Schedulable Apex
C.Custom Invocable Action
D.Future Method
AnswerD

Future methods require only an annotation and static method definition, making them ideal for simple tasks.

Why this answer

Future methods are the simplest way to run asynchronous code when no complex state or chaining is needed.

61
MCQmedium

Which log level is best for finding logic flow issues without cluttering the log?

A.FINEST.
B.DEBUG.
C.INFO.
D.WARN.
AnswerB

Appropriate balance.

Why this answer

DEBUG is the standard level for custom messages and logic tracing.

62
MCQmedium

What is the primary function of a scratch org?

A.A source-driven, ephemeral environment for testing and development.
B.A backup tool for production data.
C.A permanent environment for staging.
D.A tool to migrate Change Sets.
AnswerA

They are designed for CI/CD and source-based workflows.

Why this answer

A scratch org is an ephemeral, configurable Salesforce environment for development and testing.

63
MCQmedium

A developer needs to update 5,000 Account records and wants to ensure that if any single record fails validation, none of the records are committed to the database. Which method should be used?

A.acctList.save()
B.Database.update(acctList, false)
C.Database.save(acctList, true)
D.update acctList;
AnswerD

Standard DML statements enforce an all-or-nothing atomic transaction model.

Why this answer

Standard DML statements (like update acctList;) are all-or-nothing operations. If any record fails, the entire transaction rolls back.

64
Multi-Selectmedium

Which THREE criteria are best suited for choosing an Apex Trigger over a Flow?

Select 3 answers
A.Requirement for high-performance, low-latency execution
B.High-volume bulk processing
C.Simple field updates on the same record
D.Sending a simple email alert
E.Complex multi-object logic that exceeds Flow limits
AnswersA, B, E

Apex is more efficient.

Why this answer

Complex bulk logic, heavy computational requirements, and performance-critical operations are best handled in Apex.

65
MCQhard

When is an Apex test run automatically executed?

A.Every time a trigger runs.
B.During production deployment.
C.When a record is saved.
D.When a user logs in.
AnswerB

Mandatory check.

Why this answer

Tests are run automatically during deployment and package installation.

66
MCQhard

A developer wants to chain a second asynchronous job from within an executing Queueable Apex job. Which method should be used?

A.System.enqueueJob()
B.Database.executeBatch()
C.apexJob.schedule()
D.Future.runAsync()
AnswerA

System.enqueueJob is called inside the Queueable execute method to chain jobs.

Why this answer

System.enqueueJob is used inside an execute method of a Queueable class to chain another job.

67
MCQmedium

When debugging a trigger, how can you view the flow of execution including entry and exit points of methods?

A.By examining the heap size.
B.By viewing the Call Stack.
C.By running an Apex report.
D.By checking the Database log.
AnswerB

Shows method nesting.

Why this answer

The Call Stack in the Debug Log shows the hierarchy of method calls.

68
MCQhard

A developer creates a parent Lightning Web Component containing a child component. The parent needs to call a public method defined inside the child component. How is this accomplished?

A.Use the publish() method of the Lightning Message Service.
B.Update a shared reactive property passed down via @api.
C.Dispatch an event from the parent and listen to it in the child component.
D.Use this.template.querySelector('c-child-component').publicMethodName() in the parent component.
AnswerD

Correct because querying the child component reference allows calling its exported @api methods.

Why this answer

A parent component can invoke a public method on a child component by querying the child element and calling the method directly.

69
MCQmedium

A developer is debugging a process that involves asynchronous Apex. Which Debug Log setting is required to see the output of the @future method?

A.Apex Code trace flag set to DEBUG.
B.System log at INFO level.
C.Validation rules set to ON.
D.Profiling level set to FINEST.
AnswerA

This ensures Apex statements are captured in the log.

Why this answer

Setting the Apex Code level to DEBUG is necessary to see standard logs.

70
MCQhard

An application uses a SOSL search to find records across multiple objects. Which return type must be used to capture the results in Apex?

A.List<List<SObject>>
B.Map<String, List<SObject>>
C.SearchResult[]
D.List<SObject>
AnswerA

SOSL queries always return a list of lists, where each inner list contains the sObjects found for a specific sObject type.

Why this answer

SOSL search queries return a List of Lists of SObjects (List<List<SObject>>), because a single search can return results across multiple different sObject types.

71
Multi-Selectmedium

A developer is building a custom Lightning Web Component and wants to communicate data from a child component up to its parent component. Which THREE steps are required? (Choose three.)

Select 3 answers
A.Dispatch the event using the this.dispatchEvent() method in the child.
B.Import the wire service adapter in the parent component.
C.Use the @api decorator on a parent property inside the child component.
D.Create a new CustomEvent in the child component's JavaScript file.
E.Add an event listener directive (e.g., onmyevent) to the child component tag in the parent HTML template.
AnswersA, D, E

Dispatching the event sends it up the DOM tree to parent listeners.

Why this answer

Child-to-parent communication in LWC is achieved by creating and dispatching a CustomEvent from the child and listening for it on the parent's HTML template.

72
Multi-Selecthard

Which THREE actions can a developer take to optimize SOSL query performance and adhere to best practices? Choose 3 answers.

Select 3 answers
A.Use leading wildcards (e.g., '*Smith') to broaden search flexibility.
B.Target specific fields (e.g., EMAIL FIELDS) rather than searching ALL FIELDS.
C.Execute SOSL inside a tight for-loop over large data sets.
D.Specify the target sObject and fields to return to minimize data transfer.
E.Filter search results using logical operators like AND and OR.
AnswersB, D, E

Scoping the search to specific field lists reduces search overhead.

Why this answer

SOSL best practices include specifying the object and fields to return, targeting specific search text instead of leading wildcards, and restricting search scopes.

73
MCQeasy

Which governor limit applies specifically to the total number of asynchronous Apex executions (such as future methods and queueable jobs) enqueued in a 24-hour period for an Enterprise Edition org?

A.100 SOQL queries per transaction
B.6MB heap size limit
C.50 DML statements per transaction
D.10,000 or 2.5 times the number of user licenses, whichever is greater
AnswerD

Correct. The daily limit for asynchronous Apex in production orgs is 250,000 or 2.5 times the user licenses, with specific limits for developer editions.

Why this answer

The asynchronous Apex execution limit restricts the total number of future calls, queueable jobs, and scheduled jobs that can be enqueued per 24 hours.

74
MCQhard

An Apex trigger needs to prevent records from being saved if a specific validation condition fails. How should the developer reject the DML operation on a specific record?

A.record.addError('Validation failed.');
B.Trigger.rollback();
C.ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error'));
D.throw new ValidationException('Error');
AnswerA

Calling addError() on a record in Trigger.new prevents the DML operation for that record and reports the error.

Why this answer

Adding an error message to a record sObject in Trigger.new (e.g., record.addError('Message')) prevents that record from saving and adds an error to the UI/transaction.

75
Multi-Selecteasy

A developer is building a Lightning Web Component and wants to style it using Salesforce Lightning Design System (SLDS). Which TWO statements are true regarding SLDS usage in LWC? (Choose TWO)

Select 2 answers
A.Custom CSS styles written in LWC automatically leak into child components.
B.Developers must upload SLDS as a static resource and reference it via loadStyle for every component.
C.SLDS styles are automatically available in LWC without needing to import static resources.
D.SLDS design tokens cannot be used within component CSS files.
E.SLDS utility classes follow the BEM naming convention.
AnswersC, E

Correct because SLDS is natively built into the Lightning Experience platform.

Why this answer

SLDS is natively available in LWC without static resource uploads, and utility classes are used for styling.

Page 1 of 7

Page 2

All pages