Salesforce Platform Developer I Flashcards
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
c) 500
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
b) DateTime
Which of the following is not a valid Salesforce Object relationship?
a) Master-Detail
b) Lookup
c) Parent-Child
d) External Lookup
d) External Lookup
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
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
What is the maximum batch size for a batch Apex job?
a) 100
b) 200
c) 500
d) 1000
Which keyword is used in Apex to prevent a variable from being modified?
a) final
b) const
c) static
d) private
Which keyword is used in Apex to prevent a variable from being modified?
a) final
b) const
c) static
d) private
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) to expose an Apex method to be invoked from Lightning Components
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
b) 100
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.
b) Record visibility is determined by the class’s sharing settings.
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
c) Lightning Web Components
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) To expose an Apex method to be invoked from Lightning components
Which keyword is used in Apex to prevent a variable from being modified?
a) final
b) const
c) static
d) private
a) final
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
b) To automate business processes when specific events occur
What is the maximum batch size for a batch Apex job?
a) 100
b) 200
c) 500
d) 1000
d) 1000
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
Answer: d) 50 characters
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
Answer: c) Many-to-Many Relationship
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)
Answer: c) Text Area (Long)
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.
Answer: a) It enforces sharing rules on queries for the object.
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
Answer: c) Before the record is inserted or updated in the database.
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
Answer: a) Iterable
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
Answer: d) 20
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.
Answer: b) To grant access to records owned by a specific user.
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
Answer: b) Roles
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
Answer: d) Page Initialization → Constructor → Getter Methods → Action Methods → Setter Methods → Page Rendering
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
Answer: c) Apex code can perform complex logic and interact with external systems, while workflows and validation rules have predefined functionality
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.
Answer: d) Utilize selective WHERE clauses to filter data effectively.
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.
Answer: a) It allows methods to be called asynchronously to run in the background.
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.
Answer: a) To process large data sets in smaller chunks for better performance.
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.
Answer: a) By using Apex triggers to handle approval-related logic and updates.
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.
Answer: b) They reset the governor limits for each individual test method.
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.
Answer: a) A static variable retains its value across different execution contexts.
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.
Answer: b) Triggering real-time business processes based on record updates.
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.
Answer: c) Set the “enforceFieldLevelSecurity” parameter to true in the SOQL query.
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
Answer: b) Observer Pattern
Which data type is used for the “Name” field of a custom object in Salesforce?
a) Text
b) Auto Number
c) Email
d) Phone
Answer: b) Auto Number
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
Answer: c) 40 characters
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
Answer: a) using the “final” keyword
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.
Answer: a) It provides information about the records that were inserted, updated, or deleted.
- 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
Answer: d) Scheduled Apex
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
Answer: a) By using Validation Rules
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
Answer: b) By using Trigger.new
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.
Answer: a) It stops the flow and cancels all pending actions.
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
Answer: b) lightning:component
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.
Answer: b) It handles user interactions and component behavior on the client-side.
Which attribute is used to bind data to a Lightning component attribute?
a) data-bind
b) value
c) aura:value
d) aura:attribute
Answer: d) aura:attribute
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.
Answer: b) By setting the theme in the app’s properties on the Salesforce Setup page
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.
Answer: b) To validate the functionality of Apex code before deployment.