Salesforce Platform Developer I Flashcards

1
Q

What is the maximum number of custom fields that can be created for an object in Salesforce?
a) 100
b) 200
c) 500
d) 800

A

c) 500

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

b) DateTime
Which data type should be used to store a value that represents a date and time in Apex?
a) Date
b) DateTime
c) Time
d) Timestamp

A

b) DateTime

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

Which of the following is not a valid Salesforce Object relationship?
a) Master-Detail
b) Lookup
c) Parent-Child
d) External Lookup

A

d) External Lookup

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

What is the purpose of a trigger in Salesforce?
a) To provide a user interface for data entry
b) To automate business processes when specific events occur
c) To generate reports and dashboards
d) To perform calculations on custom fields

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

What is the purpose of a trigger in Salesforce?
a) To provide a user interface for data entry
b) To automate business processes when specific events occur
c) To generate reports and dashboards
d) To perform calculations on custom fields

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

What is the maximum batch size for a batch Apex job?
a) 100
b) 200
c) 500
d) 1000

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

Which keyword is used in Apex to prevent a variable from being modified?
a) final
b) const
c) static
d) private

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

Which keyword is used in Apex to prevent a variable from being modified?
a) final
b) const
c) static
d) private

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

In Salesforce, what is the purpose of the @AuraEnabled annotation?
a) To expose an Apex method to be invoked from Lightning components
b) To enable access to external web services
c) To make a field visible in the Lightning App Builder
d) To enable the use of Aura components in Visualforce pages

A

a) to expose an Apex method to be invoked from Lightning Components

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

b) 100What is the limit for the total number of SOQL queries issued per transaction in asynchronous Apex (batch and future)?
a) 50
b) 100
c) 150
d) 200

A

b) 100

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

When using the “with sharing” keyword in an Apex class, what happens to the record visibility?
a) All records are visible, regardless of the user’s permissions.
b) Record visibility is determined by the class’s sharing settings.
c) The “with sharing” keyword is not related to record visibility.
d) The record visibility is restricted to the owner of the class.

A

b) Record visibility is determined by the class’s sharing settings.

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

Which Salesforce feature allows you to create a custom user interface for your application using standard web technologies like HTML, CSS, and JavaScript?
a) Visualforce
b) Apex
c) Lightning Web Components
d) Workflow Rules

A

c) Lightning Web Components

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

In Salesforce, what is the purpose of the @AuraEnabled annotation?
a) To expose an Apex method to be invoked from Lightning components
b) To enable access to external web services
c) To make a field visible in the Lightning App Builder
d) To enable the use of Aura components in Visualforce pages

A

a) To expose an Apex method to be invoked from Lightning components

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

Which keyword is used in Apex to prevent a variable from being modified?
a) final
b) const
c) static
d) private

A

a) final

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

What is the purpose of a trigger in Salesforce?
a) To provide a user interface for data entry
b) To automate business processes when specific events occur
c) To generate reports and dashboards
d) To perform calculations on custom fields

A

b) To automate business processes when specific events occur

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

What is the maximum batch size for a batch Apex job?
a) 100
b) 200
c) 500
d) 1000

A

d) 1000

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

What is the maximum number of characters allowed for a custom field name in Salesforce?
a) 25 characters
b) 30 characters
c) 40 characters
d) 50 characters

A

Answer: d) 50 characters

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

In Salesforce, which relationship type allows you to associate a single record from one object with multiple records from another object?
a) Master-Detail Relationship
b) Lookup Relationship
c) Many-to-Many Relationship
d) External Lookup Relationship

A

Answer: c) Many-to-Many Relationship

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

Which data type should you use in Salesforce to store large text values that exceed 255 characters and do not require indexing or searching?
a) Text
b) Long Text Area
c) Text Area (Long)
d) Text Area (Rich)

A

Answer: c) Text Area (Long)

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

What does the “with sharing” keyword indicate in an Apex class definition?
a) It enforces sharing rules on queries for the object.
b) It allows access to private and protected class members outside the class.
c) It allows the class to perform operations without sharing record-level access.
d) It enables access to external systems with shared credentials.

A

Answer: a) It enforces sharing rules on queries for the object.

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

In a Salesforce trigger, when are “before” triggers fired in the execution sequence?
a) After the record is inserted or updated in the database.
b) Before the record is deleted from the database.
c) Before the record is inserted or updated in the database.
d) After the record is deleted from the database

A

Answer: c) Before the record is inserted or updated in the database.

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

Which interface must be implemented to make a class iterable using a for-each loop in Apex?
a) Iterable
b) Iterator
c) Traversable
d) Enumerable

A

Answer: a) Iterable

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

What is the maximum number of external objects that can be synchronized in Salesforce using the Lightning Connect feature?
a) 5
b) 10
c) 15
d) 20

A

Answer: d) 20

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

