Download as pdf or txt
Download as pdf or txt
You are on page 1of 198

Pre-request every one again to join in every following groups to get

further updates and if you leave groups after your TFA and stream tests
you will miss your further updates for sure so just stay connected.

Dm - https://t.me/angelnndevil

Main group link - https://t.me/ad2group

Club - https://t.me/accentureclub

All Streams -
https://t.me/accenturstreamgroup

Materials/Channel/dumps -
https://t.me/adaccenturematerials
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
1. 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’ );

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


b. List has multiple rows for assignment to SObject
c. List has many rows for assignment to SObject
d. List has too many rows for assignment to SObject

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

a. Order By
b. Where
c. Group By
d. Limit ✓

3. Which triggers are invoked when two contacts are merged?

a. Only delete and update contact triggers ✓


b. Only delete and update triggers on the parent account
c. No triggers
d. Delete and update contact triggers and triggers on the parent account.

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

a. null ✓
b. new values
c. current values
d. old values

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

a. Limit
b. Returning ✓
c. Using
d. Order By

6. 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?

a. Review_c
b. Reviews_r ✓
c. Job_application_c
d. Job_application_r

7. What should be the minimum code coverage % before deploying an Apex code?

a. 71
b. 73
c. 75 ✓
d. 72

8. 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’];

a. DmlException
b. QueryException ✓
c. NullPointerException
d. IndexException

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

a. Production; Full Sandbox ✓


b. Production; Full Sandbox; Apex Sandbox
c. Production; Full Sandbox; Config only Sandbox; Apex Sandbox
d. Salesforce.com never repeats record IDs

10. Refer the given code & select the correct option for checking whether the set has an element 1 or
not?

Set<Integer> mySet = new Set<Integer>();

mySet.add(1);

mySet.add(3);

System.assert(…………);

a. mySet.r(1)
b. mySet.Index(1)
c. mySet.contains(1) ✓
d. mySet.present(1)

11. Identify the correct trigger context variable which shows the currently executing code is Apex
trigger.
a. isInsert
b. isExecuting ✓
c. isAfter
d. isDelete

12. What is the default option related to scope of fields to search in SOSL statement?

a. NAME FIELDS
b. SLIDEBAR FIELDS
c. ALL FIELDS ✓
d. PHONE FIELDS

13. An org has a Candidate object with First Name and Last Name field as required. A developer is trying
to insert a candidate programmatically by following code. What exception will be raised?

Candidate_c candidate = new Candidate_c(First_Name_c = ‘Andrew’);

insert candidate;

a. IndexException
b. QueryException
c. NullPointerException
d. DmlException ✓

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

a. VF
b. Custom Object ✓
c. Apex Class
d. Custom Component ✓
e. Controller Extensions

15. In Apex, all variables and expressions have a data type?

a. True ✓
b. False

16. 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.

a. The developer uses the Messaging.sendEmail().method address for the email service.
b. Classes that only contain email services are not subject requirements.
c. Developer creates Messaging.Inbound Email & pass them to Messaging inboundEmailHandler.
✓More
d. The developer creates a Messaging.outbound Email method of the Messaging.InboundEmail
Handler class.

17. Match the Dynamic Apex features with the corresponding syntax.

Features:
a) Describe Object/ Field
b) Dynamic SOQL
c) Dynamic DML
d) Dynamic SOSL

Syntax:

1. Scheme.DescribeFieldResult f = Schema.sObjectType.Account.fields.AccountNumber;
2. List<sObject> s = Database.query(querSTring);
3. Schema.DescribeFieldResult f = Schema.sObjectType.Account.fields.AccountNumber;
Sobject s = Database.query(‘SELECT AccountNumber FROM Account LIMIT 1’);
s.put(f.getsObjectField(),’12345’);
4. List<List SObject> o = Database.search(queryString);
Choose most appropriate option.

a. a-1, b-2, c-3, d-4 ✓


b. a-1, b-4, c-3, d-2
c. a-3, b-4, c-1, d-2
d. a-3, b-2, c-1, d-4

18. 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

a. child-to-parent relationship query ✓


b. parent-to-child relationship query
c. child-to-child relationship query
d. parent-to-parent relationship query

19. When you will use SOQL ? (Select three)

a. When you know in which objects the data resides ✓


b. Count the number of records ✓
c. Sort results ✓
d. Retrieve data for a specific term

20. 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.

a. Above code will fail to execute during compile time since the name field accessed without
being queried.
b. Above code will fail to execute only during run time since the name accessed without being
queried. ✓More
c. Above code will throw exception.
d. Above code will not saved.

21. In an APEX class, to declare a method as Test method, which of the following annotation or keyword
you will see? ( Select 2 )

a. “@Test”
b. testing method
c. “@” is Test ✓
d. testMethod ✓

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

a. Only the record sharing and FLS for the running use
b. Only CRUD permission for the running user.
c. Record sharing, FLS, CRUD permission for the running user
d. Only the record sharing for the running user ✓

23. For the following Apex code. Select the correct option to fill in the blank to retrieve the index 0

>my List = newList<Integer>();

);

…………………….;

a. myList.pull(0);
b. myList.get(0); ✓
c. myList.get(1);
d. myList.retrieve(0);

24. 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.

a. Index Exception
b. Query Exception ✓
c. SObject Exception
d. DML Exception

25. Consider the following SOSL statement.

FIND {Joe Smith }

What would be returned by statement assuming the search text present in 4 records ?

a. Return the IDs of the records where Joe Smith is found ✓


b. Return the name of the records where Joe Smith is found
c. Return the OwnerID of the records where Joe Smith is found
d. Return the external IDs of the records where Joe Smith is found
26. 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

a. Finds every account that is associated with any of the triggering contacts
b. Finds every contact that is associated with any of the triggering accounts ✓
c. Finds every contact that is associated with any of the triggering contacts
d. Finds every account that is associated with any of the triggering accounts

27. Identify the invalid trigger event from the following

a. before undelete ✓
b. after insert
c. before update
d. after delete

28. 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.

a. The error message will be displayed, provided the <Apex> included in the page ✓
b. The error message will be displayed next to the field
c. The error message will not be displayed unless the field method is used
d. The error message will not be displayed as the Apex Errors are only records

29. Below given is the code for a Map. Identify the correct option to add 2 elements to the Map.

Map <Integer, String> m = new Map<Integer, String>();

______________________ // Add first key value

______________________ // Add second key value

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

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

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

d. m.put(1,’First Entry’);
m.put(2,’Second Entry’); ✓
30. What are valid data types in Apex? (Select three)

a. Integer ✓
b. Row Number
c. Date ✓
d. ID ✓

31. Which method causes the entire set of operation to be rolled back ?

a. error()
b. showError()
c. isError
d. addError() ✓

32. 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 ?

a. Apex Web Services


b. Apex Trigger ✓
c. Apex Unit Test
d. Apex Callouts

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

a. old
b. oldMap
c. new ✓
d. newMap

34. 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);

a. Redeclaration of y ✓
b. Double is not a valid datatype
c. values are not properly concatenated
d. printData() definition is incorrect
35. 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’];

a. List has zero rows for assignment to SObject


b. List has 0 rows for assignment to SObject
c. List has no rows for assignment to SObject ✓
d. List has many rows for assignment to SObject

36. 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

a. child-to-parent relationship query


b. parent-to-child relationship query ✓
c. child-to-child relationship query
d. parent-to-parent relationship query

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

a. ORDER BY ✓
b. WHERE
c. GROUP BY
d. LIMIT

38. 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?

a. Review_c
b. Reviews_r
c. Job_Application_c
d. Job_Application_r ✓

When to use SOQL

• When retrieving data from a single object or multiple objects that are related to one another.
• When counting the number of records that meet a specified criteria.
• Sorting results as part of a query.
• When retrieving data from number, date or checkbox fields.
63. In which Salesforce instances would there be identical record ids? Choose most appropriate option
A. Production, full sandbox

B. Production, full sandbox, apex sandbox.

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

D. Salesforce.com never repeats record ids.

91. 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?

A. IndexException

B. QueryException

C. SObjectException

D. DMLException

3. 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

12. 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.

136) Before code can be deployed in production, what percentage of test coverage must be achieved ?
a) 25

b) 100

c) 50

d) 75

137) What are the three different custom tabs you can create?(Select 3)

a) APEX Tab

b) Web Tab

c) Visualforce Tab

d) Custom object Tab

147. Which context variable provides a list of sObjects which ………………………. undelete triggers?

Ans. TRIGGER.NEW()

148. ……………. Job Application and Review objects has Master-Detail…………….. is parent of Review. What
will be the RelationshipName for

a. Review__c

b. Reviews__r

c. Job_Application__c

d. Job_Application__r

153. 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 }

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

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

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

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

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

A. 5MB

B. 10MB

C. 15MB

D. 20MB

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

A. error()

B. showError()

C. isError()

D. addError()

169)Which function we used to put server side apex method call in queue?

$A.queueAction()

$A.enqueueAction()

$Lightning.queueAction()

$Lighthning.enqueueAction()

170)Which triggers are invoked when two contacts are merged?


Only delete and update contact triggers

Only delete and update triggers

No triggers

Delete and update contact triggers and triggers

179)Which annotation will be used to expose Apex class as REST Resource?

“@”RestResource

“@”ResourceRest

“@”HttpResource

“@”RestHttp

181) In Apex, all variables and expressions have a data type?

TRUE

FALSE

Identify the invalid trigger event from the following

a. Before undelete

b. After insert

c. Before update

d. After delete

Which context variable provides a list of sObjects which we can use only in insert, update and undelete
triggers?

A. Old

B. oldMap

C. new

D. newMap
272) Identify the valid statements with respect to Encrypted fields. (They mentioned (*Skip) in the PDF)
Choose four most appropriate options.

A. Encrypted text fields can be an exte ……

B. Encrypted fields are not searchable …...

C. Encrypted fields can be included ……

D. They are not available for use in …………………. and rule filters

E. Encrypted fields are not available ………. formula fields, outbound mess ………form

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

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

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

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

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

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

A. Encrypted text fields can be an external ID and can have default value

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

C. Encrypted fields can be included in search results, report results ........

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

E. Encrypted fields are not available in lead conversion, workflow, formula fields, outbound messages,
default values and .........forms.

291. 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?

A. Apex Web Service

B. Apex Trigger
C. Apex Unit Test

D. Apex Callouts

293. A developer wrote an Apex code with SOQL embedded as given below. The Accounts 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’];

A. List has zero rows for assignment to Sobject

B. List has 0 rows for assignment to Sobject

C. List has no rows for assignment to Sobject

D. List has many rows for assignment to Sobject

Q 302: Below given is the code for a Map. identify the correct option to add 2 elements to the Map
Mapinfeger, String m= new Map

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

A- isinsert

B- isExecuting

C- isAfter

D- isDelete

310. What is the default option to scope of fields to search in SOSL statement?

A. NAME FIELDS

B. SIDE FIELDS

C. ALL FIELDS

D. PHONE FIELDS
311. Which triggers are invoked when two contacts are merged? Choose most appropriate option.

A . Only delete and update contact triggers

B. Only delete and update triggers on the parent account

C. No triggers

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

321. 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;

A. Index Exception

B. Query Exception

C. NullPointer Exception

D. DmlException

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

A. 5MB

B. 10MB

C. 15MB

D. 20MB

417. In which salesforce instances would there be identical record IDs? Choose most appropriate option

A. Production and Config Only Sandbox

B. Production and Developer Sandbox

C. Production and Full Sandbox

D. Record Id’s are always different in different environment

461) 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’)

a) List has more than one row for assignment Sobject

b) List has multiple rows for assignment to Sobject

c) List has many rows for assignment to Sobject

d) List has too many rows for assignment to Sobject

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

a) order by

b) where

c)group by

d) limit

Which triggers are involved when two conflicts are merged?

a) only delete & update contact triggers

b) only delete & update contact triggers on the

c) no triggers

d) delete & updates contact triggers and triggers

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

a) null

b) new values

c) current values

d) old values

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

a) limit

b) returning
c) using

d) order by

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?

a) Review__c

b) Review__k (Need to discuss)

c) Job_application_c

d) Job _application_k

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

a) 71

b) 73

c) 75

d) 72

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’);

a) Dual Exception

b) Query Exception

c) Null Pinter Exception

d) Index Exception

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

a) production; full sandbox

b) production, full sandbox , apex sandbox


c) production; full sandbox,confg only sandbox, apex sandbox

d) salesforce.com never repeats record Ids

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(……….);

a) myset.t (1)

b) myset.index(1)

c) myset.contains(1)

d) myset.present(1)

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

a) is Insent

b) is Executing

c) is After

d) is Delete

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

a) NAME FIELDS

b) SLIDEBAR FIELDS

c) ALL FIELDS

d) PHONE FIELDS

2) A developer wrote an apex code with soql embedded as given below. The account manager position
does not exist in database what type of exception will be thrown. QUERY:

