PD1 Practice Exam

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Which of the following is required when defining an Apex Class Method?Choose 1 answer. A. Access Modifiers B. Return Data type C. Definition Modifiers D. Input parameters

B. Return Data type Access modifiers such as 'public' or 'protected' are optional. Definition modifiers such as 'virtual' and 'abstract' are optional for defining an Apex class or method. The data type of the value returned by the method is required; void can be used if the method does not return a value. A list of input parameters can be specified for the method. The parameters should be enclosed in parentheses () and separated by commas, each preceded by its data type. If there are no parameters, an empty set of parentheses can be used. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_defining_methods.htm

A developer requires a variable numberOfStudents with a constant value of 25 that is accessible only within the Apex class in which it is defined. Which of the following is the best variable declaration?Choose 1 answer. A. global static Integer numberOfStudents = 25; B. private static final Integer numberOfStudents = 25; C. protected final Integer numberOfStudents = 25; D. public Integer numberOfStudents = 25;

B. private static final Integer numberOfStudents = 25; From the statement itself, a variable numberOfStudents is required that has a constant (STATIC, FINAL) value of 25 (INTEGER) and is accessible only within (PRIVATE) the Apex class in which it is defined. Global or public variables become accessible outside the class. Protected variables become accessible by classes that extend the class where they are defined in. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_declaring_variables.htm

Which of the following are valid considerations that a new developer should be aware of when developing in a multi-tenant environment?Choose 2 answers. A. Many customers share the same instance, so queries need to ensure the correct organization id is referenced to return the correct organizational data B. The number of API calls allowed is unlimited C. Governor limits ensure that the amount of CPU time is monitored and limited per customer over a defined time period to ensure that performance in one org is not impacted by another D. Restrictions are enforced on code that can be deployed into a production environment

C & D Although many customers share the same instance, it is not possible for one customer query to return data from another customer. Each row in the table that stores application data includes identifying fields, such as the organization that owns the row (OrgID). The total API requests (calls) per 24-hour period is limited for an org. Governor limits monitor and limit various factors such as CPU time and DML statements to ensure that one org does not impact another. Code cannot be deployed into production unless test code coverage is achieved. https://developer.salesforce.com/page/Multi_Tenant_Architecture https://developer.salesforce.com/docs/atlas.en-us.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_api.htm

Which of the following components are not available to deploy using the Metadata API?Choose 2 answers. A. Global Picklist B. Queues C. Currency Exchange Rates D. Fiscal Year

C & D Certain components cannot be retrieved or deployed with Metadata API, and changes to them must be made manually in each organization. These include components such as Account Teams, Case Team Roles, Currency Exchange Rates, Fiscal Years https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_unsupported_types.htm

Record types have been defined on the Account object. What does this mean?Choose 2 answers. A. Different users can be assigned to each record type B. Different fields can be defined for each record type C. Different page layouts can be assigned for each record type D. Different picklist values can be defined for each record type

C & D Record types allow a different set of picklist values to be defined per record type, as well as different page layouts. Record types are assigned to profiles, not users. https://help.salesforce.com/HTViewHelpDoc?id=customize_recordtype.htm

A developer needs to create a trigger that will throw an error whenever the user tries to delete a contact that is not associated to an account. What trigger event should the developer use?Choose 1 answer. A. After Delete B. Before Insert C. Before Delete D. After Insert

C. Before Delete By using a 'Before Delete' trigger, the request can be validated first by determining whether the record can be deleted or not. If the record should not be deleted, the trigger can throw an error message to terminate the request. 'Before/After Insert' triggers cannot be used as it is only invoked for insert operations. An 'After Delete' trigger cannot be used as it is only invoked after a record has already been deleted. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers.htm

A developer is trying to create a trigger that will set the record type of an Invoice record, prior to insertion, based on the value of the Industry picklist that is selected. What trigger event should the developer use?Choose 1 answer. A. Before Delete B. After Insert C. Before Insert D. After Update

C. Before Insert Before triggers are used to update or validate record values before they are saved to the database. In this case, record type will be set depending on the invoice Industry picklist value prior to insertion. Using After Insert will make the record read-only, so the record type cannot be set. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers.htm https://trailhead.salesforce.com/projects/salesforce_developer_workshop/steps/creating_triggers

Project managers would like to be able to record the total amount of hours each team member works on projects. A team member can be related to multiple projects and each project can have multiple team members. How can the developer achieve this?Choose 1 answer. A. Create a lookup relationship on both objects to a junction object called Project Team Member. B. Create a master-detail relationship on the Project object to the Team Member object. C. Create master-detail relationships from a junction object 'Project Team Member', one to the Project object and one to the Team Member object D. Create a master-detail relationship on Project and Team Member objects to a junction object 'Project Team Member'.

C. Create master-detail relationships from a junction object 'Project Team Member', one to the Project object and one to the Team Member object In this case, as a team member can be related to multiple projects and each project can have multiple team members, a many-to-many relationship is required. Creating the many-to-many relationship consists of creating the junction object (e.g. Project Team Member) and creating two master-detail relationships on Project Team Member, one to Project and one to Team Member. When creating master-detail relationships, the relationship field is created on the detail object. The detail object, in this case is, Project Team Member. https://help.salesforce.com/articleView?id=relationships_manytomany.htm&type=0 https://trailhead.salesforce.com/data_modeling/object_relationships

