Apache Apex/Apex MCQ Questions Sample Test,Sample questions

Question:
A developer created an email service and wants to deploy the classes it references in production. How can the developer write a test method to sufficiently test these classes? Choose most appropriate options.

1.The developer uses the Messaging.sendEmail().method address for the email service.

2.Classes that only contain email services are not subject requirements.

3. Developer creates Messaging.Inbound Email & pass them to Messaging inboundEmailHandler.

4.he developer creates a Messaging.outbound Email method of the Messaging.InboundEmail Handler class.

Posted Date:-2022-10-02 09:42:47


Question:
A developer created an email service and wants to deploy the classes it references in production. How can the developer write a test method to sufficiently test these classes? Choose most appropriate options.

1.The developer uses the Messaging.sendEmail().method address for the email service.

2.Classes that only contain email services are not subject requirements.

3. Developer creates Messaging.Inbound Email & pass them to Messaging inboundEmailHandler.

4.he developer creates a Messaging.outbound Email method of the Messaging.InboundEmail Handler class.

Posted Date:-2022-10-02 09:42:47


Question:
A developer used following query to retrieve Position object records.
List<Position_c> position = [ Select Name, Department_c, Location_c FROM Position_c]; Laler in the code of Apex, developer try to print status_c field value. Identify the type of exception raised.

1.Index Exception

2.Query Exception

3.SObject Exception

4.DML Exception

Posted Date:-2022-10-02 10:08:16


Question:
A developer used following query to retrieve position object records.
Listpositons= [SELECT Name,Department,Location__c from Position__c];
Later in the code of Apex,developer try to print Status__c field value. Identify the type of Exception raised?

1.IndexException

2.QueryException

3.SObjectException

4.DMLException

Posted Date:-2022-10-02 10:27:19


Question:
A developer wrote an Apex Code with SOQL embedded as given below. The Accounts Manager
position does not exist in the database. What type of exception will be thrown?
Position__c position= [SELECT Status__c, Approval_Status__c FROM Position__c WHERE
Name=’AccountsManager’];

1.DML exception

2.Query exception

3.NullPointer exception

4.Index exception

Posted Date:-2022-10-02 10:28:46


Question:
A developer wrote an Apex code with SOQL embedded as given below. The Accounts manager position as given below. The accounts manager position does not exist in database. What type of exception will be the own?
Position__C position = (select Status_C, Approval_Status_c From position__c Where department_C= ‘Account Manager’);

1.Dual Exception

2.Query Exception

3.Null Pinter Exception

4.Index Exception

Posted Date:-2022-10-03 05:33:23


Question:
A developer wrote an Apex code with SOQL embeded as given below. The Accounts Manager position does not exist in the database. What type of exception will be thrown?
Position_c position =
[SELECT Status_c, Approval_Status_c
FROM Position_c
WHERE Name = ‘Accounts Manager’];

1.DmlException

2.QueryException

3.NullPointerException

4.IndexException

Posted Date:-2022-10-02 09:22:25


Question:
A developer wrote an APEX code with SOQL embeded as given below. There are five positions for IT department. What error message will be displayed ?
Position_c position =
[SELECT Status_c, Approval_Status_c
FROM Position_c
WHERE Department_c = ‘IT’ );

1.List has more than 1 row for assignment to SObject

2.List has multiple rows for assignment to SObject

3.List has many rows for assignment to SObject

4.List has too many rows for assignment to SObject

Posted Date:-2022-10-02 09:16:22


Question:
A developer wrote an Apex code with SOQL embeded below. The account manager position does
not exist in the database. What error message will be displayed ?
Position_c position = [SELECT Status_c, Approval_Status_c
FROM Position_c
WHERE Name = ‘Accounts Manager’];

1.List has zero rows for assignment to SObject

2.List has 0 rows for assignment to SObject

3.List has no rows for assignment to SObject

4.List has many rows for assignment to SObject

Posted Date:-2022-10-02 10:22:07


Question:
A developer wrote an APEX code write SOQL embedded as given below. There are five positions for
IT dept. What error message will be displayed?
Position__C position = (select Status_C, Approval_Status_c From position__c Where department_C=
‘IT’)

1. List has more than one row for assignment Sobject

2.List has multiple rows for assignment to Sobject

3.List has many rows for assignment to Sobject

4.List has too many rows for assignment to Sobject

Posted Date:-2022-10-03 05:23:14


Question:
A user inserts data on a VF page that invokes an Apex Trigger, which calls an SObject.addError()
method. Which statement is true ? Choose most appropriate option.