Position__c Position = (select Status__c, Approval__status__c from Position__c where name=’Accounts


Manager’);

a) DML Exception
b) Query Exception
(https://developer.salesforce.com/docs/atlas.enus.apexref.meta/apexref/apex_classes_exception_m
ethods.htm)

c) Null pointer Exception

d) Index Exception

4) Refer the given code and choose the correct option for checking whether set has an element 1 or
not? CODE: Set myset = new set(); myset.add(1); myset.add(3); system.assert(……);

a) myset.remove(1)

b) myset.index(1)

c) myset.contains(1)
(https://developer.salesforce.com/docs/atlas.enus.apexcode.meta/apexcode/langCon_apex_collecti
ons_sets.htm)

d) myset.present(1)

9) In apex all variables and expressions have a data type?

a) True
(https://developer.salesforce.com/docs/atlas.enus.apexcode.meta/apexcode/langCon_apex_data_ty
pes.htm)

b) False

10) A developer created an email service and wants to deploy the classes it references in production.
How can a developer write a test method to sufficiently test these classes?

a) The developer uses messaging send.email() method address to the email service.

b) Class that only contains email services are not subject requirements.

c) Developer create messaging inbound email and pass them to messaging inbound email handler

( Need to be discuss)

d) The developer creates messaging outbound email method of messaging. Inbound email handler class
7) An org has candidate object with firstname and lastname field is required. A developer is trying to
insert a candidate programmatically by following code. What exception will be made? Code:
Candidate__c Candidate = new Candidate__c (First_Name__c = ‘Andrew’); Insert Candidate;

a) Index exception

b) Query exception

c) Nullpoint exception

d) Dml exception
(https://developer.salesforce.com/docs/atlas.enus.apexref.meta/apexref/apex_classes_exception_m
ethods.htm)

8) What would fit into the model category of MVC paradigm? Choose two appropriate options.

a) VF

b) Custom object

c) Apex class

d) Custom component

11) Match the dynamic Apex features with the corresponding syntax. Features:

a) Describe object/field

b) Dynamic SOQL

c) Dynamic DML

d) Dynamic SOSL (No Syntax were given. Search for syntax)

Syntax

1.Scheme DescribeFieldResult f = Schema sObjectType. Account.fields.AccountNumber;

2. List <sObject> s = Database query(querSTring);

3 Schema DescribeFieldResult f = Schema sObjectType.Account.fields.AccountNumber,

Sobject s = Database.query (‘SELECT AccountNumber FROM Account LIMIT 1’);

s.put(f. getsObjectField() ,’12345’);

4. List<List SObject> o = Database.search (queryString);

Choose most appropriate option


a) a-1, b-2, c-3, d-4

b) a-1, b-4, c-3, d-2

c) a-3, b-4, c-1, d-2

d) a-3, b-2, c-1, d-4

12) In a data model of an application, account & contact objects have a look up relation where account
is parent of contact. Refer the below SOQL statements and identify the type of query. Select
Contact.FirstName, Contact.Account.Name from Contact.

a) child to parent relationship query

b) parent to child relationship query

c) child to child relationship query

d) parent to parent relationship query

13) When u will use SOQL. Select 3 options.

a) When you know in which objects the data resides

b) Count the no of records

c) Sort results
(https://developer.salesforce.com/docs/atlas.enus.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.ht
m)

d) Retrieve a date from specific term

14) Consider the following code segment.

List <Account>acclist = [select id, account, number from Account limit 20;]

System.debug(‘Account Name:’ +acclist[0]. Name);

Choose appropriate option.

a) Above code will fail to execute during compile time since the name field accessed without being
queried.
b) Above code will fail to execute during run time since the name field accessed without being queried.
(Need to be discuss)

c) Above code will throw exception.

d) Above code will not be saved.

15) In an Apex class, to declare a method as test method, which of the following annotation on keyword
will u use? (select 2)

a) “@Test”

b) Testing Method

c) “@”isTest
(https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_intro)
CheckOnce

d) testMethod

16) What does use of “with sharing” keyword enforce? Choose appropriate option.

a) Only the record sharing and FLS for the running use

b) Only CRUD permission for running user

c) Record sharing, FLS, CRUD record sharing for running user

d) Only the record sharing for running user

17) For the following Apex code select the correct option to fill the blank to retrieve the index 0. > mylist
= newList ();

a) mylist.pull(0);

b) mylist.get(0);
(https://developer.salesforce.com/docs/atlas.enus.apexcode.meta/apexcode/langCon_apex_collecti
ons_lists.htm)

c) mylist.get(1);

d) mylist.retrive(0);
18) A developer used following query to retrieve Position object records. List Position = [Select Name,
Department__C, Location__c from Position__c]. Later in the code of Apex, developer try to print
Status__c field value. Identify the type of exception made.

a) Index

b) Query Exception

c) SObject

d) Dml Exception

19) Consider the following SOSL statement. “Find {Joe Smith}”. What would be returned by statement
assuming the saved text present in records?

a) Return the ids of the record where Joe Smith is found.

b) Return the name of the record where Joe Smith is found.

c) Return the owner ids of the record where Joe Smith is found.

d) Return the external ids of the record where Joe Smith is found.

20) Consider the following the trigger code. Identify what SOQL will return? Trigger simple trigger on
Account (After insert) {Contact [] cons = {select lastname from contact where Accountid in:
trigger.name}; some other code}

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

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

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

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

21) Identify the invalid trigger event from the following.

a) before undelete

b) after insert

c) before update

d) after delete
22) A user insert data into VF page that contains an apex trigger which calls an SObject.adderror()
method. Which statement is true. Choose most appropriate.

a) The error message will be displayed, provided <apex:pagemessage> component included in


the page.

b) The error message will be displayed next to the field. (CHECK ONCE)
(https://trailhead.salesforce.com/en/content/learn/modules/apex_triggers/apex_triggers_intro)

c) The error message will not be displayed unless the filed method is used.

d) The error message will not be displayed as the apex errors are only records.

23) Below given is a code for a Map. Identify the correct option to add 2 elements to the Map.

Map<Integer, String> m = new Map <Integer,string>() ;

_______ //add first key value,

_______ //add second key value.

a) m.add (1,’First entry’);

m.add (2, ’second entry’);

b) m.insert (1,’First entry’);

m.insert (2, ’second entry’);

c) m.push (1,’First entry’);

m.push (2, ’second entry’);

d) m.put (1,’First entry’);

m.put(2, ’second entry’);

24) What are the valid data type in apex? select 3

a) Integer

b) Row Number

c) Date (https://www.c-sharpcorner.com/article/apex-data-types-in-salesforce/)
d) Id

25) Which method causes entire set of operation to be rolled back?

a) error()

b) showerror()

c) iserror

d) adderror()

26) You as an Apex developer want to execute a code when 4 records of Offer__c object are updated.
When will use to write your code?

a) Apex web services

b) Apex triggers

c) Apex unittest

d) Apex callouts

27) Which context variable provide a list of SObects which we can use only in inset, update & undelete
triggers?

a) Old

b) OldMap

c) New

d) NewMap

28) Identify the error in following code. Public Class Test { Double x=87,60; integer y = 56; Integer Y=67;
Print public void printdata() { System.debug(x+” ”+y+” “+Y); } }

a) Redeclaration of Y

b) Double is not a valid datatype

c) Values are not properly concatenated

d) printdata() function is incorrect


29) A developer wrote an apex code with soql embedded 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’];

a) List has zero values for assignment to subject.

b) List has 0 rows for assignment to subject.

c) List has no rows for assignment to subject.

d) List has many rows for assignment to subject.

30) In a data model of an application, Accounts and contacts objects have a look up relation where
account is the parent of contact. Refer the given soql statement & identify the types of query. Select
account.name. (select contact.firstname, contact.lastname from account.contacts) from account.

a) child to parent relationship query

b) parent to child relationship query

c) child to child relationship query

d) parent to parent relationship query

31) which of the following clause is used on a select statement of soql query to control the order of the
Query results.

a) order by

b) where

c) group by

d) limit

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 relationship name for child-to-parent
relationship?

a)Review___c

b)Review___r

c)Jobapplication___c
d)Jobapplication___r

38)Describe the relationship between sObjects and Salesforce records.


a) The name of an sObject field in Apex is the label of the field in Salesforce.

b) A custom object's API name and label are the same.

c) Every record in Salesforce is natively represented as an sObject in Apex.

39) You can obtain an instance of an sObject, such as Account, in one of the following ways:
a) By creating the sObject only.

b) Either by creating the sObject or by retrieving a persistent record from Salesforce using SOQL.

c) By retrieving the sObject only.

40) Which of the following is correct about a generic sObject variable?


a) A generic sObject variable can be assigned only to another generic sObject.

b) Generic sObjectscan't be created.

c) A generic sObject variable can be assigned to any specific sObject, standard or custom. Such as
Account or Book__c.
A
D
D
C
D
C
C
D
B
A
A
B
B
B
C
B,D
B,C
B
B
B
B
C
A
A
A,D
B
DC
C
B
A
D
B
C
B,D
B
B
B
A,D
A
A
C
D
B,C
C
1. 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’ );

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


b. List has multiple rows for assignment to SObject
c. List has many rows for assignment to SObject
d. List has too many rows for assignment to SObject

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

a. Order By
b. Where
c. Group By
d. Limit ✓

3. Which triggers are invoked when two contacts are merged?

a. Only delete and update contact triggers ✓


b. Only delete and update triggers on the parent account
c. No triggers
d. Delete and update contact triggers and triggers on the parent account.

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

a. null ✓
b. new values
c. current values
d. old values

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

a. Limit
b. Returning ✓
c. Using
d. Order By

6. 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?

a. Review_c
b. Reviews_r ✓
c. Job_application_c
d. Job_application_r

7. What should be the minimum code coverage % before deploying an Apex code?

a. 71
b. 73
c. 75 ✓
d. 72

8. 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’];

a. DmlException
b. QueryException ✓
c. NullPointerException
d. IndexException

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

a. Production; Full Sandbox ✓


b. Production; Full Sandbox; Apex Sandbox
c. Production; Full Sandbox; Config only Sandbox; Apex Sandbox
d. Salesforce.com never repeats record IDs

10. Refer the given code & select the correct option for checking whether the set has an element 1 or
not?

Set<Integer> mySet = new Set<Integer>();

mySet.add(1);

mySet.add(3);

System.assert(…………);

a. mySet.r(1)
b. mySet.Index(1)
c. mySet.contains(1) ✓
d. mySet.present(1)

11. Identify the correct trigger context variable which shows the currently executing code is Apex
trigger.
a. isInsert
b. isExecuting ✓
c. isAfter
d. isDelete

12. What is the default option related to scope of fields to search in SOSL statement?

a. NAME FIELDS
b. SLIDEBAR FIELDS
c. ALL FIELDS ✓
d. PHONE FIELDS

13. An org has a Candidate object with First Name and Last Name field as required. A developer is trying
to insert a candidate programmatically by following code. What exception will be raised?

Candidate_c candidate = new Candidate_c(First_Name_c = ‘Andrew’);

insert candidate;

a. IndexException
b. QueryException
c. NullPointerException
d. DmlException ✓

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

a. VF
b. Custom Object ✓
c. Apex Class
d. Custom Component ✓
e. Controller Extensions

15. In Apex, all variables and expressions have a data type?

a. True ✓
b. False

16. 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.

a. The developer uses the Messaging.sendEmail().method address for the email service.
b. Classes that only contain email services are not subject requirements.
c. Developer creates Messaging.Inbound Email & pass them to Messaging inboundEmailHandler.
✓More
d. The developer creates a Messaging.outbound Email method of the Messaging.InboundEmail
Handler class.

17. Match the Dynamic Apex features with the corresponding syntax.

Features:
a) Describe Object/ Field
b) Dynamic SOQL
c) Dynamic DML
d) Dynamic SOSL

Syntax:

1. Scheme.DescribeFieldResult f = Schema.sObjectType.Account.fields.AccountNumber;
2. List<sObject> s = Database.query(querSTring);
3. Schema.DescribeFieldResult f = Schema.sObjectType.Account.fields.AccountNumber;
Sobject s = Database.query(‘SELECT AccountNumber FROM Account LIMIT 1’);
s.put(f.getsObjectField(),’12345’);
4. List<List SObject> o = Database.search(queryString);
Choose most appropriate option.

a. a-1, b-2, c-3, d-4 ✓


b. a-1, b-4, c-3, d-2
c. a-3, b-4, c-1, d-2
d. a-3, b-2, c-1, d-4

18. 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

a. child-to-parent relationship query ✓


b. parent-to-child relationship query
c. child-to-child relationship query
d. parent-to-parent relationship query

19. When you will use SOQL ? (Select three)

a. When you know in which objects the data resides ✓


b. Count the number of records ✓
c. Sort results ✓
d. Retrieve data for a specific term

