Data Modeling and Management: 7% Flashcards Preview

SFDC Platform Dev II > Data Modeling and Management: 7% > Flashcards

Flashcards in Data Modeling and Management: 7% Deck (62)
Loading flashcards...
1
Q

What is the difference between Static and Instance methods in Apex

A

Static methods can be called at any time. To call an instancemethod, you first have to create an instance of the class.

2
Q

What is the definition of a Set collection

A

A set is an unordered collection of objects that doesn’t contain any duplicate values

3
Q

When will you use the set collection type

A

Use a set when you don’t need to keep track of the order of the elements in the collection, and when the elements are unique and don’t have to be sorted

4
Q

What is the definition of a Map collection

A

Maps are collections of key-value pairs, where the keys are of primitive data types. Each unique key maps to a single value

5
Q

When will you use the map collection type

A

Use a map when you want to store values that are to be referenced through a key. For example, when you store a list of addresses that correspond to employee IDs.

6
Q

How do you define a variable as being a constant

A

Use the final keyword; it indicates that the variable might be assigned to a value no more than once.

7
Q

What is the definition of SOQL

A

Salesforce Object Query Language is a query-only language. It uses relationships, not joins for more intuitive navigation of data

8
Q

What is the definition of SOSL

A

Salesforce Object Search Language is a simple language for searching across all multiple persisted objects simultaneously. SOSL is similar to Apache Lucene

9
Q

What is the Geolocation Custom Field

A

Geolocation is a compound field that counts toward your org’s limits as three custom fields:
1- Latitude
2- Longitude
3-Internal Use

You can run SOQL queries only on a geolocation field’s components

10
Q

What are some of the limitations of compound fields?

A
  • Compound fields are read-only. To update field values, modify the individual field components
  • Compound fields are accessible only through the SOAP and REST APIs. The compound versions of fields aren’t accessible anywhere in the Salesforce user interface
  • Although compound fields can be queried with the Location and Address Apex classes, they’re editable only as components of the actual field.
  • Individual field components should be used in Visualforce for access or updating field values and exporting data
11
Q

What is the suffix for the Geolocation compound field?

A

Append __latitude__s or __longitude__s instead of the usual __c

12
Q

True or False:

Custom geolocation and location fields on standard addresses are supported with email templates

A

False, Custom gelocation and location fields on standard addresses are’t supported with email templates

13
Q

Can you use compound fields in lookup filters?

A

Yes and No. You can’t use compound fields in lookup filters except to filter distances that are within or not within given ranges

14
Q

Where can you use distance lookup filters for compound fields?

A

You can use distance lookup filters only in the Metadata API

15
Q

What are the 3 formula functions you can use with compound fields?

A

ISBLANK
ISCHANGED
ISNULL

16
Q

Which formula functions can you NOT use with compound fields

A
BLANKVALUE
CASE
NULLVALUE
PRIORVALUE
or the equality and comparison operators
17
Q

True or False: Geolocation fields are supported in custom settings

A

False. Geoloction fields aren’t supported in custom settings

18
Q

True or False: Geolocation fields aren’t available in dashboards or Schema Builder

A

True

19
Q

True or False: Geolocation fields are not available in Visual Workflow and in formula-based workflow and approvals

A

False, they are available in Visual Workflow and in formula-based workflow and approvals, but they can’t be used in filter based workflow updates and approvals

20
Q

Where are DISTANCE formulas (for Geolocation fields) supported in

A
  • Entry criteria for workflow rules and approval processes
  • Field update actions in workflow rules and approval processes
  • Custom validation rules
  • Lookup filters (in the metadata API only)
21
Q

Where is DISTANCE and GEOLOCATION fields allowed in a SOQL statement?

A

DISTANCE and GEOLOCATION are supported in WHERE and ORDER BY clauses

DISTANCE is supported in SELECT clauses

22
Q

Where is DISTANCE and GEOLOCATION not allowed in a SOQL statement