1.The error message will be displayed, provided the included in the page

2.The error message will be displayed next to the field

3.The error message will not be displayed unless the field method is used

4.The error message will not be displayed as the Apex Errors are only records

Posted Date:-2022-10-02 10:14:19


Question:
A user inserts data on a VF page that invokes an Apex Trigger, which calls an SObject.addError()
method. Which statement is true?

1.The error message will be displayed, provided the component included the page

2.The error message will be displayed next to the field causing the error

3.The error message will not be displayed unless the field specific sObject.field.addError() method is used

4.The error will not be displayed as the Apex Errors are only recorded in the debug log

Posted Date:-2022-10-02 11:03:33


Question:
An org has a Candidate object with First Name and Last Name field as required. A developer is tryingto insert a candidate programmatically by following code. What exception will be raised?
Candidate_c candidate = new Candidate_c(First_Name_c = ‘Andrew’);
insert candidate;

1.IndexException

2.QueryException

3. NullPointerException

4.DmlException

Posted Date:-2022-10-02 09:39:17


Question:
An org has a Candidate object with First Name and Last Name fields as required. A developer is
trying to insert a candidate programmatically by following code. What execption will be raised?
Candidate__c candidate = new Candidate__c(First Name__c = ‘Andrew’); Insert candidate;

1.Index Exception

2.Query Exception

3.NullPointer Exception

4.DmlException

Posted Date:-2022-10-02 11:33:17


Question:
Apex is a proprietary language developed by the?

1.IBM

2.Microsoft

3.Salesforce

4.Meta

Posted Date:-2022-10-02 08:48:03


Question:
Apex is a?

1.strongly typed

2. object-oriented programming language

3.both (a) and (b)

4.None of the above

Posted Date:-2022-10-02 08:48:52


Question:
Apex should be used when we are not able to implement the complex business functionality using the pre-built and existing out of the box functionalities.

1.Yes

2.No

3.Can be yes or no

4.Can not say

Posted Date:-2022-10-02 08:55:07


Question:
Before code can be deployed in production, what percentage of test coverage must be achieved ?

1.25

2.100

3.50

4.75

Posted Date:-2022-10-02 10:31:13


Question:
Below given is the code for a Map. Identify the correct option to add 2 elements to the Map. Map m = new Map(); ______________________ // Add first key value ______________________ // Add second key value

1.m.add(1,’First Entry’); m.add(2,’Second Entry’);

2.m.insert(1,’First Entry’); m.insert(2,’Second Entry’);

3.m.push(1,’First Entry’); m.push(2,’Second Entry’);

4.m.put(1,’First Entry’); m.put(2,’Second Entry’);

Posted Date:-2022-10-02 10:15:50


Question:
Consider the following code segment :
List <Account>accList = [Select Id, AccountNumber From Account limit 20]; System.debug(‘Account Name : ‘ + accList[0].Name); Choose most appropriate option.

1.Above code will fail to execute during compile time since the name field accessed without being queried.

2.Above code will fail to execute only during run time since the name accessed without being queried.

3.Above code will throw exception.

4.Above code will not saved.

Posted Date:-2022-10-02 09:59:03


Question:
Consider the following SOSL statement.
FIND {Joe Smith }
What would be returned by statement assuming the search text present in 4 records ?

1.Return the IDs of the records where Joe Smith is found

2. Return the name of the records where Joe Smith is found

3.Return the OwnerID of the records where Joe Smith is found

4.Return the external IDs of the records where Joe Smith is found

Posted Date:-2022-10-02 10:09:21


Question:
Consider the following trigger code. Identify what SOQL will return?
Trigger simpleTrigger on Account (after insert) {
Contact[] cons = [SELECT LastName FROM Contact
WHERE AccountID IN :Trigger.new];
//some other code
}

1.Finds every account that is associated with any of the triggering contacts

2.Finds every contact that is associated with any of the triggering accounts

3.Finds every contact that is associated with any of the triggering contacts

4.Finds every account that is associated with any of the triggering accounts

Posted Date:-2022-10-02 10:11:51


Question:
Consider the following trigger code. Identify what SOQL will return?
Trigger simpleTrigger on Account (after insert) { Contact[] cons = [SELECT LastName FROM Contact
WHERE AccountId IN :Trigger.new]; //some other code }

1. Finds every account that is associated with any of the triggering contacts.

2.Finds every contact that is associated with any of the triggering accounts.

3.Finds every contacts that is associated with any of the triggering contacts.

4.Finds every account that is associated with any of the triggering accounts.

Posted Date:-2022-10-02 10:34:49


Question:
For the following Apex code. Select the correct option to fill in the blank to retrieve the index 0>my List = newList<Integer>();

);