20. 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.

a. Above code will fail to execute during compile time since the name field accessed without
being queried.
b. Above code will fail to execute only during run time since the name accessed without being
queried. ✓More
c. Above code will throw exception.
d. Above code will not saved.

21. In an APEX class, to declare a method as Test method, which of the following annotation or keyword
you will see? ( Select 2 )

a. “@Test”
b. testing method
c. “@” is Test ✓
d. testMethod ✓

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

a. Only the record sharing and FLS for the running use
b. Only CRUD permission for the running user.
c. Record sharing, FLS, CRUD permission for the running user
d. Only the record sharing for the running user ✓

23. For the following Apex code. Select the correct option to fill in the blank to retrieve the index 0

>my List = newList<Integer>();

);

…………………….;

a. myList.pull(0);
b. myList.get(0); ✓
c. myList.get(1);
d. myList.retrieve(0);

24. 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.

a. Index Exception
b. Query Exception ✓
c. SObject Exception
d. DML Exception

25. Consider the following SOSL statement.

FIND {Joe Smith }

What would be returned by statement assuming the search text present in 4 records ?

a. Return the IDs of the records where Joe Smith is found ✓


b. Return the name of the records where Joe Smith is found
c. Return the OwnerID of the records where Joe Smith is found
d. Return the external IDs of the records where Joe Smith is found
26. 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

a. Finds every account that is associated with any of the triggering contacts
b. Finds every contact that is associated with any of the triggering accounts ✓
c. Finds every contact that is associated with any of the triggering contacts
d. Finds every account that is associated with any of the triggering accounts

27. Identify the invalid trigger event from the following

a. before undelete ✓
b. after insert
c. before update
d. after delete

28. 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.

a. The error message will be displayed, provided the <Apex> included in the page ✓
b. The error message will be displayed next to the field
c. The error message will not be displayed unless the field method is used
d. The error message will not be displayed as the Apex Errors are only records

29. Below given is the code for a Map. Identify the correct option to add 2 elements to the Map.

Map <Integer, String> m = new Map<Integer, String>();

______________________ // Add first key value

______________________ // Add second key value

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

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

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

d. m.put(1,’First Entry’);
m.put(2,’Second Entry’); ✓
30. What are valid data types in Apex? (Select three)

a. Integer ✓
b. Row Number
c. Date ✓
d. ID ✓

31. Which method causes the entire set of operation to be rolled back ?

a. error()
b. showError()
c. isError
d. addError() ✓

32. 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 ?

a. Apex Web Services


b. Apex Trigger ✓
c. Apex Unit Test
d. Apex Callouts

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

a. old
b. oldMap
c. new ✓
d. newMap

34. 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);

a. Redeclaration of y ✓
b. Double is not a valid datatype
c. values are not properly concatenated
d. printData() definition is incorrect
35. 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’];

a. List has zero rows for assignment to SObject


b. List has 0 rows for assignment to SObject
c. List has no rows for assignment to SObject ✓
d. List has many rows for assignment to SObject

36. 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

a. child-to-parent relationship query


b. parent-to-child relationship query ✓
c. child-to-child relationship query
d. parent-to-parent relationship query

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

a. ORDER BY ✓
b. WHERE
c. GROUP BY
d. LIMIT

38. 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?

a. Review_c
b. Reviews_r
c. Job_Application_c
d. Job_Application_r ✓

When to use SOQL

• When retrieving data from a single object or multiple objects that are related to one another.
• When counting the number of records that meet a specified criteria.
• Sorting results as part of a query.
• When retrieving data from number, date or checkbox fields.
63. In which Salesforce instances would there be identical record ids? Choose most appropriate option
A. Production, full sandbox

B. Production, full sandbox, apex sandbox.

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

D. Salesforce.com never repeats record ids.

91. 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?

A. IndexException

B. QueryException

C. SObjectException

D. DMLException

3. 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

12. 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.

136) Before code can be deployed in production, what percentage of test coverage must be achieved ?
a) 25

b) 100

c) 50

d) 75

137) What are the three different custom tabs you can create?(Select 3)

a) APEX Tab

b) Web Tab

c) Visualforce Tab

d) Custom object Tab

147. Which context variable provides a list of sObjects which ………………………. undelete triggers?

Ans. TRIGGER.NEW()

148. ……………. Job Application and Review objects has Master-Detail…………….. is parent of Review. What
will be the RelationshipName for

a. Review__c

b. Reviews__r

c. Job_Application__c

d. Job_Application__r

153. 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 }

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

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

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

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

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

A. 5MB

B. 10MB

C. 15MB

D. 20MB

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

A. error()

B. showError()

C. isError()

D. addError()

169)Which function we used to put server side apex method call in queue?

$A.queueAction()

$A.enqueueAction()

$Lightning.queueAction()

$Lighthning.enqueueAction()

170)Which triggers are invoked when two contacts are merged?


Only delete and update contact triggers

Only delete and update triggers

No triggers

Delete and update contact triggers and triggers

179)Which annotation will be used to expose Apex class as REST Resource?

“@”RestResource

“@”ResourceRest

“@”HttpResource

“@”RestHttp

181) In Apex, all variables and expressions have a data type?

TRUE

FALSE

Identify the invalid trigger event from the following

a. Before undelete

b. After insert

c. Before update

d. After delete

Which context variable provides a list of sObjects which we can use only in insert, update and undelete
triggers?

A. Old

B. oldMap

C. new

D. newMap
272) Identify the valid statements with respect to Encrypted fields. (They mentioned (*Skip) in the PDF)
Choose four most appropriate options.

A. Encrypted text fields can be an exte ……

B. Encrypted fields are not searchable …...

C. Encrypted fields can be included ……

D. They are not available for use in …………………. and rule filters

E. Encrypted fields are not available ………. formula fields, outbound mess ………form

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

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

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

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

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

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

A. Encrypted text fields can be an external ID and can have default value

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

C. Encrypted fields can be included in search results, report results ........

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

E. Encrypted fields are not available in lead conversion, workflow, formula fields, outbound messages,
default values and .........forms.

291. 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?

A. Apex Web Service

B. Apex Trigger
C. Apex Unit Test

D. Apex Callouts

293. A developer wrote an Apex code with SOQL embedded as given below. The Accounts 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’];

A. List has zero rows for assignment to Sobject

B. List has 0 rows for assignment to Sobject

C. List has no rows for assignment to Sobject

D. List has many rows for assignment to Sobject

Q 302: Below given is the code for a Map. identify the correct option to add 2 elements to the Map
Mapinfeger, String m= new Map

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

A- isinsert

B- isExecuting

C- isAfter

D- isDelete

310. What is the default option to scope of fields to search in SOSL statement?

A. NAME FIELDS

B. SIDE FIELDS

C. ALL FIELDS

D. PHONE FIELDS
311. Which triggers are invoked when two contacts are merged? Choose most appropriate option.

A . Only delete and update contact triggers

B. Only delete and update triggers on the parent account

C. No triggers

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

321. 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;

A. Index Exception

B. Query Exception

C. NullPointer Exception

D. DmlException

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

A. 5MB

B. 10MB

C. 15MB

D. 20MB

417. In which salesforce instances would there be identical record IDs? Choose most appropriate option

A. Production and Config Only Sandbox

B. Production and Developer Sandbox

C. Production and Full Sandbox

D. Record Id’s are always different in different environment

461) 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’)

a) List has more than one row for assignment Sobject

b) List has multiple rows for assignment to Sobject

c) List has many rows for assignment to Sobject

d) List has too many rows for assignment to Sobject

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

a) order by

b) where

c)group by

d) limit

Which triggers are involved when two conflicts are merged?

a) only delete & update contact triggers

b) only delete & update contact triggers on the

c) no triggers

d) delete & updates contact triggers and triggers

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

a) null

b) new values

c) current values

d) old values

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

a) limit

b) returning
c) using

d) order by

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?

a) Review__c

b) Review__k (Need to discuss)

c) Job_application_c

d) Job _application_k

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

a) 71

b) 73

c) 75

d) 72

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’);

a) Dual Exception

b) Query Exception

c) Null Pinter Exception

d) Index Exception

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

a) production; full sandbox

b) production, full sandbox , apex sandbox


c) production; full sandbox,confg only sandbox, apex sandbox

d) salesforce.com never repeats record Ids

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(……….);

a) myset.t (1)

b) myset.index(1)

c) myset.contains(1)

d) myset.present(1)

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

a) is Insent

b) is Executing

c) is After

d) is Delete

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

a) NAME FIELDS

b) SLIDEBAR FIELDS

c) ALL FIELDS

d) PHONE FIELDS

2) A developer wrote an apex code with soql embedded as given below. The account manager position
does not exist in database what type of exception will be thrown. QUERY:

Position__c Position = (select Status__c, Approval__status__c from Position__c where name=’Accounts


Manager’);

a) DML Exception
b) Query Exception
(https://developer.salesforce.com/docs/atlas.enus.apexref.meta/apexref/apex_classes_exception_m
ethods.htm)

c) Null pointer Exception

d) Index Exception

4) Refer the given code and choose the correct option for checking whether set has an element 1 or
not? CODE: Set myset = new set(); myset.add(1); myset.add(3); system.assert(……);

a) myset.remove(1)

b) myset.index(1)

c) myset.contains(1)
(https://developer.salesforce.com/docs/atlas.enus.apexcode.meta/apexcode/langCon_apex_collecti
ons_sets.htm)

d) myset.present(1)

9) In apex all variables and expressions have a data type?

a) True
(https://developer.salesforce.com/docs/atlas.enus.apexcode.meta/apexcode/langCon_apex_data_ty
pes.htm)

b) False

10) A developer created an email service and wants to deploy the classes it references in production.
How can a developer write a test method to sufficiently test these classes?

a) The developer uses messaging send.email() method address to the email service.

b) Class that only contains email services are not subject requirements.

c) Developer create messaging inbound email and pass them to messaging inbound email handler

( Need to be discuss)

d) The developer creates messaging outbound email method of messaging. Inbound email handler class
7) An org has candidate object with firstname and lastname field is required. A developer is trying to
insert a candidate programmatically by following code. What exception will be made? Code:
Candidate__c Candidate = new Candidate__c (First_Name__c = ‘Andrew’); Insert Candidate;

a) Index exception

b) Query exception

c) Nullpoint exception

d) Dml exception
(https://developer.salesforce.com/docs/atlas.enus.apexref.meta/apexref/apex_classes_exception_m
ethods.htm)

8) What would fit into the model category of MVC paradigm? Choose two appropriate options.

a) VF

b) Custom object

c) Apex class

d) Custom component

11) Match the dynamic Apex features with the corresponding syntax. Features:

a) Describe object/field

b) Dynamic SOQL

c) Dynamic DML

d) Dynamic SOSL (No Syntax were given. Search for syntax)

Syntax

1.Scheme DescribeFieldResult f = Schema sObjectType. Account.fields.AccountNumber;

2. List <sObject> s = Database query(querSTring);

3 Schema DescribeFieldResult f = Schema sObjectType.Account.fields.AccountNumber,

Sobject s = Database.query (‘SELECT AccountNumber FROM Account LIMIT 1’);

s.put(f. getsObjectField() ,’12345’);

4. List<List SObject> o = Database.search (queryString);

Choose most appropriate option


a) a-1, b-2, c-3, d-4

b) a-1, b-4, c-3, d-2

c) a-3, b-4, c-1, d-2

d) a-3, b-2, c-1, d-4

12) In a data model of an application, account & contact objects have a look up relation where account
is parent of contact. Refer the below SOQL statements and identify the type of query. Select
Contact.FirstName, Contact.Account.Name from Contact.

a) child to parent relationship query

b) parent to child relationship query

c) child to child relationship query

d) parent to parent relationship query

13) When u will use SOQL. Select 3 options.

a) When you know in which objects the data resides

b) Count the no of records

c) Sort results
(https://developer.salesforce.com/docs/atlas.enus.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.ht
m)

d) Retrieve a date from specific term

14) Consider the following code segment.

List <Account>acclist = [select id, account, number from Account limit 20;]

System.debug(‘Account Name:’ +acclist[0]. Name);

Choose appropriate option.

a) Above code will fail to execute during compile time since the name field accessed without being
queried.
b) Above code will fail to execute during run time since the name field accessed without being queried.
(Need to be discuss)

c) Above code will throw exception.

d) Above code will not be saved.

15) In an Apex class, to declare a method as test method, which of the following annotation on keyword
will u use? (select 2)

a) “@Test”

b) Testing Method

c) “@”isTest
(https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_intro)
CheckOnce

d) testMethod

16) What does use of “with sharing” keyword enforce? Choose appropriate option.

a) Only the record sharing and FLS for the running use

b) Only CRUD permission for running user

c) Record sharing, FLS, CRUD record sharing for running user

d) Only the record sharing for running user