A

Not allowed in GROUP BY

23
Q

Which of the following is the correct usage of the GEOLOCATION function and provide the reasons why:

A) DISTANCE(warehouse_location__c, GEOLOCATION(37.775,-122.418), ‘km’)

B) DISTANCE(GEOLOCATION(37.775,-122.418), warehouse_location__c, ‘km’)

A

The answer is A

When using the GEOLOCATION function in SOQL queries, the geolocation field must precede the latitude and longitude coordinates.

24
Q

Why will the following query not work?

String units = ‘mi’;
List accountList =
[SELECT ID, Name, BillingLatitude, BillingLongitude
FROM Account
WHERE DISTANCE(My_Location_Field__c, GEOLOCATION(10,10), :units)

A

Apex bind variables aren’t supported for the units parameter in DISTANCE or GEOLOCATION functions

25
Q

What is the definition of a List collection?

A

Ordered collection of elements of a single data type. Elements are distinguished by their indeces (starting from 0)

26
Q

Which collection type (List, Sets or Maps) is the only one that is ordered?

A

Lists

27
Q

Which collection types (List, Sets or Maps) require the elements to be unique?

A

Sets and the Keys of a Map must be unique.

28
Q

What is a use case for using the List Collection type

A

To store the results of a SOQL query

29
Q

What is a use case for using the Sets Collection type

A

To hold values used to filter data queried by SOQL

30
Q

What is a use case for using the Maps Collection type

A

Cache of records indexed by ID

31
Q

If you need to create a collection of last names in Apex (“Smith”, “White”, “Doe”, “Smith”). No other data is available for populating this list. Which type of collection should be implemented?
A) - List
B) - Set
C) - Map

A

A) List
You should use list because the collection contains non-unique values, such as “Smith”, and because there is no specific data that can be used to determine a key

32
Q

At the end of the code, what is the price of bananas in the newPrices map.
Map prices = new Map();
prices.put(‘apples’, 10);
prices.put(‘bananas’, 20);

Map newPrices = prices.Clone();
newPrices.put(‘apples’, 30);
newPrices.put(‘bananas’, 40);

Set products = newPrices.keySet();

For (String product: products) {
Integer newPrice = newPrices.get(product) + 20;
newPrices.put(product, newPrice);
}

A) 20
B) 40
C) 60
D) 80

A

C) The price of bananas would be 60

33
Q

What does it mean if you apply “with sharing” to a class?

A
  • Record level sharing privileges are enforced to the class

- When performing DML operations, the user can only update the records to which he or she has edit-level access

34
Q

What does it mean if you apply “without sharing” to a class?

A
  • It ensure that when a user queries or updates the database, the record-level read or update restrictions are not taken into account (this is also referred to as running in System Mode)
35
Q

When neither “with sharing” nor “without sharing” is specified on a class declaration, what will the class default to

A

The class will run in “without sharing” mode except if a class is called from a class where sharing rules are enforced.

36
Q
Which of the following is the default access modifier:
A) Private
B) Protected
C) Public
D) Global
A

A) - Private is the default access modifier

37
Q

What does the “Protected” class modifier allow?

A

The protected modifier makes an attribute or a method available to inner classes.

Only instance methods and member attributes can use a protected method

38
Q

What is the difference between Public and Global access modifiers?

A

Public methods and variables can be used by any Apex code in the application or namespace in which they are defined.

Global methods and variables can be used by any Apex code that has access to the class, not just the apex code in the same application. If you declare a method or variable as global, you must also declare the class that contains it as global.

39
Q

Which keywords should you specify to define a constant in Apex?

A

Using the static and final keywords

40
Q

What does the getDMLRows method do?

A

Returns the number of records processed with any DML statement

41
Q

What does the getDMLStatements method do?

A

Returns the number of DML statements processed.

42
Q

What does the getHeapSize method do?

A

Returns the amount of memory in bytes used for the heap.