…………………….;

1.myList.pull(0);

2.myList.get(0);

3.myList.get(1);

4.myList.retrieve(0);

Posted Date:-2022-10-02 10:07:20


Question:
Identify the correct trigger context varaiable which shows the currently executing code is apex trigger

1.is Insent

2.is Executing

3.is After

4.is Delete

Posted Date:-2022-10-03 05:50:30


Question:
Identify the correct trigger context variable which shows the currently executing code is Apex
trigger. Choose most appropre option:

1.isinsert

2.isExecuting

3.isAfter

4.isDelete

Posted Date:-2022-10-02 11:29:06


Question:
Identify the correct trigger context variable which shows the currently executing code is Apex trigger

1.isInsert

2.isExecuting

3.isAfter

4.isDelete

Posted Date:-2022-10-02 09:25:33


Question:
Identify the error in the following code.
public class Test{
Double x = 87.60;
Integer y = 56;
Integer Y = 67;
public void printData(){
System.debug(x+” “ +y +” “ +y);
}}

1.Redeclaration of y

2.Double is not a valid datatype

3.values are not properly concatenated

4.printData() definition is incorrect

Posted Date:-2022-10-02 10:19:55


Question:
Identify the invalid trigger event from the following

1.before undelete

2.after insert

3.before update

4.after delete

Posted Date:-2022-10-02 10:12:57


Question:
Identify the valid statements with respect to the encrypted fields. Choose four most appropriate options.

1.They are not available for use in filters such as list views, reports and rule filters

2.Encrypted fields are not searchable and cannot be used to define………..

3.Encrypted fields can be included in search results, report results ……..

4.All of the above

Posted Date:-2022-10-02 11:05:16


Question:
In a Data Model of an application, Account & Contact objects has a look-up relationship where
Account is parent of contact. Refer the given SOQL statement and identify the type of query.
SELECT Contact.FirstName, Contact.Account.Name from Contact

1.child-to-parent relationship query

2.parent-to-child relationship query

3.child-to-child relationship query

4.parent-to-parent relationship query

Posted Date:-2022-10-02 09:52:27


Question:
In a Data Model of an application, Job application and Review objects has Master-Detail relationship where Job Application is parent of Review. What will be the relationshipName for child-to-parent relationship?

1.Review_c

2.Reviews_r

3.Job_Application_c

4.Job_Application_r

Posted Date:-2022-10-02 10:25:03


Question:
In a Data Model of an application, Job application and Review objects has Master-Detail relationship where Job Application is parent of Review. What will be the relationshipName for parent-to-child relationship?

1.Review_c

2.Reviews_r

3.Job_application_c

4.Job_application_r

Posted Date:-2022-10-02 09:20:51


Question:
In a Data Model of an application. Account and Contact Object has a look-up relationship where
Accounts is parent of contact. Refer the given SOQL statement & identify the type of query.
SELECT Account.Name. (SELECT Contact.FirstName, Contact.LastName FROM Account.Contact) FROM
Account

1.child-to-parent relationship query

2.parent-to-child relationship query

3.child-to-child relationship query

4.parent-to-parent relationship query

Posted Date:-2022-10-02 10:22:55


Question:
In a data model of an application. Job application than and review objects has master-detail relationship where job application is parent of review. What will be the relationships for parent-to-child relationship?

1.Review__c

2.Review__k

3.Job_application_c

4.Job _application_k

Posted Date:-2022-10-03 05:31:33


Question:
In an APEX class, to declare a method as Test method, which of the following annotation or keyword you will see?

1.“@” is Test d.

2.testMethod

3.both (a) and (b)

4.None of These

Posted Date:-2022-10-02 10:05:14


Question:
In Apex, all variables and expressions have a data type?

1.Old

2.oldMap

3.new

4.newMap

Posted Date:-2022-10-02 11:00:49


Question:
In Developer Edition how much storage space we get when we sign-up for org?

1.5MB

2.10MB

3.15MB

4.20MB

Posted Date:-2022-10-02 10:53:46


Question:
In which salesforce instances would be identical record IDs? Choose most appropriate.

1.production; full sandbox

2.production, full sandbox , apex sandbox

3.production; full sandbox,confg only sandbox, apex sandbox

4.salesforce.com never repeats record Ids