Which of the following correctly describes how the platform features map to the MVC pattern?Choose 1 answer. A. Model: Standard and Custom objects; View: Pages and Components; Controller: Standard and Custom Controllers B. Model: APEX Classes; View: Pages and Components; Controller: APEX Triggers C. Model: Standard and Custom objects; View: CSS and images; Controller: Standard and Custom Controllers D. Model: Javascript code; View: Visualforce Pages; Controller: Custom APEX code

A The MVC model is implemented with standard and custom objects. The view, or presentation layer, is comprised of Pages and components. The controller, or logic layer, includes any custom controller logic written in Apex as well as standard behavior generated by the Force.com platform for each object in standard controllers. https://developer.salesforce.com/page/An_Introduction_to_Visualforce https://developer.salesforce.com/page/Visualforce:_An_Overview

The code snippet below throws an error during bulk data load. What is the root cause?Choose 1 answer. for (Contact con : Trigger.new) { if (con.PostalCode__c != null) { List<State__c> states = [SELECT StateId__c, PostalCode__c From State__c WHERE PostalCode__c = :con.PostalCode__c]; if (states.size() > 0) { con.StateId__c =states[0].StateId__c; } } } A. SOQL query is located inside the for loop code B. No update DML over list of Contacts C. Variable 'con' is not declared D. Condition is invalid and will always be null

A There is a governor limit that enforces a maximum number of SOQL queries allowed in a single transaction. To help avoid hitting the limit, queries inside for loops should be avoided. If a query is needed, query once, retrieve all the necessary data in a single query, and then iterate over the results. A SOQL for loop can also be used to automatically retrieve and return results in batches of 200 records. The variable 'con' is declared in the for-loop definition. The null check on the PostalCode field is a valid condition. Absence of a DML operation does not throw an error. However, note that for before triggers, a DML statement on the object that invoked the trigger will throw an SObjectException. Also, a DML statement inside the for loop would potentially cause a DML limit exception. https://developer.salesforce.com/page/Apex_Code_Best_Practices

Which iteration components can be used to display a table of data in a Visualforce page?Choose 2 answers. A. <apex:pageBlockTable> B. <apex:dataTable> C. <apex:table> D. <apex:outputTable>

A & B Iteration components work on a collection of items instead of a single value. <apex:pageBlockTable> is a type of iteration component that can be used to generate a table of data, complete with platform styling. The <apex:dataTable> component can be used if custom styling is required. <apex:table> and <apex:outputTable> are not valid components. https://trailhead.salesforce.com/visualforce_fundamentals/visualforce_output_components

Which of the following best describe the Lightning Component framework?Choose 2 answers. A. It has an event-driven architecture B. It is device-aware and supports cross-browser compatibility C. It requires the Aura Components model to build Lightning components D. It automatically upgrades all pre-existing Visualforce pages and components

A & B Lightning Component uses an event-driven architecture for better decoupling between components. Any component can subscribe to an application event, or to a component event they can see. The Lightning Component framework supports the latest in browser technology such as HTML5, CSS3, and touch events and includes responsive components. Converting Visualforce pages and components to Lightning components requires manual work. Aside from the Aura Components model, the Lightning Web Component model can also be used to build Lightning components. https://developer.salesforce.com/docs/atlas.en-us.222.0.lightning.meta/lightning/intro_framework.htm https://trailhead.salesforce.com/lex_dev_overview/lex_dev_overview_lightning_components

Which of the following statements are true about creating unit tests in Apex?Choose 2 answers. A. Lines of code in Test methods and test classes are not counted as part of calculating Apex code coverage. B. Use the System.assert() method to test your application in different user contexts. C. Since data created in tests do not commit, you will not need to delete any data. D. If code uses conditional logic (including ternary operators), one scenario will automatically cover all conditions.

A & C Code coverage is calculated by dividing the number of unique Apex code lines executed during test method execution by the total number of Apex code lines in all trigger and classes. These numbers do not include lines of code within test Methods. Use System.assert() methods to prove that code behaves properly, while, use the runAs() method to test your application in different user contexts. If code uses conditional logic (including ternary operators), execute each branch. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_best_practices.htm https://developer.salesforce.com/page/An_Introduction_to_Apex_Code_Test_Methods

Developers have proposed a recruiting application that covers job vacancies and respective applications. The business wants to display the number of applications of every job vacancy without inheriting the security settings of the parent record (job vacancy). What should the developer do?Choose 2 answers. A. Create a lookup relationship between the two objects. B. Create a master-detail relationship between the two objects. C. Use Process Builder to invoke a flow that counts the job applications and updates the parent field. D. Write an Apex trigger to count the job applications and update the field on the parent object.

A & D A lookup relationship can be created between the job vacancy and job application objects. Then, an Apex trigger can be created on the job application object to handle the record count and field update on the related job vacancy when a job application is created or deleted. A master-detail relationship cannot be used since the detail record would inherit the sharing and security settings of the master record. Although flows can be created to handle the job application count and field update on the parent record, Process Builder can only invoke the flow when the record is created, but not when it is deleted. https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/relationships_among_objects.htm https://help.salesforce.com/articleView?id=fields_defining_summary_fields.htm&language=en_US&type=0&release=204.11.2

Which standard objects in the following list are not supported by DML Operations?Choose 2 answers. A. Profile B. User C. Opportunity Line Item D. Record Type

