Data Types – Exercises
Quiz Summary
0 of 25 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 25 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
-
Unfortunately, your results in the simulator were not up to the desired standards. 😔
However, take advantage of your unlimited access and continue to practice.
Remember, persistence and dedication will lead to mastery. 😎 -
Congratulations! 🎉
You have successfully passed the simulator and are now one step closer to achieving your certification.
We hope you will consider joining us again in your future certification journey.Wishing you the best of luck with the upcoming exam. Keep up the great work! 💪
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- Current
- Review
- Answered
- Correct
- Incorrect
-
Question 1 of 25
1. Question
You are working on a feature that requires the conversion of a text string into a binary format for encryption purposes. You need to convert the string
'HelloWorld'into a Blob object. Complete the following line of code:-
Blob myBlob = Blob.valueOf( );
CorrectIncorrect -
-
Question 2 of 25
2. Question
You have received binary data from an external system, and you need to save it into a
Blobvariable namedincomingData. Fill in the blank to correctly type and initialize the variable.-
incomingData = Blob.valueOf(‘SampleData’);
CorrectIncorrect -
-
Question 3 of 25
3. Question
You are creating a new Apex class to determine if a customer has reached their credit limit. You want to store this determination in a simple true or false value.
Complete the following code snippet:
-
public class CreditChecker {
isCreditLimitReached = ;
}
CorrectIncorrect -
-
Question 4 of 25
4. Question
In your Apex class, you are given a method that returns whether a user has admin rights. You need to store the returned value for further processing.
Complete the code snippet below:
-
hasAdminRights = checkUserAdminRights();
CorrectIncorrect -
-
Question 5 of 25
5. Question
You’re developing an Apex class to track the start date of a training session. You want to initialize this date to the current date.
Fill in the blanks to correctly declare and initialize this date variable:
-
trainingStartDate = ;
CorrectIncorrect -
-
Question 6 of 25
6. Question
Your company wants to provide a special offer to customers on a specific launch date. You need to manually set this date to the 1st of January, 2024.
Complete the code snippet below:
-
launchDate = (2024, 1, 1);
CorrectIncorrect -
-
Question 7 of 25
7. Question
You’re developing a tracking tool within Salesforce, and you want to record the exact time and date a user completes a certain task. To do so, you need to initialize a variable to the current date and time.
Fill in the blanks to correctly declare and initialize this datetime variable:
-
taskCompletionTime = ;
CorrectIncorrect -
-
Question 8 of 25
8. Question
You’re writing a function in Apex to schedule a maintenance operation that is set to occur on 5th of February, 2024, at 10:30 AM.
Complete the code snippet below:
-
maintenanceDateTime = (2024, 2, 5, 10, 30, 0);
CorrectIncorrect -
-
Question 9 of 25
9. Question
You are developing a finance application in Salesforce. One of your tasks is to store the exchange rate for USD to EUR. You want to use a data type that can handle fractional values.
Fill in the blanks to correctly declare and initialize this variable with a sample rate of 0.85:
-
usdToEurRate = ;
CorrectIncorrect -
-
Question 10 of 25
10. Question
You are designing a simple Apex method to capture the discount percentage offered on a product. To store this percentage value, which can be something like 5.5% or 10.75%, you need to declare a variable.
Fill in the blanks to correctly declare this variable with an initial value of 5.5:
-
discountPercentage = ;
CorrectIncorrect -
-
Question 11 of 25
11. Question
You are tasked with developing a weather application in Salesforce. For a particular feature, you need to store the average rainfall, which can have decimal values like 2.35 inches or 0.78 inches.
Fill in the blanks to correctly declare this variable with a sample value of 2.35:
-
averageRainfall = ;
CorrectIncorrect -
-
Question 12 of 25
12. Question
You are developing a fitness application in Salesforce. For tracking user progress, you need to record the distance they run each day, which might be values like 5.7 kilometers or 2.9 kilometers.
Fill in the blanks to correctly declare this variable with an initial value of 5.7:
-
dailyRunDistance = ;
CorrectIncorrect -
-
Question 13 of 25
13. Question
You’re given a task to create a variable to store the opening time of a shop. The shop opens at 10:30 AM. Create a variable named
shopOpeningTimeto store this time.-
Time = Time.newInstance(10, 30, 0, 0);
CorrectIncorrect -
-
Question 14 of 25
14. Question
As part of a scheduling application, you need to store the end time for a lunch break. The break ends at 1:45 PM. Create a variable named
lunchBreakEndTimeto store this time.-
Time = Time.newInstance(13, 45, 0, 0);
CorrectIncorrect -
-
Question 15 of 25
15. Question
A junior developer wants to check if a given Object variable, named unknownData, holds a String value. Fill in the blank to complete the Apex code that checks this condition:
-
if(unknownData instanceof ) {
System.debug(‘This is a string!’);
}
CorrectIncorrect -
-
Question 16 of 25
16. Question
A developer needs to declare an Object variable in Apex that can store any type of data. The developer chooses the variable name
genericStorage. Complete the following Apex code to declare thegenericStoragevariable:-
= null;
CorrectIncorrect -
-
Question 17 of 25
17. Question
You are given a task where you need to assign a lead’s ID to a variable and later convert this ID to a string for some string manipulations. Fill in the blanks to correctly assign the lead ID and then convert it to a string:
-
ID leadId = ’00Q1N000009feKcUAI’;
String leadIdString = ;
CorrectIncorrect -
-
Question 18 of 25
18. Question
A beginner developer is designing a function to accept the ID of an Account record. The developer starts writing the function but leaves a placeholder for the data type. Complete the Apex code by filling in the placeholder:
-
public void processAccount( accountId) {
// Function logic here
}
CorrectIncorrect -
-
Question 19 of 25
19. Question
A trainee developer is building a functionality to calculate the age of a user based on their birth year. They have the current year and birth year stored in integer variables. Fill in the blanks to correctly calculate the age:
-
Integer currentYear = 2023;
Integer birthYear = 1990;
Integer age = – ;
CorrectIncorrect -
-
Question 20 of 25
20. Question
A developer is creating an Apex function to handle registration for a workshop. Each workshop can handle a maximum of 30 participants. The developer wants to declare a constant variable for this maximum limit. Fill in the blanks to correctly declare this constant:
-
public static final MAX_PARTICIPANTS = ;
CorrectIncorrect -
-
Question 21 of 25
21. Question
A junior developer needs to calculate the average score of students after a test. They already have variables declared for
totalScoreandnumberOfStudents. Fill in the blanks to correctly calculate the average score and store it in a variable namedaverageScore:-
Integer totalScore = 950;
Integer numberOfStudents = 25;
Integer = totalScore / numberOfStudents;
CorrectIncorrect -
-
Question 22 of 25
22. Question
A trainee developer is working on a function to format the display name of a user in the format “LastName, FirstName”. They have two string variables,
fNamefor the first name andlNamefor the last name. Fill in the blanks to create the formatted display name:-
String fName = ‘Emily’;
String lName = ‘Watson’;
String displayName = + ‘, ‘ + ;
CorrectIncorrect -
-
Question 23 of 25
23. Question
A developer is building an Apex function to generate greetings based on user names. They need to declare a variable that will store this greeting message. Fill in the blanks to correctly declare the
greetingMessagevariable with the initial content of “Hello”:-
greetingMessage = ‘ ‘;
CorrectIncorrect -
-
Question 24 of 25
24. Question
A junior developer is creating an application to record the number of files uploaded to a cloud storage platform over many years. The file count is expected to be significantly large. They’ve been advised to use the
Longdata type to capture this data. They currently have a value incurrentFileUploadCountand need to add 3 million to it. Assist them in filling in the blanks:-
Long currentFileUploadCount = 15000000L;
currentFileUploadCount = + ;
CorrectIncorrect -
-
Question 25 of 25
25. Question
A novice developer is building a system to keep track of the number of digital books downloaded from an online library since its inception. Given the platform’s vast content and global reach, the count can be tremendous. They’ve commenced with the
Longdata type for this task. Help them adjust the count by adding 2.5 million books to the existing count:-
Long booksDownloaded = 5000000L;
booksDownloaded = + ;
CorrectIncorrect -