Which two statements accurately represent the mvc framework implementation in salesforce?

A developer must modify the following code snippet to prevent the number of SOQL queries issued from exceeding the platform governor limit. public class without sharing OpportunityService( public static List<OpportunityLineItem> getOpportunityProducts(Set<Id> opportunityIds){ List<OpportunitylineItem> oppLineItems = new List<OpportunityLineItem>(); for(Id thisOppId : opportunityIds){ oppLineItems.addAll([Select Id FROM OpportunityLineItems WHERE OpportunityId = :thisOppId)]; } return oppLineItems; } }

Show

The above method might be called during a trigger execution via a Lightning component. Which technique should be implemented to avoid reaching the governor limit?

AUse the System.Limits.getQueries() method to ensure the number of queries is less than 100.

BUse the System.Limits.getlimitQueries() method to ensure the number of queries is less than 100.

CRefector the code above to perform the SOQL query only if the Set of opportunityIds contains less 100 Ids.

DRefactor the code above to perform only one SOQL query, filtering by the Set of opportunityIds.

Answer : D

Model View Controller (MVC Architecture in Salesforce) is a software pattern that separates the representation of information from the user’s interaction with it.

Which two statements accurately represent the mvc framework implementation in salesforce?

SFDC MVC:

  • We can write our VIEW pages using SFDC visual force (VF pages).
  • Each VF page is associated with a Controller.
  • We can make use of already built Standard controllers or we can write our own controller using Apex language. Apex is OO and very much similar to JAVA.
  • We can also write Model Classes using Apex.

MVC architecture in Salesforce pattern contains below three modules:

Model (Database Layer):

The schema and data salesforce use to represent the system completely. In Salesforce, we can say that sObjects are the model as every entity in salesforce is mapped to some sObject. (sObjects are any objects that can be stored in the Force.com platform database)

View (User Interface Layer):

How the schema and data are represented. Visualforce is used to present the data to users.

Controller (Business Logic Layer):

How the interface actions. Controllers are used to perform the actions whenever users interact with visual force.

In SFDC:

  • Visual Force pages, Page Layouts, Tabs comes under View Layer of Model View Controller in Salesforce.
  • Workflows, Apex Classes, Triggers comes under Controller part in Model View controller in Salesforce.
  • Objects, Fields, Relationships come under Model Layer of Model View Controller in Salesforce.

Benefits of using MVC Architecture in Salesforce:

Reliability: 

The layers have clear separation so it allows greater reliability if we want to change any layer. For example, if can change the look and feel of an application without recompiling Model or Controller code.

High Reuse and adaptability:

MVC provides multiple types of views all accessing the same code.

Very low development and life cycle cost: 

It makes it possible to have lower-level programmers develop and maintain user interfaces. Development time can be significantly reduced because Controller programmers focus solely on transactions and view programmers focus solely on presentation.

Easy to maintain: 

The separation between layers makes it easier to maintain, test, and deploy apps.

Which two statements accurately represent the mvc framework implementation in salesforce?

How is Model-View-Controller (MVC) architecture implemented on the Salesforceplatform?

Model: Standard and Custom Objects; View: Visualforce Pages; Controller: ApexCode

What are two sets of code that represent the Controller in MVC architecture on the Force.com platform?

1. Standard Controllersystem methods that are referenced by Visual force. 2. Custom Apex and JavaScript code that is used to manipulate data.

Name two users that can edit a record after it has been locked for approval?

1.An administrator 2. A user who is assigned as the current approver

Name three capabilities of cross-object formula fields?

1. Formula fields can expose data the user does not have access to in a record. 2. Formula fields can reference fields from objects that are up to 10 relationships away. 3. Formula fields can reference fields from master-detail or lookup parent relationship.

On a Visualforce page with a custom controller, how should a developer retrieve a record by using an ID parameter that is passed on the URL?

Use the constructor method for the controller)

Describe two situations when would a developer use a custom controller instead of a controller extension?

1. When a Visualforce page needs to replace the functionality of a standard controller. 2. When a Visualforce page should not enforce permissions or field -level security.

If a developer has a block of code that omits some statements from being shared but the organization-wide dafault is different, what will happen.