A & D In Salesforce, some standard objects do not support DML operations but can still be queried. Profile and Record Type are both examples of these. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dml_non_dml_objects.htm

Which of the following statements about the IF-ELSE statement are true?Choose 2 answers. A. An IF-ELSE statement permits a choice to be made between two possible execution paths. B. An IF-ELSE statement provides a secondary path of execution when an IF clause evaluates to true. C. An IF-ELSE statement can have any number of possible execution paths. D. An IF statement can be followed by a discretionary ELSE statement, which executes when the Boolean expression is false.

A & D The IF-ELSE statement permits a choice to be made between two possible execution paths, and not more. The ELSE statement executes (secondary path) when the IF clause is false. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_if_else.htm

What is true in the debug log line below?20:43:52.588 (7632137015) | LIMIT_USAGE | [137] | SOQL | 38 | 100 Choose 2 answers. A. LIMIT_USAGE is the name of the event that occurred. B. It denotes that 137 SOQL queries was executed out of limit usage of 100. C. The debug log line above was triggered when the code reached the 38th line. D. 20:43:52.588 (7632137015) corresponds to the timestamp of the log line.

A & D The debug log line was triggered when the code reached the 137th line. It denotes that 38 SOQL queries were executed out of limit usage of 100. https://help.salesforce.com/apex/HTViewHelpDoc?id=code_setting_debug_log_levels.htm&language=en_US

What are some of the limitations of changing the data type of a custom field?Choose 3 answers. A. The option to change the data type of a custom field is not available for all data types. B. Developers cannot change the data type of a custom field that is referenced by a Visualforce page. C. Developers cannot change the data type of a custom field if it is referenced in Apex. D. The file field type in Salesforce Knowledge can be changed as long as it is not referenced in a Apex Class.

A, B, C In Salesforce Knowledge article types, the file field type cannot be converted into other data types. The option to change the data type of a custom field is not available for all data types. For example, existing custom fields cannot be converted into encrypted fields nor can encrypted fields be converted into another data type. Data type of fields that are referenced by Apex Class/Visualforce page cannot be changed easily. References should be rectified first. Fields can also not be renamed if referenced in Apex. https://help.salesforce.com/apex/HTViewHelpDoc?id=notes_on_changing_custom_field_types.htm&language=en

A developer is considering using a standard controller on a Visualforce page. Which of the following are valid considerations about standard controllers?Choose 3 answers. A. To associate a standard controller with a Visualforce page, use the standardController attribute on the <apex:page> tag and assign it the name of any Salesforce object that can be queried using the Force.com API. B. The standard controller provides a set of standard actions, such as create, edit, save, and delete, that you can add to your pages using standard user interface elements such as buttons and links. C. Every standard controller includes a getter method that returns the record specified by the id query string parameter in the page URL. D. A Standard controller can retrieve a list of items to be displayed, make a callout to an external web service, validate and insert data E. To associate a standard controller with a Visualforce page, use the 'controller' attribute on the <apex:page> tag and assign it the name of any Salesforce object that can be queried using the Force.com API.

A, B, C Standard controllers are not capable of making a callout to an external web service. Also, the 'standardController' attribute is used for associating the standard controller, not the 'controller' attribute as it is used for custom controllers. https://developer.salesforce.com/docs/atlas.en-us.198.0.pages.meta/pages/pages_controller_std.htm https://trailhead.salesforce.com/modules/visualforce_fundamentals/units/visualforce_standard_controllers

A component bundle contains a component or an app and all its related resources. Which of the following resources are part of the standard component bundle?Choose 4 answers. A. Documentation B. Renderer C. Helper D. CSS Styles E. Image and Animations

A, B, C, D The following resources are in a component bundle: Component or Application, CSS Styles, Controller, Design, Documentation, Renderer, Helper & SVG File. https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_bundle.htm

Which of the following are true about cross-object formula fields?Choose 3 answers. A. Cross-object formula fields can pull field values from objects that are up to 10 relationships away. B. Cross-object formula fields can pull field values from master-detail or lookup parent records. C. For every object, cross-object formula fields can be used in 3 roll-up summaries. D. Cross-object formula fields can pull data from a record even if the user does not have access to it. E. Cross-object formula fields can pull field values from its child records.

A, B, D Cross-object Formula Fields can reference field values from related Parent records. Even though a user does not have access to a record, data from this record can still be visible to the user through cross-object formula fields. Formula Fields can reference field values from related Parent objects that are up to 10 relationships away. https://help.salesforce.com/apex/HTViewHelpDoc?id=customize_cross_object.htm&language=en_US

Which of the following are capabilities of schema builder?Choose 3 answers. A. Creating a custom object B. Deleting a custom object C. Exporting schema definition D. Importing schema definitions E. Creating lookup and master-detail relationships

A, B, E Using schema builder, objects and relationships can be defined. Custom objects can be created and deleted. It cannot be used to export or import schema definition. https://trailhead.salesforce.com/data_modeling/schema_builder

Which of the following statements are true about controller extensions?Choose 3 answers. A. A controller extension is an Apex class that extends the functionality of a standard or custom controller. B. Only one controller extension can be defined for a single page. C. The extension is associated with the page using the 'extensions' attribute of the <apex:page> component. D. If an extension works in conjunction with a standard controller, the standard controller methods will also be available. E. A standard or custom controller is an extension of the controller extension.