Posted Date:-2022-10-03 05:48:25


Question:
In which Salesforce instances would there be identical record ids? Choose most appropriate option

1.Production, full sandbox

2.Production, full sandbox, apex sandbox.

3.Production, full sandbox, coding only sandbox, apex sandbox.

4.Salesforce.com never repeats record ids.

Posted Date:-2022-10-02 10:25:56


Question:
In which salesforce instances would there be identical record IDs? Choose most appropriate.

1.Production; Full Sandbox

2.Production; Full Sandbox; Apex Sandbox

3.Production; Full Sandbox; Config only Sandbox; Apex Sandbox

4.Salesforce.com never repeats record IDs

Posted Date:-2022-10-02 09:23:25


Question:
Long is a 64-bit number without a decimal point.

1.TRUE

2.FALSE

3.Can be true or false

4.Can not say

Posted Date:-2022-10-02 09:12:15


Question:
Refer the given code & select the correct option for checking whether the set has an element 1 or not? Set mySet = new Set(); mySet.add(1); mySet.add(3); System.assert(…………);

1.mySet.r(1)

2.mySet.Index(1)

3.mySet.contains(1)

4.mySet.present(1)

Posted Date:-2022-10-02 09:24:25


Question:
Refer the given code & select the correct option for checking whether the set has an element on not?
Set myset = new set (); Myset.add(1)Myset.add(3)
System.assert(……….);

1.myset.t (1)

2.myset.index(1)

3.myset.contains(1)

4.myset.present(1)

Posted Date:-2022-10-03 05:49:29


Question:
sObject is the data type in Apex?

1.Yes

2.No

3.Can be yes or no

4.Can not say

Posted Date:-2022-10-02 08:50:38


Question:
The __________ function prints the value of variable so that we can use this to debug or to get to know what value the variable holds currently.

1.System()

2.debug()

3.System.debug()

4.System.identify()

Posted Date:-2022-10-02 08:52:14


Question:
We can use Apex when we want to?

1.Create Web services with integrating other systems

2.Create email services for email blast or email setup

3.Create complex business processes that are not supported by existing workflow functionality or flows

4.All of the above

Posted Date:-2022-10-02 08:49:54


Question:
What are the three different custom tabs you can create

1.Web Tab

2.Visualforce Tab

3.Custom object Tab

4.All of the above

Posted Date:-2022-10-02 10:31:59


Question:
What are valid data types in Apex

1.Integer

2.Row Number

3.Date

4.All of the above

Posted Date:-2022-10-02 10:16:28


Question:
What does use of “with sharing” keyword enforce ? Choose appropriate option.

1. Only the record sharing and FLS for the running use

2.Only CRUD permission for the running user.

3.Record sharing, FLS, CRUD permission for the running user

4.Only the record sharing for the running user

Posted Date:-2022-10-02 10:06:16


Question:
What is the default option related to scope of fields to search in SOSL statement?

1.. NAME FIELDS

2.SLIDEBAR FIELDS

3.ALL FIELDS

4.PHONE FIELDS

Posted Date:-2022-10-02 09:38:09


Question:
What is the default option to scope of fields to search in SOSL statement?

1.NAME FIELDS

2.SIDE FIELDS

3.ALL FIELDS

4.PHONE FIELDS

Posted Date:-2022-10-02 11:30:02


Question:
What is true about Encrypted Fields? Choose most appropriate option

1.They are available in Validation Rules or Apex Scripts even if the user is not having the permission “View Encrypted Data”

2.Encrypted fields can be converted to other field types

3.A custom field can be converted to Encrypted Field

4.In Email Templates, if an encrypted field needs to be displayed without the mask character, the User who receives the email, should have ‘View Encrypted Data’ permission.

Posted Date:-2022-10-02 10:29:43


Question:
What should be the minimum code coverage % before deploying an Apex code?

1.71

2.73

3.75

4.72

Posted Date:-2022-10-02 09:21:30


Question:
What should be the minimum code coverage % before displaying an apex code?

1.71

2.73

3.75

4.72

Posted Date:-2022-10-03 05:32:24


Question:
What would be the value of old context variable when 3 records are in selected in an object

1.null

2.new values

3.current values

4.old values

Posted Date:-2022-10-03 05:27:03


Question:
What would be the value of old context variable when 3 records are inserted in an object.

1.null

2.new values

3.current values

4.old values

Posted Date:-2022-10-02 09:18:57


Question:
What would fit into the Model category of MVC paradigm? Choose two most appropriate options.

1.Custom Object