In Salesforce, what is the purpose of a sharing rule?
a) To define the sharing model for a custom object.
b) To grant access to records owned by a specific user.
c) To determine the level of access users have to records in a report.
d) To automate the process of assigning record ownership.

A

Answer: b) To grant access to records owned by a specific user.

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

Which Salesforce feature is used to group users and define the data they can access in reports and dashboards?
a) Profiles
b) Roles
c) Sharing Rules
d) Permission Sets

A

Answer: b) Roles

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

What is the correct order of execution for a Visualforce page request in Salesforce?
a) Constructor → Getter Methods → Setter Methods → Page Initialization → Action Methods → Page Rendering
b) Getter Methods → Constructor → Setter Methods → Page Initialization → Action Methods → Page Rendering
c) Page Initialization → Getter Methods → Setter Methods → Action Methods → Constructor → Page Rendering
d) Page Initialization → Constructor → Getter Methods → Action Methods → Setter Methods → Page Rendering

A

Answer: d) Page Initialization → Constructor → Getter Methods → Action Methods → Setter Methods → Page Rendering

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

How does Apex code differ from declarative features like workflows and validation rules in Salesforce?
a) Apex code allows for real-time automation, while workflows and validation rules are limited to batch processing.
b) Apex code is written in Java, while workflows and validation rules are written in declarative languages.
c) Apex code can perform complex logic and interact with external systems, while workflows and validation rules have predefined functionality.
d) Apex code is executed on the client-side, while workflows and validation rules are executed on the server-side

A

Answer: c) Apex code can perform complex logic and interact with external systems, while workflows and validation rules have predefined functionality

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

What are some best practices for writing efficient SOQL queries in Apex to avoid hitting governor limits?
a) Use inline SOQL queries within loops to fetch related records.
b) Limit the number of records returned using the LIMIT keyword.
c) Avoid using SOQL queries and rely on Apex collections for data manipulation.
d) Utilize selective WHERE clauses to filter data effectively.

A

Answer: d) Utilize selective WHERE clauses to filter data effectively.

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

In Salesforce, what is the purpose of using the @future annotation in Apex methods?
a) It allows methods to be called asynchronously to run in the background.
b) It prevents methods from being called in test classes to maintain isolation.
c) It specifies that methods can only be called from scheduled Apex jobs.
d) It grants methods access to the future records in the database.

A

Answer: a) It allows methods to be called asynchronously to run in the background.

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

When would you use a batch Apex class instead of a scheduled Apex class in Salesforce?
a) To process large data sets in smaller chunks for better performance.
b) To ensure that specific jobs are executed at predetermined times.
c) To execute time-consuming logic that should run in real-time.
d) To schedule tasks for execution on a recurring basis.

A

Answer: a) To process large data sets in smaller chunks for better performance.

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

How can you implement a custom approval process using Apex code in Salesforce?
a) By using Apex triggers to handle approval-related logic and updates.
b) By using workflow rules and approval processes, as Apex code cannot handle approvals.
c) By utilizing Apex classes and interfaces to define custom approval steps.
d) By directly modifying the Approval Process metadata in the Salesforce Developer Console.

A

Answer: a) By using Apex triggers to handle approval-related logic and updates.

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

What is the purpose of using Test.startTest() and Test.stopTest() methods in Apex test classes?
a) They are used to simulate real-time behavior of Apex code during unit testing.
b) They reset the governor limits for each individual test method.
c) They help establish a transaction boundary for test execution.
d) They enable asynchronous testing of future methods.

A

Answer: b) They reset the governor limits for each individual test method.

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

Which of the following is true regarding a static variable in an Apex class?
a) A static variable retains its value across different execution contexts.
b) Each instance of a class has its own copy of a static variable.
c) A static variable can be modified by instance methods but not by static methods.
d) A static variable is automatically initialized to null when the class is instantiated.

A

Answer: a) A static variable retains its value across different execution contexts.

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

What is a use case for Platform Events in Salesforce?
a) Sending outbound messages to external systems using SOAP or REST API.
b) Triggering real-time business processes based on record updates.
c) Implementing custom user interfaces with Lightning Web Components.
d) Tracking changes to field values in an object using field history tracking.

A

Answer: b) Triggering real-time business processes based on record updates.

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

How can you enforce field-level security when querying data in Apex to ensure that users can only access fields they have permissions to?
a) Use the “SECURITY_ENFORCED” clause in SOQL queries.
b) Utilize “WITH SECURITY_ENFORCED” in the class definition.
c) Set the “enforceFieldLevelSecurity” parameter to true in the SOQL query.
d) Ensure that the “WITH SHARING” keyword is present in the class definition.

A

Answer: c) Set the “enforceFieldLevelSecurity” parameter to true in the SOQL query.

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

hich design pattern in Apex can be used to decouple the sender of a message from its receiver, allowing multiple receivers to process the message independently?
a) Singleton Pattern
b) Observer Pattern
c) Factory Pattern
d) Facade Pattern

A

Answer: b) Observer Pattern

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