A, C, D Controller extensions extend the functionality of a standard or custom controller, and not the other way around. The methods of the controller they extend from will also be available to the extension controller. An extension is added to a page through the 'extensions' attribute of a Visualforce page component. Multiple controller extensions can be defined on a single page through a comma-separated list. https://developer.salesforce.com/docs/atlas.en-us.198.0.pages.meta/pages/pages_controller_extension.htm https://trailhead.salesforce.com/en/content/learn/modules/visualforce_fundamentals/visualforce_custom_controllers

What are considerations for deciding between using Data Loader and the Data Import Wizard for loading data into a development environment?Choose 3 answers. A. If the object is supported by the data import tool B. If triggers should be run during the data import C. If the data needs to be loaded multiple times D. The number of records to be loaded E. The data storage capacity of the org

A, C, D Data Loader can load higher data volumes than the Data Import Wizard. While both tools support custom objects, the Data Import Wizard does not support all standard objects, unlike Data Loader. Mappings cannot be saved using the Data Import Wizard, which makes Data Loader suitable for loading data multiple times. Triggers will always run regardless of which tool is used. However, the Data Import Wizard provides an option to prevent workflow rules and processes from firing when records are created or updated. The data storage capacity has no impact on deciding which data import tool is used. https://help.salesforce.com/articleView?id=import_with_data_import_wizard.htm&type=0&language=en_US https://trailhead.salesforce.com/projects/import-and-export-with-data-management-tools

Which of the following statements about running Apex Test Classes in the Developer Console are true?Choose 3 answers. A. An Overall Code Coverage pane is available that displays the percentage of code coverage for each class in org. B. [Suite Manager] option is used to abort the test selected in the Tests tab. C. Unless the test run includes only one class and [Always Run Asynchronously] option in the Test menu is not selected, the Developer Console runs tests asynchronously in the background. D. The [Rerun Failed Tests] option reruns only the failed tests from the test run that are highlighted in the Tests tab. E. [New Suite] option is used to create multiple test classes at the same time.

A, C, D Suite Manager is used to create or delete test suites or edit which classes your test suite contains. A test suite is a collection of Apex test classes that you run together. The New Suite option is used to create a new suite of test classes that are run together. It cannot be used to create a test class. https://help.salesforce.com/apex/HTViewHelpDoc?id=code_dev_console_tab_tests.htm&language=en_US https://help.salesforce.com/apex/HTViewHelpDoc?id=code_dev_console_test_suites_creating.htm&language=en_US#code_dev_console_test_suites_creating

A developer needs to access a list of data on a Visualforce page and represent the data as a table. However, the developer would also like to customize the look and feel and not use the standard Salesforce styling. What Visualforce components can the developer use?Choose 3 answers. A. <apex:dataTable> B. <apex:table> C. <apex:dataList> D. <apex:listTable> E. <apex:repeat>

A, C, E <apex:dataTable>, <apex:dataList>, and <apex:repeat> can be used to create tables with custom styles. https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_dataTable.htm https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_dataList.htm

Which of the following use cases are valid for using declarative customization?Choose 3 answers. A. Displaying the number of employees of the account related to an opportunity on the Opportunity page layout B. Calculating the sales tax applicable to a quote that is a complex calculation based on factors such as product, state, and quantity C. Calculating the number of days until an opportunity closes and displaying the value on a report D. Displaying the total discount amount on an opportunity using a roll-up summary field based on line item formula fields which reference another object E. Determining a lead rating that is based on the value of three fields on the lead record

A, C, E The NumberOfEmployees field on the Account object can be displayed in the related Opportunity object using a cross-object formula field. The TODAY() function and an Opportunity's CloseDate field can be used in a formula to determine the number of days left leading to its close date in a custom field or row-level formula field in a report. Fields, functions, and operators can be used in a formula to generate certain output such as lead rating. A complex calculation that involves a number of lookups would be too complex for a formula field and would need a programmatic solution. A flow could be used for a simple calculation but not when there is complex business logic involved. Cross-object formula fields cannot be used in roll-up summary fields. https://trailhead.salesforce.com/en/point_click_business_logic/formula_fields https://help.salesforce.com/articleView?id=fields_creating_cross_object_notes.htm&type=5

Which of the following ways can be used to throw a custom exception?Choose 3 answers. A. throw new myCustomException(e); B. throw new myCustomException().setMessage('Error Message Here'); C. throw new myCustomException(); D. throw new myCustomException().addError('Error Message Here'); E. throw new myCustomException('Error Message Here');

A, C, E You can construct exceptions: 1. With no arguments: new MyException();2. With a single String argument that specifies the error message: new MyException('This is bad');3. With a single Exception argument that specifies the cause and that displays in any stack trace: new MyException(e);4. With both a String error message and a chained exception cause that displays in any stack trace: new MyException('This is bad', e); A throw new customExceptionName().someFunction() statement is invalid. https://developer.salesforce.com/docs/atlas.en-us.210.0.apexcode.meta/apexcode/apex_exception_custom.htm

On what event should the trigger below be fired?Choose 1 answer. Trigger createCallingCard on Contact (EVENT) { List<CallingCard__c> cardList = new List<CallingCard__c>(); for (Contact con : Trigger.new) { CallingCard__c newCard = new CallingCard__c(); newCard.Name = con.Name; newCard.Phone = con.Phone; newCard.Address = con.Address; newCard.relatedContact__c = con.Id; cardList.add(newCard); } insert cardList; } A. After Insert B. Before Delete C. Before Insert D. After Update