17) For the following Apex code select the correct option to fill the blank to retrieve the index 0. > mylist
= newList ();

a) mylist.pull(0);

b) mylist.get(0);
(https://developer.salesforce.com/docs/atlas.enus.apexcode.meta/apexcode/langCon_apex_collecti
ons_lists.htm)

c) mylist.get(1);

d) mylist.retrive(0);
18) A developer used following query to retrieve Position object records. List Position = [Select Name,
Department__C, Location__c from Position__c]. Later in the code of Apex, developer try to print
Status__c field value. Identify the type of exception made.

a) Index

b) Query Exception

c) SObject

d) Dml Exception

19) Consider the following SOSL statement. “Find {Joe Smith}”. What would be returned by statement
assuming the saved text present in records?

a) Return the ids of the record where Joe Smith is found.

b) Return the name of the record where Joe Smith is found.

c) Return the owner ids of the record where Joe Smith is found.

d) Return the external ids of the record where Joe Smith is found.

20) Consider the following the trigger code. Identify what SOQL will return? Trigger simple trigger on
Account (After insert) {Contact [] cons = {select lastname from contact where Accountid in:
trigger.name}; some other code}

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

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

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

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

21) Identify the invalid trigger event from the following.

a) before undelete

b) after insert

c) before update

d) after delete
22) A user insert data into VF page that contains an apex trigger which calls an SObject.adderror()
method. Which statement is true. Choose most appropriate.

a) The error message will be displayed, provided <apex:pagemessage> component included in


the page.

b) The error message will be displayed next to the field. (CHECK ONCE)
(https://trailhead.salesforce.com/en/content/learn/modules/apex_triggers/apex_triggers_intro)

c) The error message will not be displayed unless the filed method is used.

d) The error message will not be displayed as the apex errors are only records.

23) Below given is a code for a Map. Identify the correct option to add 2 elements to the Map.

Map<Integer, String> m = new Map <Integer,string>() ;

_______ //add first key value,

_______ //add second key value.

a) m.add (1,’First entry’);

m.add (2, ’second entry’);

b) m.insert (1,’First entry’);

m.insert (2, ’second entry’);

c) m.push (1,’First entry’);

m.push (2, ’second entry’);

d) m.put (1,’First entry’);

m.put(2, ’second entry’);

24) What are the valid data type in apex? select 3

a) Integer

b) Row Number

c) Date (https://www.c-sharpcorner.com/article/apex-data-types-in-salesforce/)
d) Id

25) Which method causes entire set of operation to be rolled back?

a) error()

b) showerror()

c) iserror

d) adderror()

26) You as an Apex developer want to execute a code when 4 records of Offer__c object are updated.
When will use to write your code?

a) Apex web services

b) Apex triggers

c) Apex unittest

d) Apex callouts

27) Which context variable provide a list of SObects which we can use only in inset, update & undelete
triggers?

a) Old

b) OldMap

c) New

d) NewMap

28) Identify the error in following code. Public Class Test { Double x=87,60; integer y = 56; Integer Y=67;
Print public void printdata() { System.debug(x+” ”+y+” “+Y); } }

a) Redeclaration of Y

b) Double is not a valid datatype

c) Values are not properly concatenated

d) printdata() function is incorrect


29) A developer wrote an apex code with soql embedded 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’];

a) List has zero values for assignment to subject.

b) List has 0 rows for assignment to subject.

c) List has no rows for assignment to subject.

d) List has many rows for assignment to subject.

30) In a data model of an application, Accounts and contacts objects have a look up relation where
account is the parent of contact. Refer the given soql statement & identify the types of query. Select
account.name. (select contact.firstname, contact.lastname from account.contacts) from account.

a) child to parent relationship query

b) parent to child relationship query

c) child to child relationship query

d) parent to parent relationship query

31) which of the following clause is used on a select statement of soql query to control the order of the
Query results.

a) order by

b) where

c) group by

d) limit

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 relationship name for child-to-parent
relationship?

a)Review___c

b)Review___r

c)Jobapplication___c
d)Jobapplication___r

38)Describe the relationship between sObjects and Salesforce records.


a) The name of an sObject field in Apex is the label of the field in Salesforce.

b) A custom object's API name and label are the same.

c) Every record in Salesforce is natively represented as an sObject in Apex.

39) You can obtain an instance of an sObject, such as Account, in one of the following ways:
a) By creating the sObject only.

b) Either by creating the sObject or by retrieving a persistent record from Salesforce using SOQL.

c) By retrieving the sObject only.

40) Which of the following is correct about a generic sObject variable?


a) A generic sObject variable can be assigned only to another generic sObject.

b) Generic sObjectscan't be created.

c) A generic sObject variable can be assigned to any specific sObject, standard or custom. Such as
Account or Book__c.
1. Refer the code given below.
Class Library{
Private Book book ;
Public Library(Book book){
This.book = book;}
}

ANS: B
<bean id=”library” class=”com.accenture.lkm.library”>
<constructor-arg>
<bean class=”com.accenture.lkmBook”>
<constructor-arg value=”book1”>< constructor-arg>
</bean>
</constructor-arg>
</bean>

2.Consider the code