Which data type is used for the “Name” field of a custom object in Salesforce?
a) Text
b) Auto Number
c) Email
d) Phone

A

Answer: b) Auto Number

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

What is the maximum number of characters allowed for an Apex class name in Salesforce?
a) 15 characters
b) 30 characters
c) 40 characters
d) 50 characters

A

Answer: c) 40 characters

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

How do you define a constant variable in Apex?
a) using the “final” keyword
b) using the “constant” keyword
c) using the “readonly” keyword
d) using the “immutable” keyword

A

Answer: a) using the “final” keyword

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

What is the purpose of the “Database.SaveResult” class in Apex?
a) It provides information about the records that were inserted, updated, or deleted.
b) It allows you to perform mass updates on records using a single DML statement.
c) It enables you to schedule asynchronous Apex jobs.
d) It is used to handle exceptions and errors during DML operations.

A

Answer: a) It provides information about the records that were inserted, updated, or deleted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q
  1. What can you use to execute a piece of Apex code based on a time trigger in Salesforce?
    a) Workflow Rule
    b) Process Builder
    c) Flow
    d) Scheduled Apex
A

Answer: d) Scheduled Apex

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

How can you ensure that a record meets specific criteria before it is saved in Salesforce?
a) By using Validation Rules
b) By using Workflows
c) By using Process Builder
d) By using Flows

A

Answer: a) By using Validation Rules

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

In a before trigger, how can you access the field values of the record being processed?
a) By using Trigger.oldMap
b) By using Trigger.new
c) By using Trigger.newMap
d) By using Trigger.old

A

Answer: b) By using Trigger.new

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

What is the purpose of the “STOP” element in a Salesforce Flow?
a) It stops the flow and cancels all pending actions.
b) It throws an exception and terminates the flow.
c) It redirects the user to a different flow.
d) It pauses the flow and waits for a specific event to occur.

A

Answer: a) It stops the flow and cancels all pending actions.

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

What is the correct syntax to display a custom Lightning component in a Lightning page in Salesforce?
a) aura:component
b) lightning:component
c) apex:component
d) force:component

A

Answer: b) lightning:component

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

What is the purpose of a Lightning Web Component’s JavaScript controller?
a) It contains the server-side Apex logic for the component.
b) It handles user interactions and component behavior on the client-side.
c) It defines the user interface markup for the component.
d) It governs the security settings for the component.

A

Answer: b) It handles user interactions and component behavior on the client-side.

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

Which attribute is used to bind data to a Lightning component attribute?
a) data-bind
b) value
c) aura:value
d) aura:attribute

A

Answer: d) aura:attribute

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

How can you apply a custom theme to a Lightning app in Salesforce?
a) By creating a Lightning component to override the default theme.
b) By setting the theme in the app’s properties on the Salesforce Setup page.
c) By modifying the CSS of the app directly.
d) By including a custom CSS file in the app’s resources.

A

Answer: b) By setting the theme in the app’s properties on the Salesforce Setup page

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

Testing, Debugging, and Deployment (22%):
13. In Salesforce, what is the primary purpose of an Apex test class?
a) To ensure code coverage for all Apex classes.
b) To validate the functionality of Apex code before deployment.
c) To automatically deploy Apex code to production.
d) To simulate actual user interactions in the sandbox environment.

A

Answer: b) To validate the functionality of Apex code before deployment.

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

How can you invoke an Apex test class from the Salesforce Developer Console?
a) Click on the “Run All Tests” button.
b) Use the “System.Test” object to call the test methods.
c) Use the “Execute Anonymous” window to execute the test class.
d) Test classes cannot be executed from the Salesforce Developer Console.

A

Answer: a) Click on the “Run All Tests” button

50
Q

What does the “Test.loadData” method do in an Apex test class?
a) It allows you to import test data from an external CSV file.
b) It loads the test data directly into the database for testing.
c) It reads data from the Test Settings page in Salesforce.
d) It generates random test data for use in test methods.

A

Answer: a) It allows you to import test data from an external CSV file.

51
Q

How can you debug an Apex code snippet in Salesforce to identify issues and errors?
a) Use System.debug() statements to output log messages to the debug logs.
b) Place breakpoints in the code and execute the code in the Salesforce Developer Console.
c) Utilize the “Debug” button on the Salesforce Setup page.
d) Use the “Apex Debugger” tool provided by Salesforce.

A

Answer: a) Use System.debug() statements to output log messages to the debug logs.

52
Q

Which deployment tool can you use to deploy metadata changes from one Salesforce organization to another?
a) Salesforce DX
b) Change Sets
c) Force Migration Tool (ANT)
d) Metadata API

A

Answer: b) Change Sets

53
Q

How can you deploy Apex classes and triggers using Salesforce DX?
a) By using the “sfdx force:apex:deploy” command.
b) By manually copying and pasting the code from one org to another.
c) By creating a deployment package with the Salesforce DX CLI.
d) Apex classes and triggers cannot be deployed using Salesforce DX.