A. After Insert The answer is After Insert. The code snippet above shows that the Contact ID needs to be assigned to the relatedContact__c field of the CallingCard custom object. In the save order of execution, record changes are saved to the database (but not committed yet) prior to the execution of After triggers. Hence, the Contact IDs will be available for use in the After Insert trigger. This will also ensure that a Contact record has been created prior to creating a counter CallingCard record. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_context_variables.htm https://trailhead.salesforce.com/en/modules/apex_triggers/units/apex_triggers_intro

A developer has written a code block that does not include the with/without sharing keyword. Which of the following will use the sharing settings, field permissions, and Organization-Wide Defaults for the running user?Choose 1 answer. A. Anonymous Blocks B. Apex Triggers C. Apex Classes D. Web Service Callouts

A. Anonymous Blocks The [with sharing] keyword allows us to specify that the sharing rules for the current user be taken into account for a class. The developer has to explicitly set this keyword for the class because the Apex code runs in the system context. In the system context, the Apex code has access to all objects and fields. Object permissions, field-level security, and sharing rules are not applied for the current user. This is to ensure that the code will not fail to run because of hidden fields or objects for a user. The only exception to this rule is the Apex code that is executed with the executeAnonymous call. executeAnonymous always executes using the permissions of the current user. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_sharing.htm https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_anonymous_block.htm

Cosmic Solutions would like to generate invoices in Salesforce, allow customers to pay their invoice securely from their email, and process the payment. Which of the following should be used to meet this requirement?Choose 1 answer. A. Check if an AppExchange app exists B. Use Workflow Rule and Formula Fields C. Use Lightning Process Builder D. Build a custom Apex solution

A. Check if an AppExchange app exists In this case, it would be better to look for an existing AppExchange app that offers the functionality required by the company. Native features in Salesforce, such as Process Builder, Workflow Rule, and Formula Fields, cannot be used for allowing customers to pay from their email and processing their payment. Several free solutions that offer features related to payment processing are available in the AppExchange, which makes using an existing app a better option than committing resources for the development of a custom application that uses Apex code .https://appexchange.salesforce.com/category/payment

A developer is creating a Training application to track training courses and the enrollment of the candidates. Each candidate can enroll in multiple training courses at a time. How can the developer achieve this?Choose 1 answer. A. Create a junction object to relate many candidates to many training courses through master-detail relationships. B. Create a junction object to relate Candidates to Training Courses and use lookup relationships to relate the junction object to Candidates and Training Courses C. Create a master-detail relationship between Candidate and Training Course D. Create a lookup relationship between Candidate and Training Course

A. Create a junction object to relate many candidates to many training courses through master-detail relationships. To establish a many-to-many relationship between the Training and Candidate objects, a junction object 'Enrollment' can be created. This enables Candidates to be related to multiple Training Courses at a time. The best way to create a junction object is to use two master-detail relationships. https://help.salesforce.com/articleView?id=overview_of_custom_object_relationships.htm&type=5

A developer needs to create a new Contact record in his Apex Trigger. What DML statement should be used in the code?Choose 1 answer. A. Insert B. Upsert C. Create D. Merge

A. Insert The insert DML operation adds one or more sObjects, such as individual accounts or contacts to your data. Insert is analogous to the INSERT statement in SQL. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dml_section.htm#apex_dml_insert

Which of the following field types can a Roll-Up Summary field calculate?Choose 1 answer. A. Number B. Text C. Checkbox D. Picklist

A. Number If SUM is selected as the roll-up type, number, currency, and percent fields can be calculated. If MIN or MAX is selected as the roll-up type, number, currency, percent, date, and date/time fields are available. https://help.salesforce.com/HTViewHelpDoc?id=fields_about_roll_up_summary_fields.htm

Which of the following is a best practice when writing test classes?Choose 1 answer. A. Use System.assert() methods to verify test results. B. Use System.debug() method to verify test results. C. Use SeeAllData=true. D. Use @future annotation.

A. Use System.assert() methods to verify test results. System.assert() methods are used to verify whether the expected results are met or not. An exception is thrown when the expected results are not met. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_best_practices.htm

Which of the following is the correct syntax for a try-catch-finally block?Choose 1 answer. A. try { *code here* } catch (Exception e) { *code here* } finally { *code here* } B. finally { *code here* } catch { *code here* } try { *code here* } C. catch (Exception e) { *code here* } try { *code here* } finally { *code here* } D. try { *code here* } finally { *code here* } catch (Exception e) { *code here* }

A. try { *code here* } catch (Exception e) { *code here* } finally { *code here* } In a try-catch-finally statement, the main business logic is executed in the try block. If an error occurs within the try block, it will be caught and handled by the catch block. Then, whether or not an exception was caught, code in the finally block will always be executed as the last phase in the control flow. Finally statements can be used to perform cleanup code such as for freeing up resources. https://developer.salesforce.com/page/An_Introduction_to_Exception_Handling

A developer would like to relate an external data object (Social Media Posts) to the contacts object in Salesforce to track every post the contact has made in the external platform. How can the developer achieve this?Choose 1 answer. A. Create a lookup relationship and update the record ID through integration B. Create an indirect lookup relationship using a custom field with External ID and Unique attributes C. Create an external lookup relationship using a custom field with External ID and Unique attributes D. Create a master-detail relationship and update the record ID through integration