Package com.accenture.lkm:
@Component(“address”)
Public class Address{
//common word (“Hyderabad- Telangana”)//
//common word (“Bangalore-Maharasthra”)//

ANS:B
Employee Address:Bangalore-Maharasthra

3. Package com.accenture.lkm:
@Component(“employee”)
/// common word(@Autowired,Gettors and Setters,UITester
_____Line1_____
_____Line2_____
_____Line3_____
House,room1,room2

ANS:A
@Autowired,@Qualifier(“room1”),com

4.Spring configuration file inside a package? Choose2


ANS:A,D
….
ClassPathXmlApplicationContext(“com/Accenture/lkm/resourse……..”);
….
ClassPathXmlApplicationContext(“classpath:com/accenture/lkm/resourse/my_springbean.xml”)
;
5.create spring container object…
Spring configuration code
Code:
@Configuration
Public class Appconfig
@bean
Public Address createAddress(){….

ANS:A
Address address= (Address ) ctx.getBean(“createAddress”);
OR
ANS:B
……
Address address= (Address ) ctx.getBean(“Address”);

6.Choose from below…..specific EntityManagerFactory and Transaction Management


ANS:B
LocalContainerEntityManagerFactoryBean

7.Valid implementation of the delete query to delete customers….than a particular value


Code:
@Entity
Public class CustomerEntity
@Id
Private int cid;

Private double credit;
// getter and setter methods}
ANS:A
@Modifiying
@Query(“delete from CustomerEntity k where k.credit<cpoint”)
…..Int delete(….

8.Spring transaction method?


(i)…
(ii)…
common word(“
///Triggered implicitly,methods?///
ANS:B
Only(i)

9.Assume Invalid DummyException is checked exception,


////Common word(“employeeBean
Line-x, addEmployee, addDepartment,DAO Class(Logical Transactions),@transactional”)
ANS:A
@transactional(value=”txManager”,propagation=Propagation,REQUIRES_NEW

10.Following statements correct with respect to JSP?


(i) Default scope….
(ii) JSTL codes….
(iii) Page scope
ANS:C
ONLY (iii)

11.From the Following identify two INCORRECT statements about ServletConfig Object
(i)it is not created for each servlet during servlet initialization
(ii)it will be available to all servlets of an application
(iii)Its lifetime ….object is destroyed
(iv)one object per servlet class
ANS:A
I and ii only

12.Which object is created by web container for each Servlet during servlet initialization?
ANS:B
ServletConfig

13.Mr.john has been assigned the task of creating a servlet filter to log IP address of the
computers ……servlet filters in web.xml file
ANS: A
<web-app>
..
<filter>
<filter-name>..</filter-name>
<filter-class>..</filter-class>
</filter>
….
14.Blessie is a web developer wants to create a web page which always lands in
portal.accenture.com..
Common word(“ index.html,Blessie,unavoidable reasons,MyServlet.java
@WebServlet(urlPatterns=”/MyServlet”),
serialVersionUID=1L;
/**code is missing**/
ANS:B
Response.sentRedirect(http://portal.accenture.com);
15.When you want to remove the user data from session, what all the various options available
in JSP?(choose 3)?
ANS:A,B,C
(i)To delete the session..
(ii)by invoking public..
(iii)in web.xml file use<session-timeout>…
16.Sadana wants to share the common database data throughout the application,Help her to
identify the appropriate code to achieve this task?
ANS:C
<%
String username = (String)application.getAttribute(“dbname”);
%>

17.Refer the following Miss.Linda


///Common word(“<%@page language=”java”...
“ISO-8859-1”%>, meta charset=”iso-8859-1>
Add JSP script here…
ANS:A
<% String companyName=”Accenture”;
String projectName=”XYZ”;
String location=”MDC”;
%>
<%=companyName%><br>
<%=projectName%><br>
<%=location%><br>

18.Refer the following JSP pages


///Common word(“ Header.jsp:
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01
Transitional/EN”http://WWW.w3.org/TR/html4/loose.dtd>
Blue, red, page Encoding=”ISO-8859-1%>
Home.jsp: , Footer.jsp
ANS:A
1

19.refer the incomplete code given below


//Common word(“ Author , authorobj
@RunWith(springJUnit4ClassRunner.class
____Line1_____
@Autowired
ANS:C
@ContextConfiguration…

20.Correct statement(s) with respect to spring test?


(i)@DirtiesCOntext…
(ii)@ContextConfiuration…
ANS:B
Only(i)

21.Refer the code


@component
@Profile(“myprofile”)
classProduct{}
Common word//(“myprofile”)
ANS:B
System.setProperty(“….”);

22.John has created a properties file like below


Config.properties
Common Word(“james,1009090,inject values in customer
ANS:A
@Component
Public…
@Value…
Private int customer;
@Value(…”)
Private String Coustomer Name}

23.Which of the following is correct with respect to spring?


(i)@Configuration…XML files Spring configuration
(ii)@componentScan is used to scan stereotype annotation
ANS:Only (ii)
@componentScan

24.which of the following is correct


(i)JVM Support IOC
(ii)Spring Container Manages the instance of …
ANS : Only(ii)
25.Refer the Below Entity class
@Entity
Public Class EmployeeEntity{
@Id
Private int employeeId;
Private String employeeName;
……. Double salary;
//Getters and Setters are coded}
ANS: A
List<EmployeeEntity>findBySalaryBetweenOrderBySalary…param2)

26.Correct with respect to spring transaction propagation types?


(i)propagation type Propagation.REQUIRED starts a new transaction ,if a method …
(ii) propagation type Propagation.REQUIRED…
ANS: Both (1 and 2)

27. CORRECT with respect to JSP?


(i) Default scope of a variable is request
(ii)Application Scope variable will be available in all JSP files irrespective of session …
(iii)JSTL codes are not placed inside services()method
ANS: A
Both (i) and (ii)

28.CORRECT statement about autowiring


ANS: C
Autowiring requires setter or constructor in bean class

29.Identify the correct hierarchy of servlets assuming you are required to create a registration
ANS: A
RegistrationServlet,java…
HTTPServlet…..
GeneralServlet ..

30.Which is an abstract class which provides the basic implementation of Servlet interface except
Service() method?
ANS:C
Generic Servlet
31.from the following tables match the JSP implicit Objects given in table A with APIs in servlets
package given in table B.
Table A Table B
1) Out i)ServletContext,
//Common word(“application,JSPWriter,exception,Object,page,throwable.
ANS: A
1-ii,2-I,3-iv,4-iii

32.Incorrect statement about JSR-330 annotation


ANS: C
JSR-330……

33.Assume that class “Employee” is created with property “empid” and its setter method.
Refer the spring configuration given below
<bean id =”emp” class=”com.Employee”>
<property name=”empid” value=”john”>
</bean>
Employee object ///applicationContext///
ANS: A
1

34.Refer the below incomplete code for a test class


@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(____=MyConfig.class)
..
Public class TestSpringCustomClass {
@AutoWired
Private Employee employee
//Test cases goes here}
ANS: A
Classes , @ActivePro....

35.Refer the code below


@Entity
Class BookEntity{
@Id
Private int…;
///Common word(“authorName, publisherType;,getters and setters}
Choose from the below to retrieve the books using Query method approach
ANS:A
findByPublisherType(String pType)
36.Refer the JSP code below
<body>
<h3>
<%!
Int bookId=1;
Int publishYear =2000;
Public int incrementBookId(int bookId){
Return bookid==;
…….
Predict the output
ANS:B
BookId:2
PublishYear:2001

37.which of the following ..are correct with respect to JSP


(i) default scope of a variable is page
(ii) session scope variable will be available in all jsp files …
(iii)JSTL codes are placed inside service() method
ANS:B
Both(i) and(ii)

38.When servlet destroy() method will be invoked by servlet container?


ANS:A ,C
When you male any change in the servlet class and same
When you stop the server, destroy method of all existing servlet objects will ne molded

39.refer the code


Package com.model;
@component(“prodObject”)
@profile(“myProdProfile”)
Public class product {
Private int productid;
Private string product Name;
}
….

..
///Common word(“ activate”)
ANS:A
@ActiveProfiles(profiles=”myOrderProfile”)
40.Refer the incomplete code
@Component
Class customer{
….
Private Cart cart ;
}
Assume instance of the cart is managed by Spring Container by the name “cartObj” and all the
Commonword//(“SpEL to inject the cart object in customer bean
ANS:A
@Value(“#(cartOBJ”)

41.refer to the incomplete code


Package com.accenture.lkm;
___line1__
Class customer{
Private int customerId;
___Line2____
Private address address;
____Line3____
____Line4____
……Common word///(“address”, @ComponentScan(basePackage =”com”)
Public class SpringConfig{
}
Public class Tester{
ANS: A;
@Component, @Autowired, @Component,@Configuration,annotationConfigApplicationContext.
42. Type annotations? Choose 2
ANS: A,B
@component
@service

43./springormdemos”/>
<property name =”username” value….;
<property name=”password” value….;
</bean>
<bean>
Id-“cst_entityManagerFactory” class=*org.springframework.com…
/// dataSource , JpaVendorAdapter”
Class=”org.springframework.orm.jpa.vendor.hibernate.jpavendoradapter
<property name=”showSql”….
<property name=”generate..
Value=”org.hibernate.dialect.MySQL5Dialect”/>
ANS: A
driverManagerDatasource,LocalCOntainerEntityManagerFactoryBean,@Repository,@Auto f

44.incomplete code given below


<bean>
<!—Assume rest of the configuration is written-->
<tx:annotation-driven transaction-manager=”txManager”/>
<bean id=”txManager” class=”org.springframework.com.jpa…..
<property name=”entityManagerFactory” ref


----Line1___
Common word///(“ EmployeeDAOImpl implements EmployeeDAO{
addEmployee,integer employee
ANS: C
@Repository,@persistenceContext,@Transaction(value=”txManager”)

45.Consider the code given below


Package com.accenture.lkm;
Public class Employee {
Private List<String>hobbies;
//getters and setters are already codede
Common word //(“playing cricket , Watching Movies, Ui teater……’”);
ANS: B
Employee 2 Hobbies: [playing cricket ,Watching Amovie]

46.Refer the code


Package com.accenture.lkm;
Public class job {
Private int jobId;
//getters and setter
}
Public class person{
Private String[] skills;
___Line1___
Private Job job;
This skill = skill,
….
//// Spring config java class below…
..
ANS: A
@value(“#(myjob)”).@configuration, @Bean, @beanname = “my…”);

47.Service class (Physical transaction)


/line-x
Public integer addEmployee….
Employeebean , DepartmentBean
Int result=0;
Int

..
deptId+employeeDepartmentDAO.addEmployee..
return result;
// DAO Class( logical Transactions)
//
Code for creating employee
ANS: A
@Transaction(“value =”txManager”,rollback=NullPointerException.class)

48.Which method is used to retrieve the recent access time of a request by user from session?
ANS:D
getLastAccessedTime().

49.refer the code below


Web.xml
<web-app>
<servlet>
Common word//(“Magazine , com.accnture.magazine.servlet,book, load-on-startup”)
ANS: A
Book servlet

50.Komal’s task is to create a customer report on daily…


Everyday when she generates a report … task
ANS: i & iii

i.
<% java.util.Data date = new java.util.Date():
out.print(data);
%>
iii.
<%
Java.util.Data data = new java.utilDate():
%>
<%=data%>

51…… about @ DiritesContext annotation.


ANS: B
It is used to close and Load the application context once again for other ….

52.refer the code given below


@Component
@Profile(“myprodfile”)
Class product{
}
Choose from the below a valid option toactivate the profile “myprodfile”
ANS: B
System.setProperty(“spring.profiles.active”,”myprofile”);

53.which of the following are stereotype annotation?(choose 2)


ANS: A,B
@component, @service
54.login.html;
<html>
<body>
<h2>Login Page</h2>
<form action=”sessionServlet1”>
<table>
<tr><td>UserName</td><td>…..
<tr><td>Password</td><td>……
</table>
…..John, admin.
ANS: B
page2…..null

55.which lifecycle method of jsp is invoked by the container to perform the actual task also the method is
invoked by the container each ….
ANS:B
_jsp service

56.farhan wants to write a code to add 2 number and return the result…..
ANS:B

57.Miss.Ashrey has been asked to add headers and footers…..JSP….


Header.JSP and footer.JSP
ANS: A
<…
<….
<…

<..
<..

58.refer code
@entity
Public class EmployeeEntity
@Id
Private int empId;
…string name;
,,,,double salary ;
//getter and setter methods

Valid update query to update the JPA Data


ANS: A;
@modifiying
@query(“update EmployeeEntity k set k salary=new Sai’)
Int updateSalary(@Param(“newSai”)Double salary)
59.
Correct or not
i. Request scope variable in the page…
ii. Request Dispatcher of servlet API shares the request ,,,
ANS:B;
Both I and ii

60.ClassRunner.class
“myprofile”);
ANS: A, classes, @ActiveProfiles

61.multiple choice ANS:1,2


use@autowired at lineX
use@autowired at lineY
Which of the following is correct statement with respect to Spring test @DirtiesContext

<bean id="library" class="com.accenture.lkm.Library">


<cons........>
<bean class............Book">
<constructor-arg value="book1"></constructor-arg>
(
</bean>
</constructor-arg>
</bean>

JSR-330 annotations JSR-330 annotations can not beuesd along with Spring framework annotations

To delete the session attribute we can call public void removeAttributes(String name) , By invoking public void
invaliddate(), In web.xml file use <session->

@RunWith(Spring.Junit4ClassRunner.class)
@ContextConfiguration(_________=MyConfig.class)
_____
@RunWith(SpringJUNIT4ClassRunner.class) @ContextConfiguration(----------=MyConfig.class) ----------(profiles="myProfile") Public class TestSpringCustomClass{
public class TestSpringCustomClass{ @Autowired private Employee employee; } ___
___
}
Choose from below a valid combination to complete the above code____

@Component class Customer{----------private Cart cart; } @Value

Which of the following are stereotype annotations? [Choose 2] @Component ,@Sevice


_____Line 1_____
class Customer{
private int customerId;
_____Line 2_____
private Address address;
}
______Line 3_____ @Component,@Autowied,@Coponent,@Configuration,AnnottionConfigApplicationContext
class Address{
public Address(){
------
------
-------
}
@Entity class BookEntity{ @Id private int bookId; private String authorName; private String publisherType; //getter and setters }

DriverManageDataSource , LocalContainerEntityManagerFactoryBean,@Respository ,Autowired

@Respository, @PersistenceContext , @Transactional(value="Manager")


Which of the following is correct statement with respect to Spring test @DirtiesContext

@Configuration public class AppConfig { @Bean("address") public Address creatAddress() { Adsress address= new Address(); ApplicatonContext ctx=new AnnotationConfigApplicationContext(AppConfig.class); Address address=(Address)
return Address; }} ctx.getBean("addres");

Refer the incomplete code given below:

Refer the folowing JSP pages

Header.jsp:

<% @ page language = "java" contentType= "text/html; charset = ISO-8859-1" pageEncoding = "ISO-8859-1" %>
<!DOCTYPE html PUBLIC "//W3C//DTD HTML 4.01 Transitional//EN" "HTTP://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv = "Content-Type" content = "text/html; charset = ISO-8859-1">
<title> insert title here </title>
</head>
<body>
1
<h2> <font color = "blue"> This is content of Header </font> </h2>
</body>
</html>

Footer.jsp

<%@ page languages = "java" contentType = "text html; charset = ISO-8859-1" %>

Half question pending


Choose from below the INCORRECT statement about JSR-330 annotations?
Assume that class "Employee is created with property "empld" and its setter method.
Refer the spring configuration given below.

1 <bean id = "emp" class = "com.Employee">


2 <property name = "empId" value = "John">
3 </bean>

How many Employee objects will be created if the below code executes successfuly in a main method?
Assume that "context" referes to spring container ApplicationContext
1
1 public static void main(String[] args) {
2 // code for ApplicationContext creation goes here
3 Employee emp1 = (Employee) context.getBean("emp");
4 Employee emp2 = (Employee) context.getBean("emp");
5 Employee emp3= emp1;
6 }

Use the most appropriate option


Already Repeated Question
Which of the following is correct statement with respect to Spring test @DirtiesContext

Refer the below incomplete code for a test class

1 @RunWith(SpringJUnit4ClassRunner.class)
2 @ContextConfiguration(__________ = MyConfig.class)
3 __________________(profiles = "myProfile")
4 public class TestSpringCustomClass (
5 @Autowired
6 private Employee employee:
7 // test cases goes here
8 }
Choose from below a valid combination to complete the above code in the order as it appears.
Refer the code given below:

@Entity
class BookEntity{
@ld
private int bookld;
private String title; findByPublisherType(String pType)
private String authorName;
private String publisher Type;
// getters and setters
}

Choose from below the valid option to retrieve the books based on given publisher type by using Query Method Approach
Already Repeated Question
1 @Entity
2 public class CustomerEntity{
@Modifying
3 @Id
4 private int cid;
@Query("delete from CustomerEntity & where k where k.credit*cname)
5 private String cname;
int delete @Param(credit) double credit
6 private double credit;
7 // getter and setter methods
answer is not visible clearly
Choose the valid implementation of the delete query to delete customers who has credit less than a particular value.
Already Repeated Question
Which of the following is correct statement with respect to Spring test @DirtiesContext

Refer the JSP code below and predict the output

<body>
<h3>
<%!

int bookld = 1;
int publish Year = 2000;
public int incrementBookld(int bookld) {
return bookld++;
}
Book Id: 2
%> publish Year: 2001

<%
publish Year++;
bookid++;
%>
</h3>
<h3> Book Id: <% = bookld %> </h3>
<h3> Publish Year: <% = publish Year %> </h3>
</body>

Predict the Output.


Which of the following is CORRECT with respect to propogation type Propogation.REQUIRES_NEW?

(i) For a method, begin a new transaction always


(ii) If a method is invoked from another method and a transaction exists, then the same transaction is used. (i) For a method, begin a new transaction always

Choose the most appropriate option


1
2
3
4 //Line-X
5 public Integer addEmployee AndDepartment(EmployeeBean employeeBean, DepartmentBean departmentBean) throws Exception {
6 int result = 0; @Transaction(value = "txManager", propogation = Propogation.REQUIRES_NEW)
7 int deptId = employeeDepartmentDAO.addDepartment(departmentBean);
8 employeeBean.setDepartmentCode(deptId);
9 result = deptId + employeeDepartmentDAO.addEmployee(employeeBean);
10 return result;
11 }
Which of the following statements is/are CORRECT with respect to JSP?
(i) Default scope of a variable is application
(ii) Session scope variable will be available in all JSP files if it is accessed in a single session both (i) and (ii)
(iii) JSTL codes are placed inside service() method of translated servlet
Choose the most appropriate option.
Already Repeated Question
1) When you make any change in the servlet class and same
When Servlet destroy() method will be invoked by Servlet Container? [Choose 2]
2) When you stop the server, destroy method of all existing servlet objects all be invoked

When servlet destroy() method is invoked by servlet container?


Which of the following is correct statement with respect to Spring test @DirtiesContext

RegistrationServlet extends HTTPServlet


From the following identify the correct hierarchy of servlets assuming you are required to create a registration servlet to
HttPServlet extends GenericServlet
process registration request.
GenericServlet implements Servlets

Mr. john has been assigned the task of creating a servlet filter to log IP addresses of the computers from which the
request originate. help him from the follwing options to identify the correct order of tags meant for servlet filters
in web.xml file.
When you want to remove the user data from session, what all the various options available in JSP? All option, other than Perform log out ...
From the following tables match the jsp implicit objects given in table A with Api's in servlets package given in table B
Table A Table B
1.out 1.Servlet c 1. OUT - JSPWRITER 2. APPLICATION- SERVLETCONFIG 3.
2.application 2.JSPWriter EXCEPTION . THROWABLE 4. PAGE - OBJECT
3.exception 3. Object
4.page 4.Throwable
which provides the basic implementation of Servlet interface except Generic Servlet
Which is an abstract class which provides the basic implementation of servlet interface except service() method? Generic Servlet
Refer the code given below
package com.model;
@component("prodObject")
@Profile("myProdProfile")
public classs Product
{
private int productid;
private String productName;
}
@ActiveProfiles(profiles="myorderProfile")
package com.model;
@component("orderObject")
@Profile("myOrderProfile")
public classs Order
{
private int orderId;
private String orderDetail;
}

choose from the below the valid option to activate ....


Refer the code given below
@Entity
public class EmployeeEntity{
@Id @Modyfying
private int empId; @Query("update EmployeeEntity
private String name;
private double salary; Options are not clear
//getter and setter methods
}
Choose the valid implementation of the Update query to update employee salary, using Spring JPA Data.
From the following identify TWO INCORRECT statements about ServletCoding objects.
i) It is not created for each servlet dusring servlet initialization.
ii) It will be available to all servletsof an application. i and ii only
iii) Its lifetime is until the servlet class object is destroyed.
iv) One object per servlet class
Raghav must pre populate doctor's names from doctors table in a drop down list when patient is booking appointment online.
. He has written required method implementation in DAO and service layer.
Which of the following is correct statement with respect to Spring test @DirtiesContext

Raghav added following query in orm.xml file

<named-query name="getPatientsData">
@Query(name="getPatientData")
<query>select p.pName,p.appointmentDate from patients p </query>
List<String> getPatientsData();
</named-query>

Select the correct methid declaration in DAO interface. Refer the patients class and patients table.
Raghav has added a method to update the details of the patients as below
public interface PatientsDAO
{
@Query(name="updateQuery1") @Modifying is not used on the method output should return the string data which i.. the updated
int updateAppointmentSlot(Patients patients, String new Appointment(Time); appointment time.
}
But he getting exception as "DML operation is not supported".What went wrong?

Raghav added the following methods in Service and DAO implementation classes to add paitent's information in db.
//service implementation
@transactional(propagation=Propagation.REQUIRED)
Integer addPatientInService(Patients patient)
{
//calling DAO method
}
addPatientInDAO() method always exceutes in a new transaction rather than the interface started in service
//DAO implementation layer of addPatientInService() method.
@transactional(propagation=Propagation.REQUIRES_NEW)
Integer addPatientInService(Patients patient)
{
//implementation
}

what is the behaviour of the addPatientInDAO() method?


Which of the following is/are correct statement(s) with respect to spring test?
(i) @DirtiesContest is used to mark the context dirty so that it can be closed
only (i)
(ii) @ContextConfiguration can only point to Spring XML.....
Choose the most appropriate option.
Refer the incomplete code given below:

@Component
class Customer(
_____ @Value("#(cartObj")
private Cart cart;
}
Assume instance of the Cart is managed by Spring Container ________
Choose from below a valid SpEL to inject the cart object in Customer bean;

refer the code given below


@Component
@Profile("myprofile")
System.setproperty("springprofiles active","myprofile").
class Product{
}
choose from below option to activate the profile"myprofile"

DriverManagerDataSource, LocalContainerEntityManagerFactoryBean,@repository,@A
Which of the following is correct statement with respect to Spring test @DirtiesContext

_____ the incomplete code given below:


<beans>
<!--Assume rest of the configuration is written-->
<tx:annotation-driven transaction-manager____->
-----
-----
</bean>
@Repository,@PersostenceContext@Transactional(value="tx.Manager")
</beans>
____LIne 1____
public class EmployeeDAOlmpl implements____{
____Line 2_____
-------
____Line 3_____

<web-app>
--------------
<filter>
<filter-name>...</filter-name>
<filter-class>...</filter-class>
</filter>
the task of creating a serviet filter to log IP addresses of the requesis originate. help him from the following
options to identify meant for serviet filters in web.xmi file.
<web-mapping>
<filter-name>...</filter-name>
<urt-pattern>...</urt-pattern>
</filter-mapping>
----------
</web-app>

consider the code given below:


package com.accenture.ikm;
public class Employee(
private List<String>hobbies;
)
<beans>
<bean id="employee"class="com.accenture.ikm.Employee">
<property name="hobbies">
Employee 2 Hobbies : [Playing Cricket Watching Movies]
<list>
<value>playing cricket </value>
<value>watching Movies</value>
</list>
</property></bean></beans>
public class UITester{
public static void main(String args[]){
not visible further question
Which of the following is correct statement with respect to Spring test @DirtiesContext

Refer the incomplete code below


package com.accenture.ikm;
public class job{
private int jobid;
//getter and setter
}
public class person{
@Value("(myjob)").@Configuration @bean
private String[] skills;
--------Line1-----------
private job job;
Person(String[]Skills){
this.skills=skills;
}
}
Refer the Spring configuration code given below:
@Configuration
public class AppConfig {
ApplicationContext.ctx=
@bean("address")
new AnnotationConfigurationApplicationContext AppConfig .....
public address createAddress(){
Address address= (Address) ctx get....("address")
Address address = new Address();
return address;
}
Refer the code given below:
@Entity
class BookEntity{
@id
private int bookid; findByPublisherType(String p Type)
private String title;
private String authorName;
private String publisherType;
}
public Integer addEmployee
employeeBean,DepartmentBean
int result= 0;
int
deptId=employeeDepartment
@Transaction(value = "txManager",Propagation.REQUIRED_NEW)
employeeBean.setDepartmentCode
result =
deptId+employeeDepartment
return result;
}
which of the following statements are correct:
(i)Default scope of a veriable is page.
(i) & (ii)
(ii) Session scope veriable will be availabe in all JSP filesif it is accessed in a single session.
(iii) JSTL codes placed inside service() method of translated serviet.
Which method is used to retrieve the recent access time of a request by user by session? getLastAccessedTime()
Which of the following is correct statement with respect to Spring test @DirtiesContext

Refer the code below:


Web.xml
------------
<web-app>
<servlet>
<servlet-name>Book</servlet-name>
<servlet-class>com.accenture.BookServlet</servlet-class>
<load-on-startup>0</load-on-startup>
Book Servlet
</servlet>

<servlet>
<servlet-name>Magazine</servlet-name>
<servlet-class>com.accenture.MagazineServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
</web-app>
Choose from below valid options which provides complete support for creation of JPA specific EntityManagerFactory and
LocalContainerEntityManagerFactoryBean
Transaction Management.
Please Refer the following JSP pages Header.jsp <h1> This is Content of Header</h1> 1
<web-app>

<filter>
<filter-name>...</filter-name>
<filter-class>...</filter-class>
Mr. john has been assigned the task of creating a servlet filter to log IP addresses of the computers from which the </filter>
request originate. help him from the follwing options to identify the correct order of tags meant for servlet filters
in web.xml file.(Option is not Visible but answer is correct. just cross check in exam) <filter-mapping>
<filter-name>...</filter-name>
<url-pattern>...</url-pattern>
</filter-mapping>

</web-app>
@RunWith(SpringJUNIT4ClassRunner.class) @ContextConfiguration(----------=MyConfig.class) ----------(profiles="myProfile")
Option 1(options not visible)
public class TestSpringCustomClass{ @Autowired private Employee employee; }
Which is an Abstract class which provides the basic implementation of Sevlet interface except Service method? Generic Servlet
Consider the code below package com.accenture.lkm @Component("address") public class Address @Value("Hyderabad-
Employee Address Banglore,Maharashtra
Telangana")
Refer the code given below @Component @Profile("myProfile") class Product{} Choose from below a valid option to activate
System.setProperty("spring.profiles.active", "myProfile");
the profile "myprofile"
@Componet public class Customer{ @Value("${customerID}")
John has created properties file as below config properties CustomerName: James,CustomerID:1009090(Once Verify once.
private int customerID; @Value("${customerName}")
As options are not visible.Go with the Syntax)
private int customerName;
which of the following statements are correct? 1.JVM supports IOC 2. Spring Container manages the instance of the beans
only II
mentioned in the configuration and provides them back to code when needed.
which of the following statements are correct? 1. @Configuration is used to declare a XML file as a Spring configuration 2.
only II
@ComponentScan is used to scan stereotype annotation.
(i) To delete the session...........
want to remove user data from session, what all various options available in (ii) by invoking public void invalidate().
(iii) in web.xml file use<session-timeout>15</session-timeout>
Which of the following is correct statement with respect to Spring test @DirtiesContext

Komal's task is to create a customer report on daily............


everyday when she generates a report help her to identify............
task.
i.
<%
java.uti.Date date =new java.uti.Date();
out.print(date);
%>
ii.
<% i & iii
java.uti.Date date =new java.uti.Date();
%>
<%=date;%>
iii.
<%
java.uti.Date date =new java.uti.Date();
out.print(date);
%>
<%date%>

about @DirtiesContext annotation it is used to closed and load the application context.......
to retrieve the recent access times of a request by user from session? getLastAccessedTime()
(i)When you makes any changes in the...........
When Servlet destroy() method will be invoked by servlet container?
(ii)Whwn you stop the server, Destroy method of the.....
Refer the incomplete code given below:
<beans>
<!--Assume rest of the configuration is written-->
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="txManager"class="org.springframework.orm.jpa.jpa">
<property name="entityManagerFactory"ref="cst_entityManagerFactory">
</bean>
</beans>
____Line1_______ @Repository,@PersistenceContext,@Transactional(value="txManager")
public class EmployeeDAolmpl implements EmployeeDAO{
_____Line2______
private EntityManager entityManager;
____Line3_______
public Integer addEmployee(EmployeeBean employeeBean)
Integer employeeID = 0;
return employeeID;
}
Which of the following is correct statement with respect to Spring test @DirtiesContext

<jsp include page="Header.jsp">


Miss Ashrey has been asked to add headers and footers while designing login page and homepage in jsp. from the following <jsp param value="userName" name="${name}"/>
options help her to identify the right tags in JSP so that headers and footers are consistent in web pages. </jsp include>
Moreover she has to display username captured in the login page in headers across at pagesheaders and footers ate html
pages named Header.jsp and footer.jsp <jsp include page="Footer.jsp">
</jsp include>

which of the followign os CORRECT with respect to spring transection propogation


1)propogation typr Ptopogation REQUIRED starts a new transection ,it a method is involved another method and a
transection does not required.
both(1) and (2)
2) propogation type Propogation.REQUIRED_NEW start a new transection.if a method is involvedfrom another method and a
transection already exists
choose most appropriate option

Refer the incomplete code given below: package com.accenture.lkm;


class House{
private String houseNum;
--------------Line1-----------
--------------line2------------
private Rooom room; @Autowired,@Qualifier("room")
//setter and getter}
class Room{
private int roomNum;
//setter and getter}
[further question not visible in mcq3(c) pdf]

Assume that class "Employee" is created with property 'empid" and its setter metod
Refer teh spring configuration below
<bean id="emp" class ='com.Employee">
<property name="empID' value ="john">
</bean>
How many Emplotyees objects will be created if the below code executes successfully?
1
public static void main(String[] arg){
Employee emp1 =(Employee) context.getBean("emp");
Employee emp2 =(Employee) context.getBean("emp");
Employee emp3 = emp1;
}
Which of the following is correct statement with respect to Spring test @DirtiesContext

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(_________=MyConfig.class)
_____________(profiles="myProfile")
classes, @ActiveProfile
public class TestSpringCustomClass{
@Autowired
(Option was not visible properly spelling may be different)
private Employee employee;
Test cases goes here
}
@Entity
public class CustomerEntity{
@Id @Modifying
private int cid; @Query("delete from CustomerEntity k where ......0
private String cname; int delete(@Param("cpoint") double ....
private double credit;
??getter and setter (the words which are not visible is marked as dots)
}

refer the code given below


@Entity
class BookEntity{
@Id
private int bookId;
private String title; findByPublisherType(String pType)
private String authorName;
private String publishertype;
//getter and setters
}
choose from below the valid option to retrieve the books based on the given publisher type by using query method approach
Refer the JSP coide given below and predict the output
<body>
<h3>
<%!
int bookId=1;
int publishYear = 2000; Book Id :2
public int incrementBookId(int bookId){ Publish Year :2001
return bookId++;
}
%>

Which of the fopllowing is CORRECT with respect to propogation type


propogation.REQUIRES_NEW?
option(!!) only
(!) For a method, begin a new transaction always
(!!) if a method is invokes from another method and a transaction exists, then the same transaction is used
choose the most appropriate
Line-X
public integer addEmployeeAndDepartment(EmployeeBean employeeBean,
Departmentbean departmentbean) throws Exception {
int result = 0;
int deptId = employeeDepartmentDAO.addDepartment(departmentBean); @Transaction(value="txmanager",propogation = Propogation.REQUIRES_NEW)
employee.Bean.setDepartmentCode(deptId);
result = deptId + employeeDepartmentDAO.addEmployee(employeeBean);
return result;
}
Which of the following is correct statement with respect to Spring test @DirtiesContext

Which of the following statement are CORRECT with resepect to jsP


(!) Default scope of a variable is page
(!!) Session scope variable will be available in all JSP files if it is accessed in a single session both (!) and (!!)
(!!!) JSTL codes are placed insideservice() method of translater servlet
choose the most appropriate option
From the following identify the correct hierarchy of servelets assuming you are required to
Option not visible
create a registration servlet to process registration request
(!) When you make any changes in the servlet class and save
When Servlet destroy() method will be invoked by servlet Container?
(!!) When you stop the server, destroy method of all existing servlet objects will be mo...
John has created a properties file below: @C... (line not visible)

config.properties public class Customer{


customerName: James @Value("..........");
CustomerId: 1009090 ..........not visible.......
Choose from below a valid option to inject values in Customer bean from confiig.properties file }
Which of the following are correct with respect to Spring:

(i) @Configuration is used to declare an XML file as Spring configuration


option (ii) is correct
(ii) @CompensationScan is used to scan stereotype annotation

Choose most appropriate option


Which of the following statement(s) is/are CORRECT?
option (ii) is correct
(i) JVM Supports IOC
(ii) Spring container manages the instance of the beans mentioned in configuration and provides them back to code when needed.
(Not visible) is a web developer wants to create a web page which always lands in portal.accenture.com, whenever user hits on welcome button in index.html given below:

index.html
-----------------------
<form action="MyServelet" method="POST">
<input type="submit" value="welcome">
</form>

Now Blessie started writing the code, all of a sudden, she handed over the job of completing it to you due to unavoidable reasons. Incomplete code is attached below for your reference.

MyServlet.java
--------------------------- response.sendRedirect("https:/portal.accenture.com");
@WebServlet(urlPatterns="/MyServlet)
public class MyServlet extends HttpServlet{
public static final long serialVersionUID = 1L;

public myServlet(){
super();
}

..........................................
Which of the following is correct statement with respect to Spring test @DirtiesContext

@Entity

public class EmployeeEntity{


@Id;
private int employeeId;
List<EmployeeEntity> findBySalaryBetweenOrderBySalaryDesc(Double param1, Double param2))
private String employeeName;
private Double salary;
//Getters and Setters are coded
}

Which of the following are with respect to Spring transaction propagation types:

(i) propagation type Propagation.REQUIRED starts a new transaction, if a method is provided from another method and a transaction does not exist.
both (i) and (ii)
(ii) propagation type Propagation.REQUIRED_NEW starts a new transaction, if a method is invoked from another method and a transaction already exists.

Choose the most appropriate option.


Choose from below the CORRECT statement about Autowiring. Autowiring requires setters or constructors in bean classes
Consider a web application is created with a welcome index.html mapped with a Servlet class to process the response.

Refer the code below:

index.html
.......................................

<form action="LanguagesServelet" method = "POST">


<input type="checkbox" name="language" value="english"/> English
<input type="checkbox" name="language" value="hindi"/> Hindi
<input type="checkbox" name="language" value="tamil"/> Tamil
<input type="checkbox" name="language" value="malayalam"/> Malayalam
<input type="checkbox" name="language" value="telegu"/> Telegu
<input type="checkbox" name="language" value="kannada"/> Kannada
<input type="checkbox" name="language" value="french"/> French
<input type="checkbox" name="language" value="spanish"/> Spanish
<input type="submit" value="Select...........................Languages"/>
</form>

..................Not Visible....................................
when you want to remove the user data from the session,what all the various options available in JSP option starting with(to,by,in)
mr.john has been assigned the task of creating a servlet filter to log IP addresses.......................web.xml file answer not clear but i guess <web>(option 1)
Refer the following JSP pages,
Header.jsp:
<% @ page language="java" content type="text/html:charset=ISO-8859-1" 1

From the following table match the JSP implicit objects given in tabe A with APIs in servlet package given in table B 1-ii,2-i,3-iv,4-iii
.....which provide the basic implementation of servlet interface except GenericServlet
choose from the below the INCORRECT statement about JSR-300 annotation JSR-300 annotation.....
which of the following is/are CORRECT statement with respect to "spring Test" @DirtiesContext is used to mark the context dirty....
which is an abstract class which provide the basic implementation of servlet interface except service() method GenericServlet
Which of the following is correct statement with respect to Spring test @DirtiesContext

Refer the code given below


package com.model;
@component("prodObject")
@profile("myProdProfile")
@ActiveProfiles(profiles="myOrderProfile")
public class Product{
private int productId'
private String productName;
}
Class Library{
private Book book;
Public Library(Book book){ <bean id="library" class="com.accenture.lkm.Library
this.book=book; <constructor-arg>
} <bean class="com.accenture.lkm.Book">
}

Class Book{ </bean>


private string bookName; </constructor-arg>
public Book(String bookName){ </bean>
this.bookName= bookName;
}
}
Refer the below incomplete code for a test class
classes, @ActiveProfiles
@RunWith(SpringJUnit4ClassRunner.class)
<%!
Peter wants a method to add 2 numbers and return the result. He also wanted to place it
public int add(int num1, int num2) {
inside the service method. Help him to select the appropriate JSP scripting.
return num1 + num2;
}
%>
<%
Sadana wants to share the common database data throughtout the application.
String userName = (String)application.getAttribute("dbname")
Help her to identify the appropriate code to achieve the task.
%>
<%@page language="java" contextType = "text/html:charset=ISO-8859-1"
pageEncoding = "ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<%
<meta charset="ISO-8859-1">
String companyName = "Accenture";
<title>Sample</title>
String projectName = "ABC";
</head>
String location = "HYD";
<body>
%>
<%--Add JSP Script here-->
<%= companyName %>
</body>
<%= projectName %>
</html>
<%= location %>
Miss Linda has been asked to design a JSP page to display company name, project name,
location using JSP scripting elements such as expression and scriplet tags.

Identify the CORRECT script


Miss Monica has given login request to EventmanagementApp. The app displays a JSP page to prompt her to enter
the username and password. Identify the phases of JSP page it goes through until the response is generated in Translation, Compilation, Instantiation, Service and Destroy
right order
Which of the following is correct statement with respect to Spring test @DirtiesContext

<web-app>
........
<filter>
<filter-name>...</filter-name>
<filter-class>...</filter-class>
</filter>
Mr John has been assigned the task of creating a servlet flter to log IP addresses
of the computers from which the requests originate. Help him to identify the correct snippet
<filter-mapping>
<filter-name>...</filter-name>
<url-pattern>...</url-pattern>
</filter-mapping>
..........
</web-app>
Which of the following is CORRECT with respect to spring transaction propogation ?

i)propogation type: Propogation.REQUIRED starts a new transaction.


another method and a transaction does not exist.
i and ii both are correct
ii)propogation type: Propogation.REQUIRED_NEW starts a new transaction.
from another method and a transaction already exist.

Choose appropriate option.


Which of the following statements is/are CORRECT with respect to JSP?
(i) Default scope of a variable is application
(ii) JSTL codes are placed inside service() method of translated servlet only 3 is correct
(iii) page scope variable is available only on the page where it is declared
Choose the most appropriate option.
_____ the incomplete code given below:
<beans.....>
<!--Assume dataSource, EntityManagerFactory, configuration are provided>
_______Line1______

<bean id="transactionManager"
class=org.springframework.orm.jpa.JpaTransactionManager">
<property name="entitymanagerFActory" ref="csf_entityMAnagerFactory"/>
</bean>

</beans>

Choose from below the valid option to enable declaration of transaction


Management using annotations.

<web-app>
<filter>
<filter-name>....</filter-name>
<filter-class>...</filter-class>
</filter>
Shed the task of creating a servlet filter to log IP addressess of the requests originate.help him from the following options
<filter-mapping>
to identify meant for servelet filters on web.xml file
<filter-name>....</filter-name>
<uri-pattern>...<uri-pattern>
</filter-mapping>
.....
</web-app>
Which of the following is correct statement with respect to Spring test @DirtiesContext

Refer the incomplete code given below:


package com.accenture.lkm;
Class House{
Private String houseNum;
_____Line1____
_____Line2____
private Room room; @Autowired,@Qualifier("room1"),com
//setter and getter
}
class Room{
private int roomNum;
//setter and getter
}
ApplicationContext applicationContext=new
ClassPathXmlApplicationContext("com/accenture/lkm/resource/my_springbean.xml");
Select correct options to refer a Spring configuration file inside aa package? Choose2
ApplicationContext applicationContext=new
ClassPathXmlApplicationContext("classpath:com/accenture/lkm/resource/my_springbean.xml");
Which of the following is/are CORRECT with respect to Spring transaction methods?
(i) If a method throws runtime/unchecked exception, then rollback will be triggered implicity
only (i)
(ii) If a method throws checked exception, then rollback will be triggered implicitly
Choose the most appropriate option
@Transactiona(value="txManager",rollbackFor=InvalidDummyException.class)
public Integer addEmployeeAndDepartment(EmployeeBean employeeBean, DeaprtmentBean departmentBean) throws Exception{
int result=0;
int
deptId=employeeDepartmentDAO.addDepartment(deprtmentBean):employeeBean.setDepartmentCode(deptId); @Transactional(value="txManager",propogation=Propagtion Requires_NEW)
result=
deptId+employeeDepartmentDAO.addEmployee(employeeBean);
return result;
}
Which object is creared by web container for each Servlet during servlet initilization ServletConfig

Refer the incomplete code given below:


package com.model;
public class Author{
public Authore(){
System.out.println("author");
}
}
Below configuration is available in the file located at /com/resources/my_springbean.xml
<bean id="authorobj" class="com.model.Author"></bean>
package come.test; @ContextCOnfiguration(locations="/com/resources/my_springbean.xml")@Test
@Runwith(SpringJUnit4ClassRunner.class)
____Line1____
piblic class TestAuthorClass{
@Autowired
private Author author;
____Line2___
public void testAuthor(){
Assert.assertTrue(author!=null);
}
Which of the following is correct statement with respect to Spring test @DirtiesContext

<bean id="messageSource"
rohit wants to externalize the validation error messages. So, he defined the messages in
class="org springframework.support
'com/accenture/lkm/resoruces/messages_en.properties files'.Help rohit to configure the MesageSource beam in the context file
<property name="name" value="classpath\com\accenture\lkm\resources/messages_en.properties"/>
by choosing a valid option from beiow
</bean>

Rohit deployed the application in the Apache Tomcat Server. But he got an exception as "org.springframework.beans.factory. A) Configure<context:component-scan base-package="com.accenture.lkm.dao"/> in the root context
NoSuchBeanDefinitionException:No qualifying vean of type [com.accenture.lkm.dao.PruchaseDAO]". Choose from below valid confifuration
options to succesfully execute his application C) Configure <mvc:annotation-driven/> in the child context configuration

Rohit wants to display all the validation error messages in purchase jsp. <form:form method="POST" modelAttribute="bean" action="store.html">
Help him to display those messages at the bottom of the page. <table border="3">
Choose from below a valid option. Asssume the below taglib <!--Assume form elements are mentioned appropriately -->
directives are added in the jSP. </table>
<%@taglib url="http://springframework.org/tags/form" prefix="form"%> <spring:hasBindErrors name="bean">
<%@taglib
Consider theurl="http://springframework.org/tags"
code given below: prefix="spring"%> <h3>All Errors</h3>
package com.accenture.lkm; <form:errors path="*" cssClass="error"/>
public class Employee { </spring:hasBindErrors>
private list<String>hobbies: </form:form>
//Getters and Setters are already coded
}
<beans>
<bean id ="employee" class="com.accenture.lkm.Employees">
<property name="hobbies">
<list> Employee 2 hobbies [Playing Cricket Watching Movies]
<value Playing Cricket </value>
<value Watching Movies </value>
<list>
</property>
</bean>
</beans>
public class UIT Tester {
public static void main(String

<web-app>
.......
<filter>
<filter-name>...</filter-name>
<filter-class>...</filter-class>
</filter>
the task of creating a servlet filter to log IP addresses of the request originate. Help him from the following options to identify
meant forservlet filters in web.xml file.
<filter-mapping>
<filter-name>....</filter-name>
<urf-pattern>....</urf-pattern>
</filter mapping>
.......
</web-app>
Which of the following is correct statement with respect to Spring test @DirtiesContext

Refer the Spring configuration code gievn below:


1 @Configuration
2 public class AppConfig {
3 @Bean("address")
4 public address createAddress( ) { ApplicationContext ctx =
5 Address address = new Address( ) : new annotationConfigApplicationcontextAppConfig
6 return address ; Address address=(Address)ctx
7 }
8 }
Identifybthe correct code to create spring container object and get the address object injected
Choose the most appropriate option.
Refer the incomplete code given below:
package com.accenture.lkm;
public class Job {
private int jobId:
//getter and setter
}
public class Preson {
private String[] skills;
-----------line1--------------
@Value("=(myjob)"1 @configuration @Bean @Beanvalue ="myjob")
private Job job;
person(String[] skills){
}
//getter and setter
}
Refer the Springconfig java class below
------------------Line2--------------------
public class Springconfig(

Which method is used to retrieve the recent access time of a equeste by user from session?
getLastAccessedTime()
choose from below valid option.
Rohit wants to validate the quantity entered by the customer as mentioned in requirement 2. Choose from the below valid Add @Range(min=1, max=10)anotation in the Bean class
option.[Choose 2] The request handler method should include @Valid to @ModelAnnotation parameter
Rohit wants to receive the requests from customers and forward those request to other components of the application for
further processing . Choose from the most appropriate option, which Rohit performs as his first step as per Spring-MVC
workflow.
A
<bean class="org.springframework>
<property name="prefix">
Rohit wants to navigate to success.jsp page on successful submission. Assume he wrote a handler method to return <value>/WEB-INF/jspViews/</value>
ModelAndView with logical view name as success. He needs to configure a View Resolver bean in child configuration file to </property>
resolve the logical view name.Choose from below a valid option <property name="suffix">
<value>jsp</value>
</property>
</bean>
Rohit wants to create a request handler method in controller that can handle customer request and send the response back to Create a request handler method in the controller to map the request using @RequestMapping annotation and
the response back to the customer. Help rohit to achieve this with a valid option given below. return the ModelAndView object.
Rohit wants to auto populate the items available for the selected SportsType to the respective drop-down box. Assume he A
defined the respective method in the controller which can return Map<String,Double>. Rohit is supposed to bind the key as OPTION NOT VISIBLE
label attribute, value as value attribute in the drop-down box. Choose from below a valid option.
Rohit wants to create an auto populated drop-down box in purchase.jsp page. Help Rohit to implement a proper handler Create a method in the controller to invoke DAO layer method which returns the Map of SportsType with
method in controller that can retrieve sportsType defined in DAO layer. Choose from below a valid option. @ModelAttribute annotation.
Which of the following is correct statement with respect to Spring test @DirtiesContext

From the following tables match the JSP implicit objects given in table A with APIs in
sevlets package given in table B. 1 - ii
Table A Table B 2-i
1) out i) ServletContext
2) application ii) JSPWriter 3 - iv
3) exception
4) page
iii) Object
iv) Threwable
4 - iii
Refer the folowing JSP pages

Header.jsp:

<% @ page language = "java" contentType= "text/html; charset = ISO-8859-1" pageEncoding = "ISO-8859-1" %>
<!DOCTYPE html PUBLIC "//W3C//DTD HTML 4.01 Transitional//EN" "HTTP://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv = "Content-Type" content = "text/html; charset = ISO-8859-1">
<title> insert title here </title>
</head>
<body>
1
<h2> <font color = "blue"> This is content of Header </font> </h2>
</body>
</html>

Footer.jsp

<%@ page languages = "java" contentType = "text html; charset = ISO-8859-1" %>

Half question pending


Choose from below the INCORRECT statement about JSR-330 annotations?
Assume that class "Employee is created with property "empld" and its setter method.
Refer the spring configuration given below.

1 <bean id = "emp" class = "com.Employee">


2 <property name = "empId" value = "John">
3 </bean>

How many Employee objects will be created if the below code executes successfuly in a main method?
Assume that "context" referes to spring container ApplicationContext

1 public static void main(String[] args) {


1
2 // code for ApplicationContext creation goes here
3 Employee emp1 = (Employee) context.getBean("emp");
4 Employee emp2 = (Employee) context.getBean("emp");
5 Employee emp3= emp1;
6 }

Use the most appropriate option


Which of the following is correct statement with respect to Spring test @DirtiesContext

Refer the below incomplete code for a test class

1 @RunWith(SpringJUnit4ClassRunner.class)
2 @ContextConfiguration(__________ = MyConfig.class)
3 __________________(profiles = "myProfile")
4 public class TestSpringCustomClass (
5 @Autowired
6 private Employee employee:
7 // test cases goes here
8 }
Choose from below a valid combination to complete the above code in the order as it appears.
Refer the code given below:

@Entity
class BookEntity{
@ld
private int bookld;
private String title; findByPublisherType(String pType)
private String authorName;
private String publisher Type;
// getters and setters
}

Choose from below the valid option to retrieve the books based on given publisher type by using Query Method Approach
1 @Entity
2 public class CustomerEntity{
@Modifying
3 @Id
4 private int cid;
@Query("delete from CustomerEntity & where k where k.credit*cname)
5 private String cname;
int delete @Param(credit) double credit
6 private double credit;
7 // getter and setter methods
answer is not visible clearly
Choose the valid implementation of the delete query to delete customers who has credit less than a particular value.
Which of the following is correct statement with respect to Spring test @DirtiesContext

Refer the JSP code below and predict the output

<body>
<h3>
<%!

int bookld = 1;
int publish Year = 2000;
public int incrementBookld(int bookld) {
return bookld++;
}
Book Id: 2
%> publish Year: 2001

<%
publish Year++;
bookid++;
%>
</h3>
<h3> Book Id: <% = bookld %> </h3>
<h3> Publish Year: <% = publish Year %> </h3>
</body>

Predict the Output.


Which of the following is CORRECT with respect to propogation type Propogation.REQUIRES_NEW?

(i) For a method, begin a new transaction always


(ii) If a method is invoked from another method and a transaction exists, then the same transaction is used. (i) For a method, begin a new transaction always

Choose the most appropriate option


1
2
3
4 //Line-X
5 public Integer addEmployee AndDepartment(EmployeeBean employeeBean, DepartmentBean departmentBean) throws Exception {
6 int result = 0; @Transaction(value = "txManager", propogation = Propogation.REQUIRES_NEW)
7 int deptId = employeeDepartmentDAO.addDepartment(departmentBean);
8 employeeBean.setDepartmentCode(deptId);
9 result = deptId + employeeDepartmentDAO.addEmployee(employeeBean);
10 return result;
11 }
Which of the following statements is/are CORRECT with respect to JSP?
(i) Default scope of a variable is page
(ii) Session scope variable will be available in all JSP files if it is accessed in a single session both (i) and (ii)
(iii) JSTL codes are placed inside service() method of translated servlet
Choose the most appropriate option.
1) When you make any change in the servlet class and same
When Servlet destroy() method will be invoked by Servlet Container? [Choose 2]
2) When you stop the server, destroy method of all existing servlet objects all be invoked
1 Refer the incomplete code given below

Answer : A) @Value(“#{cartObj}”)
2 Consider the code given below:

Package com.accenture.lkm;

Public class Employee{

Answer :
3 Refer the incomplete code given below

Package com.accenture.lkm;

Public class Job{

Answer : A) Line 1= @value("#jobObjects")


line 2= @configuration
line 3= @bean ………………………etc

4 Which of the following are Stereotype annotations? [Choose 2]

Answer :- A and B (component and service)


5 Assume that class “Employee” is created with property “empid” and its setter
method. Refer the spring configuration given below

Answer : A) 1

6 Refer below incomplete code

Answer : A) @Transaction(value="txManager",propogation.REQUIRED_NEW)
7 From the following identify which is NOT a session management technique?

Answer:- A) Request…………

8 Consider the following code


Login.html:

Answer :- B) Page2 welcomes null(check once).


9 Which lifecycle method of JSP is invoked by the container to perform the………
…………………………….each time when trhe request is received?

Answer :- B) _jsp service

10 Farhan wants to write a code to add 2 numbers and return the result……….
……………………………………….. JSP scripting element.

Answer :- B
11 Miss Ashrey has beed asked to add headers and footers while designing login
and home page………………………………………..Header.jsp and footer.jsp

Answer :- A

12 Which of the following is/are CORECT statement(S) with respect to spring Test?

Answer :- A) Both (i) and (ii).


13 Refer the JSP code below and predict the output.

Answer :- B) Book id :2 Publish year :2001

14 Refer the Spring configuration code given below.

Answer :- B
15 Refer the code given below.
@Entity
Public class EmployeeEntity{

Answer:- A
16 Refer the incomplete code given below:
<beans>
<!..

Answer :- C) @Repository, @PersistenceContext,


@Transactionl(value=”txtManager”).
17 Which of the following statements(s) is/are CORRECT with respect to JSP?

i. Request Scope variable………………………………………


ii. RequestDispatcher…………………………………………..

Answer :- B) Both (i) and (ii).

18 Choose from below the INCORRECT statement about JSR-330 ………

Answer:- C) JSR 330……………………………………………………………………………..


19 Refer the code given below.

Answer : A & B (A) Use @Autowired at LineX and (B) Use @Autowired at LineY

20 Refer the below incomplete code for a test class.

Answer : (A)
21 Refer the incomplete code

Answer :- C) @Transactional(value=”txManager”,propagation=propagation REQUIRES_NEW)


22 When Servlet destroy() method will be invoked by Servlet Contsiner?[choose 2]

Answer :- A) When you make any change in the servlet class and save

C) When you stop the server, destroy method of all existing servlet objects………

23 Which is an abstract class which provides the basic implementation of Servlet interface except

Service() method ?

Answer :- C) GenericServlet
24 Refer the Below Entity class.

Answer : (A)
25 Which method is used to retrive the recent access time of a request by user from session?

Chosse from below a valid option.

Answer : D) getLastAccessedTime()
1 Refer the code given below:

Class Library{

Answer: B) <bean id=”library” class=”com.accenture.lkm.library”>

<constructor-arg>

<bean class=”com.accenture.lkm.Book”>

<constructor-arg value=”book1”></constructor=ard>

</bean>

</constructor-arg>

</bean>
2 Refer the incomplete code given below:

Package com.accenture.lkm;

Class House{

Answer :- A) @Autowired, @Qualifier(“room1”).com


3 Select correct options to refer a Spring configuration file inside a package? Choose 2

Answer :- A and D
4 Refer the Spring configuration code given below.

Identify the correct code to create spring container object and get the address object

Injected. Choose the ,ost appropriate option.

Answer :- A
5 Choose from below the valid option which provides the complete support for creation of JPA
specific EntityManagerFactory and Transaction Management.

Answer : B) LocalContainerEntityManageFactoryBean

6 Which of the following is/are Correct with respect to spring transaction methods?

Answer : b) only (i)