43
Q

What does the getQueries method do?

A

Returns the number of SOQL queries issued.

44
Q

What does the getScriptStatements method do?

A

Returns the number of statements executed.

45
Q

What is the difference between getDMLRows and getDMLRowsLimit methods?

A

The first version returns the amount of resource being used. The second returns the total amount of the resource available

The same is true for
getDMLStatements, getHeapSize, getQueries, getQueryRows and getScriptStatements

46
Q
Which syntax should you use to create a new public class named MyNewClass?
A) public class MyNewClass {}
B) class public MyNewClass {}
C) class MyNewClass {} public
D) MyNewClass {} public class
A

A) public class MyNewClass

47
Q

What is the method called to create an object out of a class definition?

A

Constructor is used to create an object out of a class definition

48
Q
Which statement is true about an Apex class?
A) A class cannot be disabled for profiles
B) An inner class can be nested at multiple levels
C) Static methods can only be declared in a top-level class definition
D) The default access modifier for methods in a class is public
A

C) Static methods in an Apex class can only be declared in a top-level class definition

49
Q

What is a use case for External IDs in DML operations?

A

External IDs can be used to establish the foreign key relationship among sObjects

For example, to insert a new contact using an external ID as reference:
Account refAcct = new Account(externalId\_\_c = '12345');
Contact c = new Contact(account - refAcct, lastName = 'Kay');
upsert c;
50
Q

On which objects are compound address fields available?

A

Only for address fields that exist as part of the standard objects included in Salesforce. You can’t create custom compound address fields.

51
Q

True or False: Apex bind variables are supported for the units parameter in DISTANCE or GEOLOCATION functions.

A

False

52
Q

What are the two types of custom settings?

A

List Custom Settings

Hierarchy Custom Settings

53
Q

What is a List Custom Setting and what are the benefits of using it?

A

Provides reusable set of static data that can be accessed across the organization.

The data is cached, access is low-cost and efficient (you don’t have to use SOQL queries that count against your governor limits)

54
Q

What is a Hierarchy Custom Setting?

A

Uses a built-in hierarchical logic that helps you ‘personalize’ settings for specific profiles or users.

55
Q

Which type of custom setting will you use to implement the following:

A shipping application requires users to fill in the country codes for international deliveries.

A

List Setting of all country codes

56
Q

Which type of custom setting will you use to implement the following:

An application calculates and tracks compensation for its sales reps, but commission percentages are based on seniority.

A

By creating a hierarchy setting, the administrator can associate a different commission percentage for each profile in the sales organization. Within the application, one formula field can then be used to correctly calculate compensation for all users; the personalized setting at the profile level inserts the correct commission percentage.

57
Q

Which type of custom setting will you use to implement the following:

An application displays a map of account locations, the best route to take, and traffic conditions. This information is useful for sales reps, but account executives only want to see account locations.

A

By creating a hierarchy setting with custom checkbox fields for route and traffic, you can enable this data for just the “Sales Rep” profile.

58
Q

What are the individual fields for the address compound field? (There are 7 of them)

A

Example for the BillingAddress:

  • BillingStreet
  • BillingCity
  • BillingState
  • BillingPostalCode
  • BillingCountry
  • BillingLatitude
  • BillingLongitude
59
Q

Are Geolocation fields and latitude and longitude on standard addresses supported in the Data Import Wizard?

A

No. Use SOAP or REST APIs to import these fields

60
Q

Are Null values valid for a Location (Compound) field?

A

Null values are valid only if BOTH latitude and longitude are null

61
Q

Which 4 operations for the SObject.SObjectType.getDescribe can be used to check CRUD in Apex?

A

isCreateable()
isAccessible()
isUpdateable()
isDeletable()

62
Q

Which SOQL syntax can be used to translate SOQL query results into the user’s language

A

toLabel(object.field)

For example
SELECT COmpany, toLabel(Recordtype.Name) from Lead