B An indirect lookup relationship links a child external object to a parent standard or custom object. When you create an indirect lookup relationship field on an external object, you specify the parent object field and the child object field to match and associate records in the relationship. Specifically, you select a custom unique, external ID field on the parent object to match against the child's indirect lookup relationship field, whose values come from an external data source. An external lookup relationship generally relates a Salesforce child record to an external parent record.Lookup relationships and master-detail relationships do not relate to external records. https://help.salesforce.com/articleView?id=overview_of_custom_object_relationships.htm&language=en_US&type=0&release=204.11.2 https://trailhead.salesforce.com/en/projects/quickstart-lightning-connect/steps/quickstart-lightning-connect3

When test data cannot be created programmatically, how can pre-existing data be accessed?Choose 1 answer. A. Annotate the test method with [withSharing=true] B. Annotate the test class or method with [seeAllData=true] C. Annotate the test method with [withSharing=false] D. Annotate the test class or method with [seeAllData=false]

B If the test class or test method is annotated with IsTest(SeeAllData=true) data access will be opened to pre-existing records in the organization. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_seealldata_using.htm

The Stage field on all related Opportunity records should be updated to 'Closed Lost' when the value of the 'Status' field on an account record is changed to 'Inactive' by a sales user. What could be used to meet this requirement?Choose 1 answer. A. Workflow rule B. Process Builder C. Approval Process D. Flow

B Process Builder is capable of updating related records through the Update Records action type. Although a flow is also capable of updating related records, the recommendation is to always go with the solution that is easier to implement, which in this case is Process Builder. Workflow rules cannot operate on child records of an object. Cross-object field updates are available for an object's parent record only under certain conditions. An approval process cannot be used to update child records. https://help.salesforce.com/apex/HTViewHelpDoc?id=workflow_cross_object_field_updates.htm

A junior developer frequently experiences governor limit errors when running Apex Triggers. As a senior developer, which of the following are best practices that you could advise?Choose 2 answers. A. Use an Apex handler class for multiple triggers. B. Use a combination of collections (e.g. maps, lists) and streamlined queries. C. Use lists to perform DML operations on multiple records. D. Use SOQL queries only within FOR loops.

B & C Utilizing lists and maps to store data obtained from queries is a fundamental technique that is used to make Apex code more efficient. A SOQL query can make use of the WHERE clause to query all the data required in Apex code. Instead of using DML statements inside FOR loops to perform operations such as insert, update, or delete on individual records, they should be executed using collections outside FOR loops. Also, a SOQL query should never be placed within a FOR loop since there is a governor limit that enforces the maximum number of SOQL queries in an Apex transaction. There is another limit that enforces the maximum number of DML statements allowed in a transaction. https://developer.salesforce.com/page/Apex_Code_Best_Practices https://developer.salesforce.com/blogs/developer-relations/2015/01/apex-best-practices-15-apex-commandments.html

What options are available to run unit tests in an org?Choose 3 answers. A. Run all methods in a specific class that does not contain test methods B. Run a test suite C. Run all unit tests in an org D. Run all methods in a specific class

B, C, D Different groupings of unit tests can be selected, from one unit test, to groupings in a test suite to all unit tests. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_unit_tests_running.htm

Which of the following are part of the model layer in the MVC model?Choose 3 answers. A. Tabs B. Fields C. Objects D. Relationships E. Page Layouts

B, C, D The model layer includes fields, objects, and relationships, whereas tabs and page layouts are part of the view layer. https://developer.salesforce.com/page/An_Introduction_to_Visualforce

Which of the following statements about defining an Apex Class are true?Choose 3 answers. A. The keyword [class] is required if no access modifier is present. B. An access modifier is required in the declaration of a top-level class C. A developer may add optional extensions and/or implementations. D. The keyword [class] followed by the name of the class is necessary E. A definition modifier is required in the top-level class.

B, C, D To define a class, an access modifier (such as public or global) must be used in the declaration of a top-level class. An access modifier is not required in the declaration of an inner class. Definition modifiers (such as virtual, abstract) are optional. Whether an access modifier has been specified or not, the keyword [class] is always mandatory. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_defining.htm https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_extending.htm

Given the following options, what are the valid ways to declare a collection variable?Choose 3 answers. A. new Set()<Account> B. new Account[]{<elements>} C. new List<Account>() D. new Array<Account>() E. new Map<Id, Account>()

B, C, E Expressions can be a new sObject, Apex object, List, Set, or Map. In the given options, the Map of accounts and List of accounts declared using the List keyword or array notation (square brackets) are all valid expressions for declaring collection variables. A proper declaration syntax for a Set, applicable also for the other collection data types, is: new Set<Account>(). There is no Array datatype in Apex. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_expressions_understanding.htm https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_collections.htm

Which of the following are capabilities of Visual Studio Code?Choose 3 answers. A. Creating Change Sets B. Deploying metadata components from one org to another C. Running Apex Tests D. Create a test suite for running tests E. Executing SOQL queries

B, C, E Visual Studio Code can be used to:- Test and debug Apex classes and triggers.- Run anonymous blocks of Apex on the server- Execute SOQL queries- Synchronize project contents with changes on the server- Deploy metadata components from one Salesforce organization to another Creating change sets must be done through the Salesforce web UI of the org. Test suites can only be created in the Developer Console. https://trailhead.salesforce.com/en/content/learn/projects/quickstart-vscode-salesforce/start-vscode