2.Custom Component

3.both (a) and (b)

4.None of these

Posted Date:-2022-10-02 09:41:02


Question:
When you will use SOQL ? 

1.When you know in which objects the data resides

2.Count the number of records

3.Sort results

4.All of the above

Posted Date:-2022-10-02 09:53:53


Question:
Which annotation will be used to expose Apex class as REST Resource?

1.@”RestResource

2.@”ResourceRest

3.@”HttpResource

4.@”RestHttp

Posted Date:-2022-10-02 10:58:51


Question:
Which clause will be used in SOSL statement to restrict search in specific objects

1.limit

2.returning

3.using

4.order by

Posted Date:-2022-10-03 05:29:52


Question:
Which clause will be used in SOSL statement to restrict search in specific objects.

1. Limit

2.Returning

3.Using

4.Order By

Posted Date:-2022-10-02 09:19:58


Question:
Which context variable provide a list of SObjects which we can use only in insert, update & undelete triggers?

1.old

2.oldMap

3.new

4.newMap

Posted Date:-2022-10-02 10:18:56


Question:
Which function we used to put server side apex method call in queue?

1.$A.queueAction()

2.$A.enqueueAction()

3.$Lightning.queueAction()

4.$Lighthning.enqueueAction()

Posted Date:-2022-10-02 10:56:30


Question:
Which method causes the entire set of operation to be rolled back ?

1.error()

2.showError()

3.isError

4.addError()

Posted Date:-2022-10-02 10:17:22


Question:
Which method causes the entire set of operations to be rolled back?

1.error()

2.showError()

3.isError()

4.addError()

Posted Date:-2022-10-02 10:55:19


Question:
Which of the following clause is used in a SELECT statement of a SOQL query to control the order of the query results.

1.ORDER BY

2.WHERE

3.GROUP BY

4. LIMIT

Posted Date:-2022-10-02 10:23:55


Question:
Which of the following clause is used in SOQL query to specify the maximum no of rows to return?

1.order by b) d)

2.where

3.group by

4.limit

Posted Date:-2022-10-03 05:24:26


Question:
Which of the following clause is used in SOQL query to specify the maximum number of rows to
return?

1.Order By

2.Where

3.Group By

4.Limit

Posted Date:-2022-10-02 09:17:09


Question:
Which of the following Features of Apex as a Language?

1.Apex has built in support for DML operations

2.Apex is easy to use

3.Apex is data focused and designed to execute multiple queries

4.All of the above

Posted Date:-2022-10-02 08:53:04


Question:
Which of the following is a 32-bit number that does not include any decimal point?

1.Enums

2.Integer

3.Classes

4.Double

Posted Date:-2022-10-02 08:51:23


Question:
Which triggers are invoked when two contacts are merged?

1.Only delete and update contact triggers

2.Only delete and update triggers on the parent account

3. No triggers

4.Delete and update contact triggers and triggers on the parent account.

Posted Date:-2022-10-02 09:18:10


Question:
Which triggers are invoked when two contacts are merged? Choose most appropriate option.

1.Only delete and update contact triggers

2.Only delete and update triggers on the parent account

3.No triggers

4.Delete and update contact and triggers and triggers on the parent account.

Posted Date:-2022-10-02 11:31:09


Question:
Which triggers are involved when two conflicts are merged?

1.only delete & update contact triggers

2.only delete & update contact triggers on the

3.no triggers

4.delete & updates contact triggers and triggers

Posted Date:-2022-10-03 05:25:34


Question:
You as a Apex Developer want to execute a code when 4 records of Offer_c object are updated.When you will use to write your code ?

1.Apex Web Services

2.Apex Trigger

3.Apex Unit Test

4.Apex Callouts

Posted Date:-2022-10-02 10:18:21


Question:
You as a Apex Developer want to execute a code when 4 records of Offer__c object are updated. Which you will use to write your code?

1.Apex Web Service

2.Apex Trigger

3.Apex Unit Test

4.Apex Callouts

Posted Date:-2022-10-02 11:06:05


Question:
______Job Application and Review objects has Master-Detail______. is parent of Review. What will be the RelationshipName for

1.Review__c

2.Reviews__r c

3. Job_Application__c

4. Job_Application__r

Posted Date:-2022-10-02 10:33:08


Question:
_______ are used when we want to define variables which should have constant value throughout the program execution.

1.String

2.Constants

3.Double

4.Self

Posted Date:-2022-10-02 08:54:09


More MCQS

  1. Apex MCQ Questions
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!