The Apex Controllers will automatically obey the organization-wide sharing defaults.

What is the result when a Visualforce page calls an Apex controller, which calls another Apex class, with the result “!Multiple in hitting a governor limit”?

Any changes up to the error are rolled back.

Which control statement should a developer use to implement set of code that executes for every record in the recordset, without performing a .size() or .length() method call when the number of records in recordset are unknown?

For (variable : list_or_set) {

Describe two best practices for a developer to follow when writing a trigger?

1. Using the Map data structure to hold query results by ID. 2. Using the Set data structure to ensure distinct records.

Describe two actions a developer can perform in a before update trigger.

1. Change field values using the Trigger.new context variable. 2. Display a custom error message in the application interface

A developer creates a method in an Apex class and needs to ensure that errors are handled properly. What would the developer use?

A custom exception.addError() and A try/catch construct

In the code below, what type does Boolean inherit from?Boolean b = true;

Which standard field needs to be populated when a developer inserts new contact records programmatically?

What are three capabilities of formula fields?

Does a roll-up summary field work with a look-up relationship?

No, roll-up summary field only works with master-detail relationships.

Name three areas where custom rollup summary fields can be created using Standard Object relationships? 

1. On Campaign using Campaign member records. 2. On Account using Opportunity records. 3. On Opportunity using Opportunity Product records

Your client hires a new intern. The intern is not allowed to view Opportunities, but needs to see the Most Recent Closed Date of all child Opportunities when viewing an Account record. What would a developer do to meet this requirement?

Create a rollup summary field on the Account object that performs a MAX on the Opportunity Close Date field.

On which object can an administrator create a rollup summary field?

Any object that is on the master side of a master-detail relationship

What would you use when a record has certain values?

Three of our tools can address this use case: Workflow, Process Builder, and Visual Workflow. Respectively, these tools create workflow rules, processes, and flows.

What would you use if you need to get information from customers and do something with it?

Visual Workflow is the tool for you. Create a flow that displays information to and requests information from a user.

Name three declarative methods that help ensure quality data?

Validation rules, Lookup filters, Page layouts

A developer wrote a workflow email alert on case creation so that an email is sent to the case owner manager when a case is created. When will the email be sent?

After committing to database

The Humane Society uses a custom object to track animals and would like to send adoption candidates information automatically to a third-party system when a adoption candidate is selected to adopt an animal. What can a developer do to accomplish this task?

Create a workflow rule with an outbound message action.

Create a process with Process Builder

Your client requires that the Lead Source field of the Lead record be populated when a Lead is converted. What would a developer use to ensure that a user populates the Lead Source field prior to converting a Lead?

Nothing. The Task is automatically displayed on the Account page.

What are two valid statements about Apex classes and interfaces?

The default modifier for a class is private, Exception classes must end with the word exception.

A developer writes a before insert trigger. How can the developer access the incoming records in the trigger body?

By accessing the Trigger.new context variable.

Before update ,Before insert

How can a developer avoid exceeding governor limits when using an Apex Trigger?

1. By performing DML transactions on lists of Objects , 2. By using maps to hold data from query results

Identify two requirements that need to be implemented by using standard workflow instead of Process Builder?

Send an outbound message without Apex code AND Create activities at multiple intervals

In a single record, a user selects multiple values from a multi-select picklist. How are the selected values represented in Apex?

As a String with each value separated by a semicolon.

What are three things you need to know about variable scope?

1. A variable can be defined at any point in the block. 2. Parallel blocks can use the same variable name. 3. Sub-blocks cannot reuse the same variable name.

What type of primitive data does Apex automatically assign to a currency field?

Name three data types or collection of data types that SOQL statements populate or evaluate to?

1. An integer, 2. A list of sObjects 3. A single sObject)

Name two ways a developer can display all of the available record types for a case object

1. Use Schema.PickListEntry returned 2. Use Schema.RecordTypeInfo returned

How can a developer determine from the describeSObjectResult if the current user will be able to create a record on an object in Apex?

By using the isCreatable() method

A developer creates an Apex helper class to handle complex trigger logic. How can the helper class warn users when the trigger exceeds DML governor limits?