7 Refer the code given below.

Choose the valid implementation of the delete query to delete customers who has credit less

Than a particular value.

Answer : A
8 Which of the following statement(s) is/are CORRECT with respect to JSP?

Answer : - C) Only (iii)

9 From the following identify TWO INCORRECT statements about ServletConfig object.

Answer : A) I and ii only


10 Which object is created by web container for each Servlet during servlet initialization?

Answer :- b) ServletConfig
11 Mr.John has been assigned the task of creaing servlet filter to log IP address of the computers

……………………………………………………………………….for servlet filters in web.xml file.

Answer : A
12 Blessie is a web developer wants to create a wep page…………………whenever user hits on
welcome button on index.html given below

Answer :- B) response.sendRedirect(“https://portal.accenture.com”);
1 Sadana wants to share the common database date throughout the application. Help her to identify
the appropriate code to achieve thi task.

Answer : C) <%

String username=(String)application.getAttribute(“dbname”);

%>
2 Refer the following code:

Answer : (A)
3) Refer the following JSP Pages.

Header.jsp:
4) Refer the incomplete code given below.

Package com.model;

Public class Author{

Answer : C) @ContextConfiguration(locations=”/com/resources/my_springbeam_xml”),@test
5) Which of the following is/are CORECT statement(S) with respect to spring Test?

