Salesforce PDI 취득을 위한 DUMP 공부
- v2023-03-21.q230 / 1-50문항
1. In the code below, what type does Boolean inherit from?
Boolean b= true;
A. Class
B. Object
C. String
D. Enum
13. A developer declared a class as follow.
public class wysiwyg { // Properties and methods including DML }
Which invocation of a class method will obey the organization-wide defaults and sharing settings
for the running user in the Salesforce Organization?
A. A developer using the Developer Console that invokes a method in this class from the execute anonymous window
B. A Visualforce page with an Apex controller that invokes a method in this class
C. An Apex Trigger that invokes a helper method in this class
D. A user on an external system that has an API call into Salesforce that invokes a method in this class
Apex code that is executed with the executeAnonymous call and Connect in Apex always execute using the sharing rules of the current user.
14. Which three options allow a developer to use custom styling in a Visualforce page? (Choose three.)
A. A static resource
B. <apex:stylesheets>tag
C. <apex:style>tag
D. <apex:stylesheet> tag
E. Inline CSS
15. A developer has a single custom controller class that works with a Visualforce Wizard to support creating and editing multiple sObjects. The wizard accepts data from user inputs across multiple Visualforce pages and from a parameter on the initial URL. Which statement is unnecessary inside the unit test for the custom controller?
> The wizard는 여러 Visualforce 페이지의 사용자 입력과 초기 URL의 매개 변수에서 데이터를 받아들입니다.
> 사용자정의 컨트롤러에 대해 단위테스트 내에서 불필요한 설명은?
A. String nextPage = controller.save().getUrl();
public static testMethod void testMyController() {
PageReference pageRef = Page.success;
A도 사용하는 것 같은데, 왜 답이 A랑 D라고 하는건지 모르겠다!!!
B. ApexPages.currentPage().getParameters().put('input', 'TestValue')
// Add parameters to page URL
ApexPages.currentPage().getParameters().put('qp', 'yyyy');
C. Test.setCurrentPage(pageRef)
public static testMethod void testMyController() { PageReference pageRef = Page.success; Test.setCurrentPage(pageRef);
D. Public ExtendedController (ApexPages.StandardController cntrl) { }
Testing Custom Controllers and Controller Extensions | Visualforce Developer Guide | Salesforce Developers
Controller extensions and custom controllers, like all Apex scripts, should be covered by unit tests. Unit tests are class methods that verify whether a particular piece of code is working properly. Unit test methods take no arguments, commit no data to th
developer.salesforce.com
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_get_request.htm
Order of Execution for Visualforce Page Get Requests | Visualforce Developer Guide | Salesforce Developers
A get request is an initial request for a page either made when a user enters an URL or when a link or button is clicked that takes the user to a new page. The following diagram shows how a Visualforce page interacts with a controller extension or a custom
developer.salesforce.com
16. A developer must create a ShippingCalculator class that cannot be instantiated and must include
a working default implementation of a calculate method, that sub-classes can override. What is
the correct implementation of the ShippingCalculator class?
> 개발자는 인스턴스화할 수 없는 ShippingCalculator class 만들어야 함
> 하위 클래스가 재정의할 수 있는 a calculate method의 바른 구현은?
Overriding a virtual method allows you to provide a different implementation for an existing method
a virtual method 를 재정의하면 기존 메서드에 대해 다른 구현을 제공할 수 있다.
A. Public abstract class ShippingCalculator {
public virtual void calculate() { /*implementation*/ }
}
B. Public abstract class ShippingCalculator {
public abstract calculate() { /*implementation*/ }
}
C. Public abstract class ShippingCalculator {
public void calculate() { /*implementation*/ }
}
D. Public abstract class ShippingCalculator {
public override calculate() { /*implementation*/ }
}
Extending a Class
A class that extends another class inherits all the methods and properties of the extended class. In addition, the extending class can override the existing virtual methods by using the override keyword in the method definition. Overriding a virtual method allows you to provide a different implementation for an existing method. This means that the behavior of a particular method is different based on the object you’re calling it on.
This is referred to as polymorphism. 이를 '다형성' 이라고 한다.
19. Which action can a developer take to reduce the execution time of the following code?
List<account> allaccounts = [select id from account]; list<account> allcontacts = [select id,
accountid from contact]; for (account a :allaccounts){ for (contact c:allcontacts){ if(c.accountid =
a.id){ //do work } } }
A. Create an apex helper class for the SOQL
B. Add a group by clause to the contact SOQL
C. Put the account loop inside the contact loop
D. Use a map <id,contact> for allaccounts
21. A developer has a unit test that is failing. To identify the issue, the developer copies the code
inside the test method and executes it via the Execute Anonymous Apex Tool. The code then
executes without failing. Why did the unit test failed, but not the Execute Anonymous?
A. The test method relies on existing data in the database
B. The test method use a try/catch block
C. The test method calls an @future method.
D. The test method has a syntax error in the code.
22. A developer creates a custom exception as shown below:
What are two ways the developer can fire the exception in Apex? Choose 2 answers
A. New ParityException( );
B. Throw new parityException ( );
C. Throw new ParityException (parity does not match);
D. New ParityException (parity does not match);
23. A developer created a Visualforce page and custom controller to display the account type field as
shown below. Custom controller code: public class customCtrlr{ private Account theAccount;
public String actType; public customCtrlr() { theAccount = [SELECT Id, Type FROM Account
WHERE Id = :apexPages.currentPage().getParameters().get('id')]; actType = theAccount.Type; } }
Visualforce page snippet: The Account Type is {!actType} The value of the account type field is
not being displayed correctly on the page. Assuming the custom controller is property referenced
on the Visualforce page, what should the developer do to correct the problem?
A. Add a getter method for the actType attribute.
B. Add with sharing to the custom controller.
C. Change theAccount attribute to public.
D. Convert theAccount.Type to a String.
24. Which three statements are true regarding custom exceptions in Apex? (Choose three.)
A. A custom exception class cannot contain member variables or methods.
B. A custom exception class must extend the system Exception class.
C. A custom exception class name must end with "Exception".
D. A custom exception class can extend other classes besides the Exception class.
E. Acustom exception class can implement one or many interfaces.
- To create your custom exception class, extend the built-in Exception class and make sure your class name ends with the word Exception, such as “MyException” or “PurchaseException”. (-> C 선지에 관한 설명)
- All exception classes extend the system-defined base class Exception, and therefore, inherits all common Exception methods. (-> B 선지에 관한 설명)
- Exceptions can be top-level classes, that is, they can have member variables, methods and constructors, they can implement interfaces, and so on. (-> E선지에 관한 설명)
Create Custom Exceptions | Apex Developer Guide | Salesforce Developers
Custom exceptions enable you to specify detailed error messages and have more custom error handling in your catch blocks. Exceptions can be top-level classes, that is, they can have member variables, methods and constructors, they can implement interfaces,
developer.salesforce.com
25. A custom picklist field, Food_Preference__c, exist on a custom object. The picklist contains the
following options: 'Vegan','Kosher','No Preference'. The developer must ensure a value is
populated every time a record is created or updated. What is the most efficient way to ensure a
value is selected every time a record is saved? 레코드가 저장될 때마다가 값이 선택되도록 하는 가장 효율적인 방법
A. Mark the field as Required on the object's page layout.
B. Set "Use the first value in the list as the default value" as True.
C. Set a validation rule to enforce a value is selected.
D. Mark the field as Required on the field definition. 필드정의에서 필드를 '필수항목'으로 표시
26. An Opportunity needs to have an amount rolled up from a custom object that is not in a masterdetail relationship.
How can this be achieved?
A. Write a trigger on the child object and use a red-black tree sorting to sum the amount for all
related child objects under the Opportunity.
B. Write a trigger on the child object and use an aggregate function to sum the amount for all
related child objects under the Opportunity
C. Write a Process Builder that links the custom object to the Opportunity.
D. Use the Streaming API to create real-time roll-up summaries.
B. 하위 개체에 대한 트리거를 작성하고 집계 함수를 사용하여 기회 아래에 있는 모든 관련 하위 개체의 금액을 합산합니다.
28. Universal Containers hires a developer to build a custom search page to help user- find the Accounts they want. Users will be able to search on Name, Description, and a custom comments field.
Which consideration should the developer be aware of when deciding between SOQ1 Mid SOSL ?
Choose 2 answers
A. SOSL is faster for tent searches.
B. SOQL is faster for text searches.
C. SOQL is able to return more records.
D. SOSL is able to return more records.
If you’ve built a custom UI for Salesforce, you can use the Salesforce Object Query Language (SOQL) and Salesforce Object Search Language (SOSL) APIs to search your organization’s Salesforce data.
- SOSL is generally faster than SOQL if the search expression uses a CONTAINS term
29. Account acct = {SELECT Id from Account limit 1}; Given the code above, how can a developer
get the type of object from acct?
A. Call "acct.getsObjectType()"
B. Call "Account.SobjectType"
C. Call "Account.getSobjectType()"
D. Call "acct.SobjectType"
Apex code:
public class getSobjectClass {
public static void getSobjectMethod()
{
Account acc=[select id,Name from Account limit 1];
String typeOfSobject=acc.getSobjectType().getDescribe().getName();
System.debug('acc type>>>'+typeOfSobject);
}
}
✨the below metioned contents is correct answer
1) "Account.getSobjectType()"
2) (위 코드와 같이 작성한다면) "acct.getSobjectType()"
Therefore the correct answer is C.
30. A developer writes a trigger on the Account object on the before update event that increments a count field. A workflow rule also increments the count field every time that an Account is created or update. The field update in the workflow rule is configured to not re-evaluate workflow rules. What is the value of the count field if an Account is inserted with an initial value of zero, assuming no other automation logic is implemented on the Account?
A. 1
B. 3
C. 2
D. 4
33. What is the result when a Visualforce page calls an Apex controller, which calls another Apex
class, which then results in hitting a governor limit?
A. All changes before a savepoint are saved.
B. All changes are saved in the first Apex class.
C. Any changes up to the error are saved.
D. Any changes up to the error are rolled back.
35. Which query should a developer use to obtain the Id and Name of all the Leads, Accounts, and
Contacts that have the company name "Universal Containers"?
A. SELECT lead(id, name), account(id, name), contact(id,name) FROM Lead, Account, Contact
WHERE Name = 'Universal Containers'
B. FIND 'Universal Containers' IN CompanyName Fields RETURNING lead(id,name), account
(id,name), contact(id,name)
C. FIND 'Universal Containers' IN Name Fields RETURNING lead(id, name), account(id,name),
contact(id,name)
D. SELECT Lead.id, Lead. Name, Account.id, Account.Name, Contact.Id, Contact. Name FROM
Lead, Account, Contact WHERE CompanyName = 'Universal Containers'
C 선지가 원래 'FIND' 가 앞에 있는 것 같음. 나는 대체 IND가 뭐지 이러고 찾아보고 있었는데 SONL의 FIND 인 것 같다.
A. Bulk API
B. Tooling API
C. Setup Menu
D. Salesforce DX
E. Metadata API.
답 : B,C,D
37. A recursive transaction is limited by a DML statement creating records for these two objects:
(Acconts, Contacts 개체 생성에 대한) DML 상태에 따라 재귀 트랜잭션을 제한을 받는다.
1. Accounts
2. Contacts
The Account trigger hits a stack depth of 16.
Which statement is true regarding the outcome of the transaction? 트랜잭션의 결과에 대해 옳은 것은?
A. The transaction fails and all the changes are rolled back.
B. The transaction fails only if the Contact trigger stack depth is greater or equal to 16.
C. The transaction succeeds and all the changes are committed to the database.
D. The transaction succeeds as long as the Contact trigger stack depth is less than 16.
관련개념 : Per-Transaction Apex Limits
✔️ Total stack depth for any Apex invocation that recursively fires triggers due to insert, update, or delete statements
- Synchronous Limit : 16
- Asynchronous Limit : 16
Execution Governors and Limits | Apex Developer Guide | Salesforce Developers
Because Apex runs in a multitenant environment, the Apex runtime engine strictly enforces limits so that runaway Apex code or processes don’t monopolize shared resources. If some Apex code exceeds a limit, the associated governor issues a runtime excepti
developer.salesforce.com
39. Which two automation tools include a graphical designer? Choose 2 answers
A. Approvals
B. Process builder
C. Flow builder
D. Workflows
42. A developer must provide a custom user interface when users edit a Contact. Users must be able
to use the interface in Salesforce Classic and Lightning Experience. What should the developer do to provide the custom user interface?
A. Override the Contact's Edit button with a Visualforce page in Salesforce Classic and a
Lightning page inLightning Experience.
B. Override the Contact's Edit button with a Lightning page in Salesforce Classic and a
Visualforce page in Lightning Experience.
C. Override the Contact's Editbutton with a Lightning component in Salesforce Classic and a
Lightning component in Lightning Experience.
D. Override the Contact's Edit button with a Visualforce page in Salesforce Classic and a
Lightning component in Lightning Experience.
43. A developer is building custom search functionality that uses SOSL to search account and contact records that match search terms provided by the end user. The feature is exposed through a Lightning web component, and the end user is able to provide a list of terms to search.
Consider the following code snippet:
PDI Exam Dumps | A developer is building custom search functionality that uses SOSL to search account and contact records
Salesforce.PDI.v2023-03-21.q230/No.43: A developer is building custom search functionality that uses SOSL to search account and contact records that match search terms provided by the end user. The feature is exposed through a Lightning web component, and
www.freecram.net
What is the maximum number of search terms the end user can provide to successfully execute the search without exceeding a governor limit?
A. 2,000
B. 20
C. 200
D. 150
45. Which Apex collection is used to ensure that all values are unique?
A. An Enum
B. A List
C. An sObject
D. A Set
Set is an unordered collection. 세트는 순서가 지정되지 않은 컬렉션.
- It is a unique set of values that do not have any duplicates. 중복되지 않는 고유한 값 집합
- If you want no duplicates in your collection, then you should opt for this collection. 컬렉션에 중복 항목이 없도록 하려면 이 컬렉션을 선택해야 합니다.
47. Given the following trigger implementation:
trigger leadTrigger on Lead (before update){
final ID BUSINESS_RECORDTYPEID = '012500000009Qad';
for(Lead thisLead : Trigger.new){
if(thisLead.Company != null &&thisLead.RecordTypeId != BUSINESS_RECORDTYPEID)
{ thisLead.RecordTypeId = BUSINESS_RECORDTYPEID;}
}
}
The developer receives deployment errors every time a deployment is attempted from Sandbox to
Production. What should thedeveloper do to ensure a successful deployment?
샌드박스 -> 프로덕션 으로 배포할 때마다 에러남. 성공적인 배포를 하려면 어떻게 해야 하는가?
- 사람들의 의견은 A, B 로 엇갈림. B라고 하는 사람들의 주장은 하드코딩은 좋은 방법이 아니다! 라는 주장!
A. Ensure a record type with an ID of BUSINESS_RECORDTYPEID exists on Production prior to
deployment.
B. Ensure BUSINESS_RECORDTYPEID is retrieved using Schema.Describe calls.
C. Ensure BUSINESS_RECORDTYPEIDis pushed as part of the deployment components.
D. Ensure the deployment is validated by a System Admin user on Production.
- 시험에서는 A를 정답으로 할 것 같다는 생각이 들고, 실무에서는 B부분의 중요도가 높을 것 같음.
48. A developer creates an Apex Trigger with the following code block:
List<Account> customers = new List<Account>();
For (Order__c o: trigger.new){Account a = [SELECT Id, Is_Customer__c FROM Account WHERE Id:o.Customer__c];
a.Is_Customer__c = true;customers.add(a);}
Database.update(customers,false);
The developer tests the code using Apex Data Loader and successfully loads 10 Orders.
Then, the developer loads 150 Orders. How many Orders are successfully loaded when the
developer attempts to load the 150 Orders?
A. 1
B. 0
C. 150
D. 100
50. Refer to the following code snippet for an environment has more than 200 Accounts belonging to
the Technology' industry:
for(Account thisAccount : [SELECT Id, Industry FROM Account LIMIT 150]){
if(thisAccount.Industry == 'Technology'){
thisAccount.Is_Tech__c = true;
}
update thisAccount;
}
When the code execution, which two events occur as a result of the Apex transaction?
이 코드를 실행할 때, Apex 트랜잭션 결과로 발생하는 2가지 envet
Choose 2 answers
A. The Apex transaction fails with the following message. "SObject row was retrieved via SOQL
without querying the requested field Account.Is.Tech__c''.
B. If executed In a synchronous context, the apex transaction is likely to fall by exceeding the
DHL governor limit. (-> DHL오타인 것 같음. 'DML')
C. The Apex transaction succeeds regardless of any uncaught exception and all processed
accounts are updated.
D. If executed in an asynchronous context, the apex transaction is likely to fall by exceeding the
DML governor limit
update => DML 이슈를 발생시킨다.
B is Correct. If executed In a synchronous context, the apex transaction is likely to fall by exceeding the
DML governor limit. => B의 Synchronous Limit이 100개이므로, 문제에서 제시하는 150개를 가져다주지 못함.
D is Wrong LIMIT -> Total number of DML statements issued : 동기/비동기 150
- 그러므로 D선지는 틀림. 150개는 Limit 걸리지 않음
Description |
Synchronous Limit | Asynchronous Limit |
Total number of SOQL queries issued (한 번에 날릴 수 있는 SOQL쿼리 총합) |
100 | 200 |
Total number of records retrieved by SOQL queries (SOQL 쿼리로 검색된 총 레코드 수) |
50,000 | 50,000 |
✨the below metioned contents is correct answer
- A에서 'Account.Is.Tech__c' 필드를 검색하지 않고
Calls to the following methods count against the number of DML statements issued in a request.
- Approval.process
- Database.convertLead
- Database.emptyRecycleBin
- Database.rollback
- Database.setSavePoint
- delete and Database.delete
- insert and Database.insert
- merge and Database.merge
- undelete and Database.undelete
- update and Database.update
- upsert and Database.upsert
- EventBus.publish for platform events configured to publish after commit
- System.runAs
'Salesforce > Salesforce Certification' 카테고리의 다른 글
Salesforce MCA 자격증공부 (0) | 2024.05.16 |
---|---|
[PDI I]_51-100문항_v230321.q230 (0) | 2024.04.12 |
[PDI I]_101-230문항_v230321.q230 (0) | 2024.04.04 |