The developer of Bright Starts Company is designing a Lightning web component to mimic the look and feel of the company website on a Lightning page. Which of the following describes correctly the files bundled in this component's folder?Choose 3 answers. A. The XML configuration file fetches data from the company website B. The HTML file defines the UI structure of the component C. The test file is included to test component functionality and is executed inside Salesforce D. The CSS file is used to style the component and match the company's branding guidelines E. The JavaScript file defines how the component UI reacts to client events

B, D, E The HTML file is the basis for the UI of the component. Hence, it contains the UI structure. The JavaScript file defines the HTML element provided in the HTML file including event handling and the core logic. The CSS file is used to style the component using standard CSS. The configuration file is used to define metadata values of the component. It is not used for fetching data. Retrieving data will require server-side controllers to perform such a task. Also, the test files contained in a Lightning web component directory are run using Jest, which is a third-party testing framework used for testing JavaScript code. These test files are not uploaded to the Salesforce org and are only run locally. https://developer.salesforce.com/docs/component-library/documentation/en/48.0/lwc/lwc.create_components_define https://trailhead.salesforce.com/en/content/learn/modules/lightning-web-components-basics/create-lightning-web-components

Which of the following statements is true about defining getter methods?Choose 1 answer. A. The [get] method is used to pass data from Visualforce page to Apex controller. B. Use the name of the getter method in an expression to display the results of a getter method in a page. C. Every value that is calculated by a controller and displayed in a page must have a corresponding getter method D. Getter methods are suggested to include logic that increments a variable, write a log message, or add a new record to the database.

C. Every value that is calculated by a controller and displayed in a page must have a corresponding getter method The 'set' method should be used to pass data from Visualforce page to Apex controller. To pass data from an Apex controller to a Visualforce page, use the 'get' method. The name of the getter method without the 'get' prefix should be used to display results from a getter method. Also, getter methods should be designed to produce the same outcome, whether they are called once or multiple times for a single page request. It is a best practice for getter methods to be idempotent, that is, to not have side effects. For example, do not increment a variable, write a log message, or add a new record to the database. Visualforce does not define the order in which getter methods are called, or how many times they might be called in the course of processing a request. Getter methods return values from a controller. Every value that is calculated by a controller and displayed in a page must have a corresponding getter method, including any Boolean variables. https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_methods.htm https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_controller_getter_methods.htm

Which static methods can be used in a test class to test governor limits?Choose 1 answer. A. Test.setFixedSearchResults() B. Test.runAs() and Test.getLimits() C. Test.startTest() and Test.stopTest() D. Test.isTest() and Test.isnotTest()

C. Test.startTest() and Test.stopTest() The startTest() method marks the point in the test code when the test actually begins, while the stopTest() method marks the point in the test code when the test ends. Any code that executes after the call to startTest() and before stopTest() is assigned a new set of governor limits, which will ignore any dml or queries done outside of the start and stop testing and only counts what happens in between as part of the test. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_tools_start_stop_test.htm

A custom object has a workflow rule that updates a field when a certain set of criteria is met. A 'before update' Apex trigger has also been defined on the object. What will happen when a user updates a record so that it meets the criteria of the workflow rule?Choose 1 answer. A. The Apex trigger will be fired first, voiding the Workflow Rule due to the order of execution B. An exception will be thrown due to a conflict between the two C. The Apex trigger will be fired twice D. Both will be fired only once

C. The Apex trigger will be fired twice According to the order of execution, 'before' triggers are run, 'after' triggers are run, and then workflow field updates are processed. If a field is updated due to a workflow rule, 'before update' and 'after update' triggers are run again one more time, and only one more time. In this case, since the record meets the criteria of the workflow rule, the 'before update' trigger will be run again after the workflow field update associated with the rule has been processed. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm

What attribute should the developer use to render a Visualforce page as a PDF file?Choose 1 answer. A. docType="pdf-1.0-strict" B. contentType="application/vnd.pdf" C. docType="pdf-5.0" D. renderAs="pdf"

D A developer can generate a downloadable, printable PDF file of a Visualforce page using the PDF rendering service. A Visualforce page rendered as a PDF file displays either in the browser or is downloaded, depending on the browser's settings. Specific behavior depends on the browser, version, and user settings, and is outside the control of Visualforce. https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_output_pdf_renderas.htm

How can SOQL injection be prevented?Choose 1 answer. A. Use the preventQuotes method B. Use the preventDatabaseCommands method C. Use the preventInjection method D. Use the escapeSingleQuotes method

D SOQL injection is a technique by which a user causes your application to execute database methods you did not intend by passing SOQL statements into your code. This can occur in Apex code whenever your application relies on end user input to construct a dynamic SOQL statement and you do not handle the input properly. To prevent SOQL injection, use the escapeSingleQuotes method. This method adds the escape character (\) to all single quotation marks in a string that is passed in from a user. The method ensures that all single quotation marks are treated as enclosing strings, instead of database commands. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dynamic_soql.htm https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm?search_text=escapeSingleQuotes

A developer has written an Apex Trigger. She tested it and the trigger is not functioning as expected. She now wants to debug the code. How can the developer accomplish this in the Developer Console?Choose 1 answer. A. Go to the Run Tests in Developer Console. B. Go to the Anonymous Window in Developer Console. C. Go to the Progress tab in Developer Console. D. Go to the Logs tab in Developer Console.