By using Limits.getDMLRows() and then displaying an error message before the number of DML statements exceeded.

What is valid in the where clause of a SOQL query?

A geolocation field. or an alias notation.

A list of list of sObjects

A developer has a block of code that omits any statements that indicate whether the code block should execute with or without sharing. What will automatically obey the organization-wide defaults and sharing settings for the user who executes the code in the salesforce Organization?

This debug statement: ApexPages.StandardSetController controller = new ApexPages.StandardSetControllerDatabase.getQueryLocator(‘select Id from Account Limit 1’); will return what to the developer?

The ListView of an Account object

A developer for a large wine company needs to create a Visualforce page that will override standard Account edit button, the page will be used to validate the account’s address using a SOQL query to make sure that the shipping address is correct. The page will also allow the user to make edits to the address. Where would the developer write the Account address verification logic?

In a controller extension.

Puppies R’ Us is creating test data for products and pricebooks. What statement would the developer use?

ID pricebookID = Test.getStandardPricebookID();

A developer writes a SOQL query to find child records for a specific parent. How many specific levels can be returned in a single query?

What are the specific Governor limits of the number of records you can retrieve, update, and execute.

in a single transaction you can retrieve 50k records via SOQL, update 10k records, execute 100 SOQL calls, and execute 150 DML statements.

What is a correct pattern to follow when programming in Apex on a multi-tenant platform?

Queries select the fewest fields and records possible to avoid exceeding governor limits

1. An Apex trigger on the Account object. 2. A Process Builder on the Account object.

Name two ways to avoid exceeding governor limits when using an Apex Trigger.

By performing DML transactions on lists of Objects, By using Maps to hold data from query results

A developer for the Humane Society’s Salesforce creates a Workflow Rule declaratively that updates a field on the Adoption object. An Apex update trigger exists for the Adoption object as well. What happens when a user updates a record?

The Apex Trigger is fired more than once

In which order does Salesforce execute events upon saving a record?

Before Triggers; Validation Rules; After Triggers; Assignment Rules; Workflow Rules; Commit

What are the 4 main Salesforce APIs?

1. REST API 2. SOAP API 3. Bulk API 4.Streaming API

Which two components are available to deploy using the Metadata API?

Case Layout,  Account Layout

What are two ways a developer can provide a Visualforce page that lets users enter Product specific details during the Sales cycle?

1. Create a new Visualforce page and an Apex controller to provide Product data entry. 2. Download an Unmanaged Package from the AppExchange that provides a custom Visualforce page to modify.

What are the types of web content that can be incorporated into Visualforce pages

Maps, Charts, flows, PDF renderer and custom content type.

What are two valid ways of loading external Javascript files into a VisualForce page?

A: 1. Apex:includeScript 2. Script

What is the preferred way to reference web content - such as images, stylesheets, JavaScript, and other libraries, that is used in Visualforce pages?

By uploading the content as a Static Resource

What are two ways a developer use a custom Visualforce page in a Force.com application?

1. To create components for dashboards and layouts. 2. To generate a PDF document with application data.

What are two characteristics of the Lightning Component framework?

1. It Includes responsive components 2. It has event-driven architecture

Which resources can be used to fire events in the Lightning Component Framework?

1. Third party web service code 2. Javascript controller actions

Where is client-side controller logic contained in the Lightning Component framework?

What are two resources that can be included in a Lightning Component bundle?

1. Javascript 2. Documentation

A Visualforce page has a standard controller for an object that has a lookup relationship to parent object. How can a developer display data from the parent record on the page?

By using merge field syntax to retrieve data from the parent record

Name two capabilities of a StandardSetController?

1. It allows pages to perform mass updates of records. 2. It allows pages to perform pagination with large record sets.

Candidates can apply to adopt a puppy by submitting a single application per pet posting. Once it has been submitted, that application cannot be modified to be submitted to a different pet posting. How can you associate an application with each pet posting in the schema for the organization?

Create a master-detail relationship in the Application Custom object to the Pet Postings custom object

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

Create a junction object to relate many cameras to many parts through a master-detail relationship

The Invoice should have a Master -Detail relationship to the Account.

What kind of relationship between a Standard and a Custom Object can prevent the deletion of a Standard Object?