A

Answer: a) By using the “sfdx force:apex:deploy” command.

54
Q

What is the maximum number of characters allowed for a custom object’s API name in Salesforce?
a) 15 characters
b) 30 characters
c) 40 characters
d) 80 characters

A

Answer: b) 30 characters

55
Q

In Salesforce, which relationship type is not automatically created for custom objects?
a) Master-Detail Relationship
b) Lookup Relationship
c) Hierarchical Relationship
d) External Lookup Relationship

A

Answer: c) Hierarchical Relationship

56
Q

What is the correct syntax to create an instance of a custom Apex class called “MyClass”?
a) MyClass myClass = new MyClass();
b) MyClass myClass = MyClass();
c) new MyClass myClass = new MyClass();
d) new myClass = new MyClass();

A

Answer: a) MyClass myClass = new MyClass();

57
Q

When using Process Builder in Salesforce, which action type allows you to update related records?
a) Create a Record
b) Update Records
c) Post to Chatter
d) Quick Action

A

Answer: b) Update Records

58
Q

In Apex, which method can be used to perform a callout to an external web service?
a) HttpRequest
b) HttpCallout
c) WebServiceCallout
d) Http.send()

A

Answer: d) Http.send()

59
Q

What is the maximum number of criteria that can be defined in a single Validation Rule in Salesforce?
a) 5
b) 10
c) 15
d) 20

A

Answer: b) 10

60
Q

In Salesforce, which object is used to define the criteria for Escalation Rules?
a) Case
b) Lead
c) Account
d) Opportunity

A

Answer: a) Case

61
Q

Which Lightning component is used to display a list of records from a data source?
a) lightning:datatable
b) lightning:recordForm
c) lightning:accordion
d) lightning:recordViewForm

A

Answer: a) lightning:datatable

62
Q

What is the purpose of using the “aura:iteration” component in a Lightning component?
a) To display a list of records in a table format.
b) To loop through a collection of items and render them in the component.
c) To iterate over a list of records and perform DML operations.
d) To manage the iteration limits for long-running processes.

A

Answer: b) To loop through a collection of items and render them in the component.

63
Q

In Lightning Web Components, how can you invoke a method imperatively?
a) @wire decorator
b) @track decorator
c) this.methodName()
d) this.methodName

A

Answer: c) this.methodName()

64
Q

Which attribute is used to control the visibility of a Lightning component on a Lightning page?
a) visible
b) hidden
c) rendered
d) display

A

Answer: c) rendered

65
Q

In Salesforce, what is the purpose of using the “@isTest” annotation in Apex test classes?
a) It marks the class as a test class to be included in code coverage calculations.
b) It ensures that the class cannot be deployed to production.
c) It sets the test execution options for the class.
d) It allows the class to run as a system administrator during testing.

A

Answer: a) It marks the class as a test class to be included in code coverage calculations.

66
Q

What is the maximum number of test classes that can be queued and run asynchronously in Salesforce?
a) 5
b) 10
c) 15
d) 25

A

Answer: d) 25

67
Q

How can you simulate the occurrence of governor limits in a Salesforce test class?
a) By setting the Test Level to “SeeAllData” in the class definition.
b) By creating large datasets in the test data setup.
c) By setting the Test Level to “RunAllTests” in the class definition.
d) By executing complex logic and large data processing in the test methods.

A

Answer: d) By executing complex logic and large data processing in the test methods.

68
Q

In Salesforce, what is the purpose of using the “System.debug()” method in Apex code?
a) To log information for monitoring and troubleshooting.
b) To execute a code block only in a test context.
c) To perform unit testing of a method’s logic.
d) To enable access to system-wide resources.

A

Answer: a) To log information for monitoring and troubleshooting.

69
Q

How can you deploy changes between Salesforce environments using Metadata API?
a) By using Change Sets in the Salesforce Setup menu.
b) By using the Salesforce Data Loader.
c) By using the Apex Migration Tool.
d) By using the Salesforce Extensions for Visual Studio Code.

A

Answer: c) By using the Apex Migration Tool.

70
Q

What is the purpose of the “destructiveChanges.xml” file in a Salesforce deployment package?
a) To specify the changes that need to be deployed to the target environment.
b) To track the progress of a deployment in real-time.
c) To define the rollback plan in case of deployment failures.
d) To remove obsolete components from the target environment.

A

Answer: d) To remove obsolete components from the target environment.

71
Q

In Salesforce, which tool is used to view the code coverage of Apex classes and triggers?
a) Apex Code Coverage Viewer
b) Developer Console
c) Workbench
d) Apex Test Execution

A

Answer: b) Developer Console

72
Q

How can you prevent accidental data loss during a Salesforce data deployment?
a) By backing up the source and target databases before the deployment.
b) By disabling validation rules and triggers during the deployment process.
c) By running all deployments in system administrator mode.
d) By performing a full refresh of the target database before deployment.