D The logs tab in the developer console is used to open and inspect debug logs. The debug logs includes database events, Apex processing, workflow, and validation logic. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_debugging_system_log_console.htm

A developer is required to create a trigger that every time the Type field on Request object is updated, the Owner field should be changed as well, either to a User or Queue. What trigger event should the developer use?Choose 1 answer. A. Before Delete B. After Merge C. After Update D. Before Update

D. Before Update The Before Update trigger can be used to update field values before the record is saved to the database. After Update triggers will not work because at this point, the record that invoked the trigger has already been saved to the database (but not yet committed) and becomes read-only such that setting a value on a field will throw an exception. Before Delete triggers are used when deleting records. After Merge triggers do not exist. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers.htm https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm

A developer needs to initialize a numerical value of 17. What data type should the developer use?Choose 1 answer. A. String B. Blob C. Numeric D. Integer

D. Integer Integer is a 32-bit number that does not include a decimal point. Using a String will lose the numeric value of 17, so it may not be used in numerical/arithmetic operations. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_primitives.htm

What will be the result of running the following code?Choose 1 answer. for (Integer x = 0; x < 200; x++) { Account newAccount = new Account ( Name= 'MyAccount-' + x); try { insert newAccount; System.debug(Limits.getDMLStatements()); } catch(exception ex) { System.Debug('Caught Exception'); System.Debug(ex); } } insert new Account(Name='MyAccount-last');

D. No accounts will be inserted The system enforces a DML limit of 150 statements per Apex transaction. If there are more than 150 items, the 151st update call returns an exception that cannot be caught for exceeding the DML statement limit of 150. All previous insertions will be rolled back. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples.htm https://trailhead.salesforce.com/en/modules/apex_database/units/apex_database_dml

The Salesforce developer of Cosmic Solutions would like to override the standard 'New' button for creating an Account in Salesforce Classic. How can this be done?Choose 1 answer. A. Clone the standard button to be able to modify the look and feel of the page. B. Create a new custom object with a custom button because standard buttons cannot be modified. C. Override the standard button with a new Lightning component. D. Override the standard button with a new Visualforce page.

D. Override the standard button with a new Visualforce page. For Salesforce Classic, it is possible to override a standard button with a custom Visualforce page. One can navigate to the 'Buttons, Links, and Actions' for a particular object, edit the button or link, and select a custom Visualforce page in order to override it. It is also possible to select a Lightning component for 'Lightning Experience Override' and 'Mobile Override'. https://help.salesforce.com/articleView?id=links_customize_override.htm&type=5 https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_customize_override.htm

A developer notices that the code below returns only 20 Account records though she expected 60. Which of the following is true regarding SOSL query limits? FIND {test} RETURNING Account(id), Contact, Opportunity LIMIT 60Choose 1 answer. A. Limits cannot be set in SOSL queries B. Limits have to be individually assigned per object. C. The SOSL Syntax is incorrect. D. Results were evenly distributed among the objects returned.

D. Results were evenly distributed among the objects returned. If a limit is set on the entire query, results are evenly distributed among the objects returned.Limits can also be set per individual object. https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl_limit.htm

How can a developer get all picklist values of a specific field via Apex?Choose 1 answer. A. Use the globalPicklist method B. Use the fieldPicklist method C. Use the describePicklist method D. Use the getPicklistValues method

D. Use the getPicklistValues method The getDescribe() method is used to obtain information on the field and then the getPicklistValues method is used to retrieve the picklist values. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Schema_PicklistEntry.htm#apex_class_Schema_PicklistEntry

Cool Air Conditioners has been using the Case object in Salesforce to manage issues faced by customers. The company would also like to use Salesforce to manage field service jobs performed for customers by technicians. They would like to track information about the tasks performed for the customers. What is the recommended solution to meet this requirement?Choose 1 answer. A. Install an AppExchange solution that adds the required functionality. B. Create an external field service application and use REST API to integrate it with Salesforce. C. Create a custom object to manage field service jobs. D. Utilize the standard objects Work Order and Work Order Line Item.

D. Utilize the standard objects Work Order and Work Order Line Item. Two standard objects in Salesforce, namely, Work Order and Work Order Line Item, can be used to track the field service work performed for customers. A work order can have related work order line items that represent the subdivisions or tasks to be completed. In orgs that don't have the Field Service Lightning add-on license, an option to enable Work Orders is available. Installing an AppExchange application or creating a custom object is unnecessary to meet the requirement since standard objects are readily available. Creating an external application and integrating it with Salesforce is also not required. https://help.salesforce.com/articleView?id=fs_standard_objects.htm&type=5

A managed package can be created in which type of environment?Choose 2 answers. A. Developer Sandbox B. Full Sandbox C. Developer Edition D. Partner Developer Edition

Only Developer Edition or Partner Developer Edition environments can create managed packages. https://developer.salesforce.com/page/An_Introduction_to_Environments


संबंधित स्टडी सेट्स

C2 OSI reference model (Lab & Review ?s)

View Set

World Religions Exam 1 Homework Questions

View Set

Plato - Forensics Mid-Term | Study Guide

View Set

Chapter 41: Management of Patients with Musculoskeletal Disorders

View Set

EMT Geriatrics and Special Populations Practice Questions

View Set

NSG 245 Ch 41- Management of Musculoskeletal Disorders

View Set

Digital forensics chapters 1 and 4 review questions

View Set

Money and Banking Exam 1 Practice Test

View Set