PD1 Flashcards
An Org has a single account named ’NoContacts’ that has no related contacts. Given the query: List accounts = [Select ID, (Select ID, Name from contacts) from Account where Name= “NoContacts’];
a) Accounts[0] is Null.
b) Accounts[0] contacts is invalid Apex.
c) accounts[0] contacts is an empty list.
d) A QueryException is thrown
a) Accounts[0] is Null
What are three ways for a developer to execute tests in an org? choose 3 answers
a) Bulk API
b) MetaData API
c) Tooling API
d) Developer console
e) Setup menu
a) Bulk API
b) MetaData API
d) Developer console
Which approach should be used to provide test data for a test class?
a) Use a test data factory class to create test data
b) Query for existing records in the database
c) Access data in @TestVisible class variables
d) Execute anonymous code blocks that create data.
a) Use a test data factory class to create test data
When should an apex Trigger be required instead of a process builder process?
a) When an action needs to be taken on a delete or undelete, or before a DML operation is executed
b) When a record needs to be created
c) When a post to chatter needs to be created
d) When multiple records related to the triggering record need to be updated
a) When an action needs to be taken on a delete or undelete, or before a DML operation is executed
Which set of roll-up types are available when creating a roll up summary field?
a) COUNT, SUM, MIN, MAX
b) AVERAGE, COUNT, SUM, MIN, MAX
c) AVERAGE, SUM, MIN, MAX
d) SUM, MIN, MAX
a) COUNT, SUM, MIN, MAX
Which three declarative fields are correctly mapped to variable types in Apex? Choose 3 answers
a) Number maps to integer
b) Textarea maps to list of type String
c) Checkbox maps to Boolean
d) Date/Time maps to Datetime
e) Number maps to Decimal
a) Number maps to integer
c) Checkbox maps to Boolean
d) Date/Time maps to Datetime
Using the schema builder, a developer tries to change the API name of a field that is referenced in an Apex Test Class. What is the end results?
a) The API name of the field is changed, and a warning is issued to update the class
b) The API name of the field and the reference in the test class is updated
c) The API name of the field and the reference in the test class is changed
d) The API name is not changed and there are no other impacts.
a) The API name of the field is changed, and a warning is issued to update the class
Why would a developer consider using a custom controller over a controller extension?
a) To increase the SOQL query governor’s limits
b) To leverage built-in functionality of a standard controller
c) To enforce user sharing settings and permissions
d) To implement all of the logic for a page and bypass default salesforce functionality
d) To implement all of the logic for a page and bypass default salesforce functionality
Which two platform features allow for the use of unsupported languages? Choose 2 answers.
a) App.json
b) Docker
c) Heroku ACM
d) Buildpacks
b) Docker
c) Heroku ACM
. A developer writes the following code:
List acc= [SELECT id FROM Account LIMIT 10];
Delete acc;
Database.emptyRecyclebin(acc);
System.Debug(Limits.getDMLStatemnets()+’,’+ Limits.getLimitDMLStatements());
What is the result of the debug statement?
a) 1,150
b) 2,200
c) 1,100
d) 2,150
d) 2,150
A developer created a visualforce page and a custom controller with methods to handle different buttons and events that can occur on the page. What should the developer do to deploy to production?
a) Create a test page that provides coverage of the custom controller
b) Create a test class that provides coverage of the visualforce page
c) Create a test class that provides coverage of the custom controller
d) Create a test page that provides coverage of the visualforce page
c) Create a test class that provides coverage of the custom controller
A developer needs to create a visualforce page that displays case data. The page will be used by both support reps and support managers. The support rep profile does not allow visibility of the customer_Satisfaction_c Field, but the support manager profile does. How can the developer create the page to enforce field level security and keep future maintenance to a minimum?
a) Create one visualforce page for use by both profiles
b) Use a new support manager permission sets
c) Create a separate visualforce page for each profile
d) Use a custom controller that has the with sharing keywords
d) Use a custom controller that has the with sharing keywords
A developer executes the following query in Apex to retrieve a list of contacts for each account:
List accounts = [ Select ID, Name, (Select ID, Name from Contacts) from Account];
Which two exceptions may occur when it executes? Choose 2 answers
a) SOQL query limit exception due to the number of queries
b) CPU limit exception due to the complexity of the query
c) SOQL query limit exception due to the number of contacts
d) SOQL query limit exception due to the number of accounts
c) SOQL query limit exception due to the number of contacts
d) SOQL query limit exception due to the number of accounts
Which three options allow a developer to use stylesheets?
a) A static resource
b) tag
c) tag
d) Inline CSS
e) tag
a) A static resource
b) tag
e) tag
A platform developer needs to write an apex method that will only perform an action if a record is assigned to a specific Record Type. Which two options allows the developer to dynamically determine the ID of the required Record Type by its name? Choose 2 answers
a) Hardcode the ID as a constant in an Apex class
b) Execute a SOQL query on the RecordType Object
c) Use the getRecordTypeInfosByName()method in the DescribeSObjectResult Class.
d) Make an outbound web service call to the SOAP API.
b) Execute a SOQL query on the RecordType Object
c) Use the getRecordTypeInfosByName()method in the DescribeSObjectResult Class.
Which SOQL query successfully returns the Accounts grouped by name?
a) Select type, Max(CreatedDate) FROM Account GROUP BY Name
b) Select Name, Max(CreatedDate) FROM Account GROUP BY Name
c) Select Id, type, Max(CreatedDate) FROM Account GROUP BY Name
d) Select type, Name Max(CreatedDate) FROM Account GROUP BY Name LIMIT 5
b) Select Name, Max(CreatedDate) FROM Account GROUP BY Name
Which approach should a developer use to add pagination to a visualforce page?
a) The extension attribute for a page
b) A standardController
c) The action attribute for a page
d) A StandardSetController
d) A StandardSetController
A Developer needs to test an invoicing system integration. After reviewing the numbers of transaction required for the test, the developer estimates that the test data will total about 2GB of data storage. Production data is not required for integration testing. Which two environments meet the requirements for testing? Choose 2 answers
a) Full sandbox
b) Developer sandbox
c) Developer Pro Sandbox
d) Developer Edition
e) Partial Sandbox
a) Full sandbox
e) Partial Sandbox
How should a developer prevent a recursive trigger?
a) Use a private Boolean variable
b) Use a “one trigger per object” pattern.
c) Use a trigger handler
d) Use a static Boolean variable
d) Use a static Boolean variable
What is a capability of the Tag that is used for loading external javascript libraries in lightning components? Choose 3 answers
a) Loading scripts in parallel
b) One-time loading from duplicate scripts
c) Loading files from documents
d) Specifying loading order
e) Loading externally hosted scripts
a) Loading scripts in parallel
b) One-time loading from duplicate scripts
d) Specifying loading order
What is a requirement for a class to be used as a custom visualforce controller?
a) Any top-level Apex class that has a constructor that returns a PageReference
b) Any top-level Apex class that implements the controller interface
c) Any top-level Apex class that has a default, no-argument constructor
d) Any top-level Apex class that extends a PageReference
d) Any top-level Apex class that extends a PageReference
The operation manager at a construction company uses a custom object called Machinery to manage the usage and maintenance of its cranes and other machinery. The manager wants to be able to assign machinery to different construction jobs, and track the dates and cost associated with each job. More than one piece of machinery can be assigned to one construction job. What should a developer do to meet these requirements?
a) Create a lookup field on the machinery object to the construction job object
b) Create a junction object with Master-Detail Relationship to both the machinery object and the construction job object.
c) Create a lookup field on the construction job object to the machinery object
d) Create a Master-Detail lookup field on the machinery object to the construction job object
c) Create a lookup field on the construction job object to the machinery object
Which three tools can deploy metadata to productions? Choose 3 answers.
a) Data Loader
b) Change set from sandbox
c) Change set from developer org
d) Force.com IDE
e) Metadata API
b) Change set from sandbox
d) Force.com IDE
e) Metadata API
How should a developer create a new custom exception class?
a) Public class CustomException extends Exception{}
b) CustomException ex = new (CustomException) Exception();
c) (Exception) CustomException ex = new Exception();
d) Public class CustomException implements Exception{}
a) Public class CustomException extends Exception{}
Which two number expression evaluate correctly? Choose 2 answers
a) Integer I = 3.14159;
b) Decimal D = 3.14159;
c) Long I = 3.14159;
d) Double D =3.14159;
b) Decimal D = 3.14159;
d) Double D =3.14159;
What are the eight officially supported languages on the Heroku Platform?
a) Lisp, PHP, Node, Ruby, Scala, Haskell, Go, Erlang
b) C#, C++, Node, Ruby, Java, PHP, Go,.Net
c) Node, Ruby, Java, PHP, Python,. Net, C++
d) Node, Ruby, Java, PHP, Python,Go, Scala, Clojure.
d) Node, Ruby, Java, PHP, Python,Go, Scala, Clojure.
A developer wrote a unit test to confirm that a custom exception works properly in a custom controller, but the test failed due to an exception being thrown. What steps should the developer take to resolve the issue and properly test the exception?
a) Use the finally block within the unit test to populate the exception
b) Use database methods with all or none set to False
c) Use try/catch within the unit test to catch the exception
d) Use Test.isRunningTest() within the custom Controller
c) Use try/catch within the unit test to catch the exception
A developer has the controller class below:
Public with sharing class myFooController {
Public integer prop { get; private set;}
}
Which code block will run successfully in an execute anonymous window?
a) myFooController m = new myFooControler ();\
System.asseert(m.prop==null);
b) myFooController m = new myFooControler ();\
System.asseert(m.prop==1);
c) myFooController m = new myFooControler ();\
System.asseert(m.prop==0);
d) myFooController m = new myFooControler ();\
System.asseert(m.prop=!null);
a) myFooController m = new myFooControler ();\
System.asseert(m.prop==null);
What is a benefit of using an after insert trigger over using a before insert trigger?
a) An after insert trigger allows a developer to bypass validation rules when updating fields on the new records
b) An after insert trigger allows a developer to make a callout to an external service.
c) An after insert trigger allows a developer to insert other objects that reference the new records
d) An after insert trigger allows a developer to modify fields in the new record without a query.
c) An after insert trigger allows a developer to insert other objects that reference the new records
While writing a test class that covers an OpportunityLineItem trigger, a Developer is unable to create a standard Pricebook since one already exist in the org. how should the developer overcome this problem?
a) Use @IsTest(SeeAllData=true) and delete the existing standard Pricebook.
b) Use @TestVisible to allow the test method to see the standard Pricebook.
c) Use Test.getStandardPricebbokId()to get the standard Pricebook ID.
d) Use Test.loaddata() and a Static Resource to load a standard Pricebook
c) Use Test.getStandardPricebbokId()to get the standard Pricebook ID.
What is the correct invocation to push code to the app sushi-prod from the command line?
a) Heroku push - - app sushi-prod
b) git push master
c) Heroku git push master
d) git push heroku master - - app sushi-prod
d) git push heroku master - - app sushi-prod
When an Account’s custom picklist field called Customer Sentiment is changed to a value of “Confused,” a new related Cases should automatically be created. Which two methods should a developer use to create this case? Choose two answers
a) Process Builder
b) Custom Button
c) Apex Trigger
d) Workflow Rule
a) Process Builder
c) Apex Trigger
How can a developer set up a debug log on a specific user?
a) Ask the user for access to their account credentials, log in as the user and debug the issue.
b) Create apex code that logs code actions into a custom object
c) It is not possible to setup debug lots for users other than yourself.
d) Set up a trace flag for the user, and define a logging level and time period for the trace
d) Set up a trace flag for the user, and define a logging level and time period for the trace.
A developer is asked to set a Picklist field to ‘Monitor’ on any new Leads owned by a subset of Users. How should the developer implement this request?
a) Create a lead Workflow Rule Field Update
b) Create an after insert Lead trigger
c) Create a Lead formula field
d) Create a before insert lead Trigger
a) Create a lead Workflow Rule Field Update
When viewing a Quote, the sales representative wants to easily see how many discounted items are included in the Quote Line Items. What should a developer do to meet this requirement?
a) Create a workflow rule on the Quote Line Item Object that updates a field on the parent Quote when the item is discounted
b) Create a roll-up summary field on the Quote Object that performs a SUM on the Quote Line Item Quantity field, filtered for only discounted Quote Line Items.
c) Create a Trigger on the Quote Object that queries the Quantity filed on discounted Quote Line Items
d) Create a formulat field on the Quote Object that performs a SUM on the Quote Line Item Quantity field, filtered for only discounted Quote Line Items.
b) Create a roll-up summary field on the Quote Object that performs a SUM on the Quote Line Item Quantity field, filtered for only discounted Quote Line Items.
A visualforce interface is created for Case Management that includes both standard and custom functionality defined in an Apex class called myControllerExtension. The visualforce page should include which attribute(s) to correctly implement controller functionality?
a) standardController = “case” and extensions =” myControllerExtension”
b) extensions=” myControllerExtension”
c) controller=” myControllerExtension”
d) controller = “case” and extensions =” myControllerExtension”
a) standardController = “case” and extensions =” myControllerExtension”
Which two strategies should a developer use to avoid hitting governor limits when developing in a multi-tenant environment? Choose two answers
a) use variables within Apex classes to store large amounts of data
b) use collections to store all fields from a related object and not just minimally required fields
c) use methods from the “LIMITS” class to monitor governor limits
d) use SOQL for loops to iterate data retrieved from queries that return a high number of rows
a) use variables within Apex classes to store large amounts of data
b) use collections to store all fields from a related object and not just minimally required fields
Which statement results in an Apex compiler error?
a) Map imap = new map ([Select ID from Lead Limit 8]);
b) List s = List { ‘a’,’b’,’c’};
c) Integer a=5, b=6,c,d=7;
d) Date D1 = Date.Today(), d2 = DATE.ValueOf(‘2018-01-01’);
b) List s = List { ‘a’,’b’,’c’};