A

Answer: a) By backing up the source and target databases before the deployment.

73
Q

In Salesforce, which feature allows you to define different page layouts based on user profiles and record types?
a) Page Layout Assignments
b) User Record Types
c) Record Type Assignments
d) Profile-Specific Layouts

A

Answer: a) Page Layout Assignments

74
Q

What is the correct syntax for creating a new instance of a custom Apex class in Salesforce?
a) MyClass obj = new MyClass;
b) MyClass obj = new();
c) MyClass obj = new MyClass();
d) MyClass obj = MyClass();

A

Answer: c) MyClass obj = new MyClass();

75
Q

What is the difference between a public and global access modifier for Apex classes and methods?
a) Public classes can be accessed by any class within the same namespace, while global classes can be accessed by any class in the organization.
b) Public classes can be accessed by any class within the same organization, while global classes can be accessed by any external application.
c) Public methods can be called by any class within the same organization, while global methods can be called by any class in the organization.
d) Public methods can be called by any external application, while global methods can be called by any class in the same namespace.

A

Answer: b) Public classes can be accessed by any class within the same organization, while global classes can be accessed by any external application.

76
Q

How can you ensure that an Apex class is available to be used by other classes in Salesforce?
a) By making the class “final.”
b) By creating an instance of the class in another class.
c) By declaring the class as “public.”
d) By importing the class into another class using the “import” statement.

A

Answer: c) By declaring the class as “public.”

77
Q

Process Automation and Logic (continued):
When does a “before update” trigger get executed in Salesforce?
a) After the record is updated but before it is committed to the database.
b) Before the record is updated and before validation rules and duplicate rules are executed.
c) After the record is updated and after validation rules and duplicate rules are executed.
d) Before the record is updated but after it is committed to the database.

A

Answer: b) Before the record is updated and before validation rules and duplicate rules are executed.

78
Q

In Salesforce, what is the purpose of a Flow “Screen” element?
a) To display a UI component to the user and capture input values.
b) To provide a flow with access to an external data source.
c) To display a message to the user at a specific point in the flow.
d) To create a user interface without using Lightning components.

A

Answer: a) To display a UI component to the user and capture input values.

79
Q

What is the difference between a “For Loop” and a “While Loop” in Apex?
a) A “For Loop” iterates a specific number of times, while a “While Loop” iterates until a condition is true.
b) A “For Loop” can only iterate over lists and maps, while a “While Loop” can only iterate over collections.
c) A “For Loop” is more efficient than a “While Loop” for iterating large collections.
d) A “While Loop” can iterate over objects and records, while a “For Loop” cannot.

A

Answer: a) A “For Loop” iterates a specific number of times, while a “While Loop” iterates until a condition is true.

80
Q

What is the purpose of a Lightning Web Component’s “wire” service in Salesforce?
a) It allows you to connect to external APIs and services.
b) It enables you to fetch data from Salesforce objects and fields.
c) It handles user interactions and events in the Lightning component.
d) It governs the styling and layout of the Lightning component.

A

Answer: b) It enables you to fetch data from Salesforce objects and fields.

81
Q

How can you pass data from a Lightning component to its parent component in Salesforce?
a) By using event bubbling.
b) By using the “lightning:parent” attribute in the child component.
c) By using the “aura:method” attribute in the parent component.
d) By using the “component.set()” method in the child component.

A

Answer: c) By using the “aura:method” attribute in the parent component.

82
Q

What is the role of the Lightning Design System (SLDS) in Salesforce?
a) It allows you to design custom themes and styles for Lightning components.
b) It provides a set of pre-built, responsive UI components for use in Lightning apps.
c) It governs the security settings for Lightning components.
d) It is used to handle asynchronous data retrieval in Lightning components.

A

Answer: b) It provides a set of pre-built, responsive UI components for use in Lightning apps.

83
Q

How can you retrieve debug logs for Apex code executed during a test run in Salesforce?
a) By navigating to the “Debug Logs” page in the Salesforce Setup.
b) By using the “System.debug()” method in the test class.
c) By enabling “Apex Test Execution” in the Salesforce Developer Console.
d) By setting “Apex Debugger” breakpoints during the test run.

A

Answer: a) By navigating to the “Debug Logs” page in the Salesforce Setup.

84
Q

Which deployment tool allows you to deploy metadata changes between unrelated Salesforce orgs?
a) Change Sets
b) Force Migration Tool (ANT)
c) Salesforce CLI (Command Line Interface)
d) Data Loader

A

Answer: b) Force Migration Tool (ANT)

85
Q

How can you deploy a specific Apex class from a Salesforce sandbox to a production environment?
a) By using the “Force Migration Tool (ANT)” to deploy the class.
b) By creating a Change Set that includes the Apex class and deploying it to production.
c) By manually copying and pasting the code from sandbox to production.
d) By using the Salesforce Data Loader to export and import the class.