Answer :- B) Only (i)


1. Refer the code given below.

Answer :- B) system.setProperty("spring.profiles.active","myprofile");
2 Consider the code given below

Package com.accenture.lkm;

@component(“address”)

Public class Address{

Answer :- B)Employee Address : Bangalore-Maharashtra


3 John has created a properties file like below

Answer :- A

4. Which of the following is correct with respect to spring?

Answer : - Only 2
5 Which of the following statement(S) is/are correct.

Answer :- Only (ii) is correct.

6 Which of the following is CORRECT with respect to spring transaction pro… types ?

Answer :- A) Both (i) and (ii).


7 Which of the following statements(s) is/are CORRECT with respect to JSP?

Answer : (ii and iii ) 2 and 3 is correct.

8 Choose from below the CORRECT statement about Autowriting.

Answer :- C) Autowriting requires setters or Constructor in bean class.


9 From the following identify the correct hierarchy of servlets assuming you are
request………………………………………………………………..registration request.

Answer :- A

10 Which is an abstract class which provides the basic implementation of servlet interface except
service() method?

Answer :- C) GenericServlet
11 Mr.john has been assigned the task of creating a servlet After to log IP…………………………………………

The correct order of tags meant for servlet filters in web.xml file.

Answer :- A) <web-app>

12 Consider a web application is created with a welcome file index.html mapped with a servlet class

To process the response.

Refer the code below:

Answer :- B
13 When you want to remove the user data from sessions, what all the various options available in
JSP? [Choose 3].

Answer : A) To delete the session attribute we can call public void removeAttribute(String Name)

B) By invoking public void invalidate()

C) In web.xml file use <session-timeout>15</session-timeout>


14 From the following tables match the JSP implicit objects given in table A with API’s in servlets
package given in table B.

Answer :- A) 1.ii 2.i 3.iv 4.iii


16 Refer the code Given Below:

@Entity

Class BookEntity

Answer :- A) findByPublisherType(String p Type)

You might also like