The Humane Society wants an adoption app that models animals and adoption applications; displays the total number of adoption applications each animal records; and defines security on adoption application records that is independent from the security on animal records. What would a developer do to accomplish this task?

1. Create a lookup relationship between the Animal and Adoption Application objects 2. Create a trigger on the Adoption Application object that updates a field on the Animal object.

have to manage permissions separately from parent etc.

What would need to be used to visualize and create entity relationships in data modeling?

A developer wants to delete a custom field from the Account object that was required for prototyping, but is no longer needed. How can they achieve this using Schema Builder?

Remove all references from the code and then delete the custom field from Schema Builder

What are two ways a developer can match records to update existing records when loading data into an organization?

1. Match an external Id Text field to a column in the imported file 2. Match the Id field to a column in the imported file

Give 3 use cases that would require a partial copy or full sandbox.

1. Scalability Testing 2. Batch Data Testing 3.Integration Testing

A developer is creating a sandbox, they have 3GB of data and need to be able to refresh the sandbox frequently. Should they use a partial or a full sandbox?

What is the proper process for an Apex Unit Test?

Create data for testing. Call the method being tested. Verify that the results are correct.

A developer creates a new Visualforce page and Apex extension, and writes test classes that exercise 95% coverage of the new Apex extension. Change set deployment to production fails with the test coverage warning: 'Average test coverage across all Apex classes and triggers is 64%; at least 75% test coverage is required.' What can the developer do to successfully deploy the new Visualforce page and extension?A developer creates a new Visualforce page and Apex extension, and writes test classes that exercise 95% coverage of the new Apex extension. Change set deployment to production fails with the test coverage warning: 'Average test coverage across all Apex classes and triggers is 64%; at least 75% test coverage is required.' What can the developer do to successfully deploy the new Visualforce page and extension?

Add test methods to existing test classes from previous deployments.

What happens when you are testing and use the Test.startTest() and Test.stopTest() method pair during the execution of a single test class?

You get a fresh set of governor limits.

When creating unit tests in Apex, what contributes important feedback but does not increase code coverage?

A developer creates a new Visualforce page and Apex extension, and writes test classes that exercise 95% coverage of the new Apex extension. Change set deployment to production fails with the test coverage warning: 'Average test coverage across all Apex classes and triggers is 64%; at least 75% test coverage is required.' What can the developer do to successfully deploy the new Visualforce page and extension?

Loading test data in place of user input for Flows.

1. Create a method that creates valid Account records, and call this method from within test methods and 2. Create a method that loads valid Account records from a Static Resource, and call this method within test methods

A developer creates an Apex class that includes private methods. What can the developer do to ensure that the private methods can be accessed by the test class?

Add the TestVisible attribute to the Apex methods.

Describe the differences between invoking Apex in execute anonymous vs. unit test

Unit test executes in system mode and any changes made to records are not visible out of its test execution context where with anonymous block any changes performed to data are visible after its execution is successful. Code written in anonymous block is not stored as metadata in Salesforce org and user permissions are enforced during execution.

Which two tools should a developer working in a sandbox use to exercise a new test class before the developer deploys that test class to production?

The Apex Test Execution page in Salesforce Setup AND The Test menu in the Developer Console

Which two features help a developer know if all tests currently pass in salesforce environment?

Developer console, Salesforce UI Apex Test Execution

At what log level are User Debugs logged?

Choose two places where can debug log filter settings be set?

Identify two types of information provided by the Checkpoints tab in the Developer console.

Describe three capabilities of the Developer Console

1. Execute Anonymous Apex Code, 2. Create/Edit Code, 3. View Debug Logs

A developer created an Apex trigger using the Developer Console and now wants to debug code. How can the developer accomplish this in the Developer Console?

Open the Logs tab in the Developer Console

What are two capabalities of Force.com IDE?

1. Edit metadata components. 2. Run Apex tests.

Which two Deployment Tools can be used to move metadata?

1. Change Sets 2 Force.com Migration tool

Identify two different options that a valid source and destination pair can use to send or receive change sets.

1. Sandbox to production, 2. Sandbox to sandbox.

Describe three facts about change set deployments.