A

Answer: b) By creating a Change Set that includes the Apex class and deploying it to production.

86
Q

How can you define a custom exception in Apex?
a) By extending the “Exception” class.
b) By implementing the “Exception” interface.
c) By creating a new class and using the “throw” keyword.
d) Apex does not support custom exceptions.

A

Answer: c) By creating a new class and using the “throw” keyword.

87
Q

In Salesforce, what is the purpose of a Schema Class?
a) It provides information about the organization’s data model and schema.
b) It allows you to define custom field types and data structures.
c) It provides access to the metadata of the organization, such as objects and fields.
d) It is used to validate user input in the Salesforce UI.

A

Answer: c) It provides access to

88
Q

What is the recommended way to perform complex business logic in Salesforce?
a) Using Process Builder
b) Using Apex triggers
c) Using Workflow Rules
d) Using Approval Processes

A

Answer: b) Using Apex triggers

89
Q

When should you use a Process Builder instead of a Workflow Rule in Salesforce?
a) When you need to update multiple records simultaneously.
b) When you need to execute logic in real-time.
c) When you need to perform cross-object field updates.
d) When you need to send outbound messages to external systems.

A

Answer: c) When you need to perform cross-object field updates.

90
Q

What does the “Recursion” setting in a Process Builder or a Workflow Rule in Salesforce control?
a) The number of times a record can be updated in a single transaction.
b) The number of times the process or rule can trigger itself in a single transaction.
c) The number of times a record can be deleted in a single transaction.
d) The number of times a trigger can be executed in a single transaction.

A

Answer: b) The number of times the process or rule can trigger itself in a single transaction.

91
Q

Which JavaScript framework is used by Lightning Web Components (LWC) in Salesforce?
a) AngularJS
b) jQuery
c) Lightning Web Framework
d) None, LWC uses native web standards.

A

Answer: d) None, LWC uses native web standards.

92
Q

What is the purpose of the “render” method in a Lightning Web Component (LWC)?
a) It renders the component on the server-side before delivering it to the client.
b) It renders the component’s user interface markup and returns it to the client.
c) It renders the component in a hidden state until a specific event occurs.
d) It renders the component’s CSS styles and scripts on the client.

A

Answer: b) It renders the component’s user interface markup and returns it to the client.

93
Q

What is the purpose of the “lightning:recordEditForm” component in Lightning?
a) It displays a read-only view of a record’s details.
b) It allows a user to create, edit, or view a record based on the record’s layout.
c) It provides a way to search and filter records in a list view.
d) It allows users to sort and group records based on specified criteria.

A

Answer: b) It allows a user to create, edit, or view a record based on the record’s layout.

94
Q

What is the purpose of using “Test.loadData” in an Apex test class?
a) To load test data from a CSV file into a test context.
b) To bulk insert test records into the database for testing.
c) To load and parse test data from an external API.
d) To execute test methods asynchronously for performance testing.

A

Answer: a) To load test data from a CSV file into a test context.

95
Q

How can you view the debug log output of an Apex test class in Salesforce?
a) By using the “Test.startTest()” and “Test.stopTest()” methods.
b) By navigating to the “Apex Test Execution” tab in the Salesforce Developer Console.
c) By clicking on the “View Debug Logs” button after running the test class.
d) By using the “System.debug()” method in the test class.

A

Answer: c) By clicking on the “View Debug Logs” button after running the test class.

96
Q

Testing, Debugging, and Deployment:
Which deployment tool allows you to deploy metadata changes directly from the Salesforce Setup?
a) Change Sets
b) Force Migration Tool (ANT)
c) Data Loader
d) Salesforce CLI (Command Line Interface)

A

Answer: a) Change Sets

97
Q

In Apex, what is the difference between a Map and a Set collection?
a) A Map can store multiple data types, while a Set can store only primitive data types.
b) A Map stores data in a key-value pair, while a Set stores unique elements.
c) A Map can be used for iteration, while a Set cannot be iterated.
d) A Map allows duplicate values, while a Set does not.

A

Answer: b) A Map stores data in a key-value pair, while a Set stores unique elements.

98
Q

What are the two types of Apex code blocks that can be used in Salesforce?
a) If-Else blocks and For loops
b) Try-Catch blocks and Do-While loops
c) Trigger blocks and Class blocks
d) Anonymous blocks and Apex class methods

A

Answer: d) Anonymous blocks and Apex class methods

99
Q

How can you invoke a method from another Apex class in Salesforce?
a) By importing the class and calling the method using the class instance.
b) By using the “invoke()” method of the “System” class.
c) By declaring the method as “global” and calling it from any class.
d) By declaring the method as “static” and calling it directly.

A

Answer: a) By importing the class and calling the method using the class instance

100
Q

What is the difference between a “before delete” trigger and an “after delete” trigger in Salesforce?
a) A “before delete” trigger fires before the record is deleted, while an “after delete” trigger fires after the record is deleted.
b) A “before delete” trigger can perform validation on the record, while an “after delete” trigger cannot.
c) A “before delete” trigger can prevent a record from being deleted, while an “after delete” trigger cannot.
d) A “before delete” trigger cannot be used in Salesforce, only “after delete” triggers are available.

A

Answer: a) A “before delete” trigger fires before the record is deleted, while an “after delete” trigger fires after the record is deleted.

101
Q

What is the purpose of a Flow “Loop” element in Salesforce?
a) To allow a flow to iterate over a collection of records or elements.
b) To create a loop in the user interface to repeat a set of components.
c) To define a repeating action in a flow based on user input.
d) To loop through a series of steps in the flow sequentially.

A

Answer: a) To allow a flow to iterate over a collection of records or elements.

102
Q

How can you handle exceptions in a Salesforce Flow?
a) By using the “On Error” element to handle specific exceptions.
b) By using Apex code to catch and handle exceptions.
c) By using the “try-catch” block in the flow logic.
d) Flows cannot handle exceptions; they must be handled in Apex code.

A

Answer: a) By using the “On Error

103
Q

What is the purpose of the “lightning:overlayLibrary” component in Lightning?
a) It provides a library of predefined Lightning components for use in the user interface.
b) It allows you to display custom modal dialogs and pop-ups in Lightning apps.
c) It enables you to create custom themes and styles for Lightning components.
d) It governs the access control for Lightning components.

A

Answer: b) It allows you to display custom modal dialogs and pop-ups in Lightning apps.

104
Q

How can you create a reusable Lightning component in Salesforce?
a) By using the “lightning:component” tag in a Visualforce page.
b) By using a custom HTML component and styling it using CSS.
c) By creating a new Lightning component with the “isTemplate” attribute set to true.
d) By defining a new Lightning component and using it in other components.

A

Answer: d) By defining a new Lightning component and using it in other components.

105
Q

What is the purpose of the “lightning:navigation” component in Lightning?
a) It allows you to navigate to a specific URL within a Lightning app.
b) It enables you to navigate to a specific Salesforce object record.
c) It provides a list of navigation links for a custom Lightning app.
d) It allows you to create navigation menus in Lightning apps.

A

Answer: b) It enables you to navigate to a specific Salesforce object record.

106
Q

What is the main benefit of using Apex unit tests in Salesforce?
a) Apex unit tests ensure that your code has no compilation errors.
b) Apex unit tests are mandatory for deploying code to production.
c) Apex unit tests verify that your code works as expected and prevents regressions.
d) Apex unit tests allow you to measure the code coverage for each class.

A

Answer: c) Apex unit tests verify that your code works as expected and prevents regressions.

107
Q

How can you run all test classes in Salesforce?
a) By clicking the “Run All Tests” button in the Apex Test Execution page.
b) By using the “sfdx force:apex:test:run” command in Salesforce CLI.
c) By executing all test methods in the Salesforce Developer Console.
d) By running a “Test Suite” that includes all test classes.

A

Answer: a) By clicking the “Run All Tests” button in the Apex Test Execution page.

108
Q

What is the purpose of the “SeeAllData” annotation in Apex test classes?
a) It allows test classes to access all data in the Salesforce org.
b) It grants test classes access to data that would otherwise be inaccessible.
c) It ensures that test classes can only access data created in the test context.
d) It prevents test classes from accessing data in the database.

A

Answer: b) It grants test classes access to data that would otherwise be inaccessible.

109
Q

What is the difference between a static variable and an instance variable in Apex?
a) A static variable can be accessed across different instances of a class, while an instance variable is specific to each class instance.
b) A static variable can only be accessed within the class where it is declared, while an instance variable is accessible globally.
c) A static variable is automatically initialized, while an instance variable must be explicitly initialized in the class constructor.
d) There is no difference; static and instance variables serve the same purpose in Apex.

A

Answer: a) A static variable can be accessed across different instances of a class, while an instance variable is specific to each class instance.

110
Q

What does the “getter” and “setter” keywords do in an Apex class?
a) They define a custom serialization and deserialization mechanism for the class.
b) They allow access to the private variables of a class from outside the class.
c) They enable encapsulation of class properties and provide controlled access to them.
d) They allow a class to be instantiated without invoking the constructor.

A

Answer: c) They enable encapsulation of class properties and provide controlled access to them.

111
Q

How can you implement a “for-each” loop for an Apex collection?
a) By using a traditional “for” loop with an index variable.
b) By using the “for-each” keyword with a collection variable.
c) By implementing the “Iterator” interface on the collection.
d) By using a “while” loop with a condition that iterates over the collection.

A

Answer: a) By using a traditional “for” loop with an index variable.

112
Q

What is the purpose of using a Flow “Record Update” element in Salesforce?
a) It allows you to update records based on a specific condition in a flow.
b) It creates a new record based on the data entered in the flow.
c) It updates a record without validation or workflow rules being triggered.
d) It allows you to define the field-level security for a record update.

A

Answer: a) It allows you to update records based on a specific condition in a flow.

113
Q

How can you invoke a flow from a custom Lightning component in Salesforce?
a) By using the “lightning:flow” tag and specifying the flow’s name.
b) By including a “Run Flow” action in the Lightning component’s controller.
c) By defining a custom Aura event and firing it from the component.
d) Flows cannot be invoked from custom Lightning components.

A

Answer: a) By using the “lightning:flow” tag and specifying the flow’s name.

114
Q

What is the purpose of a “Record Trigger” in a Salesforce Process Builder?
a) It defines the criteria that must be met to execute the process.
b) It specifies the actions to be taken when a record is created, edited, or deleted.
c) It determines the order of execution for multiple processes.
d) It defines the access control for the process.

A

Answer: b) It specifies the actions to be taken when a record is created, edited, or deleted.

115
Q

What is a correct pattern to follow when programming in Apex on a multitenant platform?
a) Use the with sharing keyword when declaring an Apex class to prevent access from other server tenants.
b)Use queries to select the fewest fields and records possible to avoid exceeding governor limits
c)Create Apex code in a separate environment from the schema to reduce deployment errors
d)Run Data Manipulation Language (DML) on one record at a time to avoid possible data concurrency issues.

A

b) Use queries to select the fewest fields and records possible to avoid exceeding governor limits

116
Q

Which two types of code represent the controller in model-view-controller (MVC) architecture on the Lightning Platform?
a)StandardController system methods that are referenced by Visualforce
b)JavaScript that is used to make a menu item display itself
c)A static resource that contains Cascading Style Sheets (CSS) and images
d)Custom Apex and JavaScript code that is used to manipulate data

A

a) Standard Controller system methods that are referenced by Visualforce

b)Custom Apex and JavaScript code that is used to manipulate data

117
Q

When an account record changes, what should a developer do to update a picklist field on a related opportunity?

a)Create a workflow rule with a field update
b)Create a Visualforce page
c)Create a Lightning component
d)Create a record-triggered Flow

A

d) Create a record-triggered flow

118
Q

A developer is creating an application to track engines and their parts. An individual part can be used in different types of engines. Which data model should the developer use to track the data and to prevent orphan records?

a)Create a master-detail relationship to represent the one-to-many model of engines to parts

b)Create a lookup relationship to represent how each part relates to the parent engine object

c)Create a junction object using two lookup relationships to relate many engines to many parts

d)Create a junction object using two master0detail relationships to relate many engines to many parts

A

d)Create a junction object using two master-detail relationships to relate many engines to many parts

119
Q

A company wants a recruiting app and data model for job candidates and interviews, with the following requirements. Display the total number of interviews on each candidate record. Define security on interview records that’s independent from the security on candidate records.
Which two actions should a developer takt to achieve this?

a)Create a lookup relationship between the Candidate and Interview objects
b)Create a master-detail relationship between the Candidate and Interview objects
c)Create a roll-up summary field on the Candidate object that counts interview records
d)Create a trigger on the Interview object that updates a field on the Candidate object

A

a) Create a lookup relationship between the Candidate and Interview objects

b) Create a trigger on the Interview object that updates a field on the Candidate object.

120
Q

The sales management team requires that users populate the Lad Source field of the lead record when they convert a lead. What should a developer create to ensure that users do this?

a)Flow trigger
b)Validation rule
c) Formula field
d)Apex trigger

A

b)Validation rule

121
Q

The sales management team hires a new intern. The intern is not allowed to view opportunities, but needs to see the most recent closed date of all child opportunities when viewing an account record. What should a developer do to meet this requirement?

a) Write a Flow on the Opportunity object that updates a field on the parent account.
b) Create a roll-up summary field on the Account object that performs a MAX on the Opportunity Close Date field
c) Create a formula field on the Account object that performs a MAX on the Opportunity Closed date field
d) Create a trigger on the Account object that queries the close date of the most recent opportunities.

A

b) Create a roll-up summary field on the Account object that performs a MAX on the Opportunity Close Date field

Fields that users can’t see because of field-level security settings on the details record are still calculated in a roll-up summary field

122
Q

A developer has this trigger that fires after insert and creates a child case whenever a new case is created. Which unexpected behavior happens after the code block executes?

List<Case> childCases = new List<Case>();
for (Case parent : Trigger.new) {
Case child = new Case(ParentId = parent.Id, Subject = parent.Subject);
childCases.add( child );
}
insert childCases;</Case></Case>

a) A child case is created for each parent case in Trigger.new
b) The trigger enters an infinite loop and eventually fails
c) Multiple child cases are created for each parent case in Trigger.new
d)The trigger fails if the Subject field on the parent is blank

A

b) The trigger enters an infinite loop and eventually fails.

dumbass but CASE NEW inside of a for loop that is triggered when NEW CASES are created. face palm