wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Wipro Salesforce Assesment

Total questions: 100

Worksheet time: 2hrs 40mins

Name
Class
Date
1.

What will be the output of this Apex code? Integer sum = 0; List nums = new List{2, 4, 6}; for(Integer i : nums){ if(i % 2 == 0){ sum += i; } } System.debug(sum);

a)

12

b)

6

c)

0

d)

10

2.

What is the result of the following Apex code? Map myMap = new Map(); myMap.put('A', 10); myMap.put('B', 20); myMap.put('A', 30); System.debug(myMap.get('A'));

a)

10

b)

20

c)

30

d)

Null

3.

What does the following Apex code do? Set accIds = new Set(); for(Account acc : Trigger.new){ accIds.add(acc.Id); }

a)

Deletes the account records

b)

Creates duplicate account IDs

c)

Stores unique Account Ids

d)

Throws compile-time error

4.

What will be the result of this Apex code? List accList = [SELECT Id FROM Account LIMIT 2]; delete accList; System.debug('Deleted');

a)

Deletes only one record

b)

Deletes two records

c)

Causes an error

d)

Updates records

5.

What is the correct bulkified version of this trigger logic? trigger AutoTask on Opportunity (after insert) { for(Opportunity opp : Trigger.new){ Task t = new Task(Subject='Follow Up', WhatId=opp.Id); insert t; } }

a)

Move loop inside insert

b)

Create one task per opportunity

c)

Use a List to collect and insert tasks outside the loop

d)

Use SOQL inside loop

6.

What does this code snippet do? List accounts = new List(); for(Integer i = 0; i < 3; i++){ accounts.add(new Account(Name='Test' + i)); } insert accounts;

a)

Inserts 3 accounts with same name

b)

Inserts 3 accounts with unique names

c)

Fails due to duplicate

d)

Fails due to null values

7.

What exception is thrown when a DML statement fails partially? try { insert new List{ new Account(Name='Test1'), new Account() // Missing required field }; } catch(Exception e){ System.debug(e.getMessage()); }

a)

NullPointerException

b)

QueryException

c)

DmlException

d)

ListException

8.

Which method correctly avoids hardcoding record types? Id recTypeId = [SELECT Id FROM RecordType WHERE SObjectType='Account' AND Name='Customer' LIMIT 1].Id;

a)

Hardcoding the ID

b)

Querying RecordType object

c)

Using static string

d)

Using Metadata API

9.

What will be the result of this SOQL query in Apex? List accs = [SELECT Name FROM Account WHERE Name LIKE 'A%' LIMIT 10]; System.debug(accs.size()); Assume there are 3 records starting with 'A'.

a)

0

b)

3

c)

10

d)

Compile Error

10.

What does the following test class do? @isTest private class AccountTest { static testMethod void validateInsert(){ Account a = new Account(Name='Test Acc'); insert a; System.assertNotEquals(null, a.Id); } }

a)

Tests DML update

b)

Tests account deletion

c)

Validates insert operation

d)

Creates contact

11.

Which of the following controls record-level access in Salesforce?

a)

Profiles

b)

Permission Sets

c)

Role Hierarchy

d)

Object Settings

12.

Which feature is used to restrict field-level access in Salesforce?

a)

Record Types

b)

Profiles

c)

Roles

d)

Sharing Rules

13.

What is the highest level in the Salesforce sharing model that determines baseline access for all records?

a)

Permission Sets

b)

Role Hierarchy

c)

Organization-Wide Defaults (OWD)

d)

Profile

14.

Which of the following CANNOT be controlled by a Profile?

a)

Tab Visibility

b)

Record Sharing

c)

Field-Level Security

d)

Object Permissions

15.

If a user needs temporary access to additional objects without changing their profile, what should be used?

a)

Sharing Rules

b)

Permission Sets

c)

Role Hierarchy

d)

Manual Sharing

16.

Which security feature ensures sensitive data like passwords are not exposed during API calls?

a)

Object Permissions

b)

Encrypted Fields

c)

Role Hierarchy

d)

Sharing Settings

17.

Which of the following enforces security at the database level in Apex?

a)

With Sharing

b)

Without Sharing

c)

Inherited Sharing

d)

Enforced Sharing

18.

Which sharing model allows the most granular sharing by users manually?

a)

Role Hierarchy

b)

Permission Sets

c)

Manual Sharing

d)

OWD

19.

Which type of relationship in Salesforce allows a child record to exist without a parent record?

a)

Lookup Relationship

b)

Master-Detail Relationship

c)

Hierarchical Relationship

d)

Junction Object

20.

In a Master-Detail relationship, what happens when a parent record is deleted?

a)

Child records remain unchanged

b)

Child records get deleted

c)

Child records are archived

d)

Child records convert to lookups

21.

Which relationship allows many-to-many connections between two objects?

a)

Lookup

b)

Master-Detail

c)

Junction Object

d)

External Lookup

22.

How many Master-Detail relationships can a custom object have?

a)

1

b)

2

c)

3

d)

Unlimited

23.

Which relationship type can reference an external object?

a)

Master-Detail

b)

Lookup

c)

Hierarchical

d)

Junction Object

24.

Which type of relationship is only available on the User object?

a)

Master-Detail

b)

Hierarchical

c)

Lookup

d)

External Lookup

25.

In a Master-Detail relationship, who controls the security of child records?

a)

Child Profile

b)

Parent Record Owner

c)

Role Hierarchy

d)

Sharing Rules

26.

Which relationship field is NOT supported on external objects?

a)

Indirect Lookup

b)

External Lookup

c)

Master-Detail

d)

Lookup

27.

What is true about a Junction Object in Salesforce?

a)

It contains at least one Master-Detail relationship

b)

It contains two Master-Detail relationships

c)

It cannot have lookups

d)

It must be a standard object

28.

Which of the following is used to avoid hard coding record IDs in Apex?

a)

Static Variables

b)

Custom Labels

c)

Schema Methods

d)

Maps

29.

Which collection type in Apex does NOT allow duplicate values?

a)

List

b)

Map

c)

Set

d)

Array

30.

Which Apex annotation is required for asynchronous methods?

a)

@testSetup

b)

@future

c)

@AuraEnabled

d)

@isTest

31.

Which governor limit applies per SOQL query?

a)

Maximum 100 Queries per Transaction

b)

Maximum 50,000 Records Retrieved

c)

Maximum 150 Queries per Transaction

d)

Maximum 10 Queries per Transaction

32.

How do you declare a constant in Apex?

a)

final String s = "Test";

b)

const String s = "Test";

c)

static String s = "Test";

d)

constant String s = "Test";

33.

Which exception type must always be handled explicitly in Apex?

a)

Custom Exceptions

b)

Checked Exceptions

c)

DMLException

d)

NullPointerException

34.

What is the return type of the Database.insert() method when called with allOrNone = false?

a)

Boolean

b)

Savepoint

c)

List

d)

Void

35.

Which of the following statements is TRUE for SOQL in Apex?

a)

You can use more than 500 queries per transaction

b)

You can retrieve related records using relationship queries

c)

You cannot query standard objects

d)

Queries always return Lists of Maps

36.

How do you prevent recursive trigger execution in Apex?

a)

Use @future

b)

Use a Static Boolean Flag

c)

Use Database.Stateful

d)

Use Batch Apex

37.

Which of the following trigger events is NOT valid in Salesforce?

a)

before insert

b)

after undelete

c)

before update

d)

before undelete

38.

What is the maximum number of DML statements allowed in a single trigger execution context?

a)

100

b)

150

c)

200

d)

Unlimited

39.

Which method is used to access the old version of records inside a trigger?

a)

Trigger.new

b)

Trigger.old

c)

Trigger.newMap

d)

Trigger.oldList

40.

What type of trigger should be used to validate data before saving to the database?

a)

after insert

b)

before insert

c)

after update

d)

after delete

41.

Which collection provides access to a map of record IDs to records in a trigger?

a)

Trigger.old

b)

Trigger.oldMap

c)

Trigger.new

d)

Trigger.list

42.

What is a best practice to avoid hitting governor limits in triggers?

a)

Use nested loops

b)

Use SOQL queries inside loops

c)

Use Bulkification

d)

Use multiple triggers per object

43.

How many triggers can you write per object in Salesforce?

a)

1

b)

2

c)

Unlimited

d)

5

44.

Which statement is TRUE about after triggers?

a)

You can change field values before commit

b)

Records are already saved to the database

c)

They run before validation

d)

They don't allow relationship queries

45.

Which method is used to check if the current context is executing as part of a batch Apex job?

a)

System.isBatch()

b)

System.isFuture()

c)

System.isQueueable()

d)

System.isScheduled()

46.

Which decorator is used in LWC to expose a property to the parent component?

a)

@wire

b)

@track

c)

@api

d)

@AuraEnabled

47.

Which LWC file defines the component's UI?

a)

.js

b)

.xml

c)

.html

d)

.css

48.

Which method is used to call an Apex method imperatively in LWC?

a)

@wire

b)

import ApexMethod from '@salesforce/apex/...'

c)

getRecord()

d)

getFieldValue()

49.

Which file is mandatory for every LWC component?

a)

.css

b)

.xml

c)

.html

d)

.js

50.

Which directive in LWC is used for conditional rendering?

a)

for:each

b)

if:true

c)

for:item

d)

show:when

51.

What is the correct way to bind a CSS file to a Lightning Web Component?

a)

Inline CSS only

b)

Static resource import

c)

Use a .css file with the same name as component

d)

CSS is not supported

52.

Which LWC lifecycle hook is called after every render of the component?

a)

connectedCallback

b)

renderedCallback

c)

disconnectedCallback

d)

errorCallback

53.

Which directive is used in LWC for iterating over a list of records?

a)

for:each

b)

for:item

c)

loop:each

d)

foreach

54.

Which decorator should be used to make a property reactive in LWC?

a)

@wire

b)

@api

c)

@track

d)

@AuraEnabled

55.

Which protocol is primarily used by Salesforce for web service integration?

a)

FTP

b)

SOAP

c)

SMTP

d)

POP3

56.

Which Salesforce feature is best suited for real-time integration?

a)

Outbound Messages

b)

Platform Events

c)

Batch Apex

d)

Data Loader

57.

What authentication mechanism does Salesforce recommend for REST API calls?

a)

Username & Password

b)

OAuth 2.0

c)

API Key

d)

Session ID in URL

58.

Which Salesforce object stores details about connected apps and integrations?

a)

ConnectedApplication

b)

User

c)

AuthSession

d)

APIEvent

59.

Which REST resource allows querying Salesforce data using SOQL?

a)

/services/data/vXX.X/sobjects/

b)

/services/data/vXX.X/query

c)

/services/data/vXX.X/tooling/

d)

/services/apexrest/

60.

When calling a REST API in Salesforce, what format is used for request and response?

a)

CSV

b)

JSON

c)

XML

d)

Binary

61.

Which Salesforce integration feature is best for large-volume, asynchronous data processing?

a)

REST API

b)

SOAP API

c)

Bulk API

d)

Metadata API

62.

Which Salesforce feature allows external systems to subscribe to events published in Salesforce?

a)

Web-to-Lead

b)

Outbound Messaging

c)

Platform Events

d)

Connected App

63.

Which of the following methods is required in a Batch Apex class?

a)

start(), execute(), finish()

b)

init(), run(), end()

c)

begin(), process(), stop()

d)

executeBatch(), start(), finish()

64.

What is the default batch size in Batch Apex?

a)

100

b)

200

c)

500

d)

1000

65.

Which annotation is used in a test class method?

a)

@AuraEnabled

b)

@future

c)

@isTest

d)

@testSetup

66.

How many test classes can be executed simultaneously in Salesforce?

a)

100

b)

200

c)

75

d)

Unlimited

67.

Which method in a test class ensures test data is created before any tests run?

a)

@isTest

b)

@testSetup

c)

@future

d)

@mock

68.

Which of the following methods is required to schedule a batch Apex?

a)

execute()

b)

schedule()

c)

start()

d)

executeBatch()

69.

What is the maximum number of lookup relationships a custom object can have?

a)

Unlimited

b)

50

c)

40

d)

25

70.

Which method is used to send an email in Apex?

a)

Messaging.send()

b)

Mail.send()

c)

Email.send()

d)

Messaging.sendEmail()

71.

What is the purpose of the @isTest annotation in Apex?

a)

To enable debug logging

b)

To indicate a method is asynchronous

c)

To mark a method as a test method

d)

To define a test class

72.

What will happen when the button is clicked?

count = 0;

handleClick() {
    this.count++;
}

<lightning-button label="Add" onclick={handleClick}></lightning-button>
<p>{count}</p>

a)

A) Error occurs

b)

B) Count decreases

c)

C) Count increases by 1 on each click

d)

D) Nothing happens

73.

What will be the output of the following LWC code?

name = 'Salesforce';

get greeting() {
    return 'Hello ' + this.name;
}

<p>{greeting}</p>

a)

A) Hello

b)

B) Salesforce

c)

C) Hello Salesforce

d)

D) greeting

74.
  1. What will be the output of the following LWC code after clicking the button once?

import { LightningElement, track } from 'lwc';

export default class Demo extends LightningElement {
@track count = 5;

handleClick() {
this.count = this.count + 10;
}
}

<lightning-button label="Click" onclick={handleClick}></lightning-button>
<p>{count}</p>

a)

A) 5

b)

B) 10

c)

C) 15

d)

D) Error

75.
  1. What will be displayed in the browser?

import { LightningElement } from 'lwc';

export default class Student extends LightningElement {
students = ['Aman', 'Rahul', 'Priya'];
}

<template for:each={students} for:item="std">
<p key={std}>{std}</p>
</template>

a)

A) Aman Rahul Priya

b)

B) Only Aman

c)

C) Error because key is missing

d)

D) Nothing

76.
  1. What is the output of the following getter method?

firstName = 'Sales';
lastName = 'Force';

get fullName() {
return `${this.firstName} ${this.lastName}`;
}

<p>{fullName}</p>

a)

A) SalesForce

b)

B) Sales Force

c)

C) fullName

d)

D) Undefined

77.
  1. Which value will be shown after component loading?

import { LightningElement } from 'lwc';

export default class Test extends LightningElement {
message = 'Hello';

connectedCallback() {
this.message = 'Welcome';
}
}

<p>{message}</p>

a)

A) Hello

b)

B) Welcome

c)

C) Undefined

d)

D) Error

78.
  1. Which option correctly updates a reactive property?

import { LightningElement, track } from 'lwc';

export default class Demo extends LightningElement {
@track value = 1;

increase() {
_____
}
}

a)

A) value++

b)

B) this.value++

c)

C) track.value++

d)

D) @track.value++

79.
  1. What will be the output of the following wire service code?

import { LightningElement, wire } from 'lwc';
import getRecord from '@salesforce/apex/AccountController.getRecord';

export default class Demo extends LightningElement {
@wire(getRecord) account;
}

a)

A) account stores Apex response data

b)

B) Apex method will not execute

c)

C) Syntax error

d)

D) account becomes undefined always

80.
  1. What happens if an Apex method used with @wire is marked as non-cacheable?

a)

A) It works normally

b)

B) Component crashes

c)

C) Apex method must use @AuraEnabled(cacheable=true)

d)

D) LWC automatically fixes it

81.
  1. What will happen when the following trigger executes?

trigger AccountTrigger on Account(before insert) {
for(Account acc : Trigger.new){
acc.Name = acc.Name.toUpperCase();
}
}

a)

A) Trigger throws an error

b)

B) Account names are converted to uppercase before saving

c)

C) Account names remain unchanged

d)

D) Trigger works only for update

82.
  1. What is wrong with the following Apex code?

Account acc = [SELECT Id, Name FROM Account];
System.debug(acc.Name);

a)

A) SOQL syntax error

b)

B) Query may return multiple rows exception

c)

C) System.debug cannot be used

d)

D) Id field cannot be queried

83.
  1. What will be the output?

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

data.put(1, 'A');
data.put(2, 'B');
data.put(1, 'C');

System.debug(data.get(1));

a)

A) A

b)

B) B

c)

C) C

d)

D) Null

84.
  1. What is the issue in the following trigger?

trigger ContactTrigger on Contact(after insert) {

for(Contact con : Trigger.new){
Account acc = [SELECT Id, Name FROM Account WHERE Id = :con.AccountId];
acc.Name = 'Updated';
update acc;
}
}

a)

A) Invalid SOQL query

b)

B) DML operation not allowed in trigger

c)

C) SOQL and DML inside loop causing governor limit issue

d)

D) Trigger syntax is incorrect

85.
  1. What will happen after executing the trigger?

trigger OpportunityTrigger on Opportunity(before update) {

for(Opportunity opp : Trigger.new){
if(opp.Amount > 100000){
opp.addError('Amount cannot exceed 100000');
}
}
}

a)

A) Record updates successfully

b)

B) Trigger is skipped

c)

C) Record update fails with error message

d)

D) Amount becomes 100000 automatically

86.
  1. What issue exists in the following trigger?

trigger LeadTrigger on Lead(after insert) {

List<Task> taskList = new List<Task>();

for(Lead l : Trigger.new){

Task t = new Task(
Subject = 'Follow Up',
WhoId = l.Id
);

insert t;
}
}

a)

A) Task creation is invalid

b)

B) DML statement inside loop causing governor limit issue

c)

C) Trigger syntax error

d)

D) WhoId cannot store Lead Id

87.
  1. What is the output of the following code?

List<Integer> nums = new List<Integer>{2,4,6};

Integer result = 1;

for(Integer n : nums){
result *= n;
}

System.debug(result);

a)

A) 12

b)

B) 24

c)

C) 48

d)

D) 6

88.
  1. What is the major issue in this Apex code?

for(Account acc : [SELECT Id FROM Account]){

Contact con = new Contact(
LastName = 'Test',
AccountId = acc.Id
);

insert con;
}

a)

A) Contact creation is invalid

b)

B) SOQL query inside loop

c)

C) DML inside loop causing governor limit issue

d)

D) AccountId cannot be assigned

89.
  1. What is the output of the following trigger logic?

trigger OpportunityTrigger on Opportunity(before insert) {

for(Opportunity opp : Trigger.new){

if(opp.StageName == 'Closed Won'){
opp.Description = 'Opportunity Won';
}
}
}

If a record is inserted with StageName = 'Closed Won'

a)

A) Description remains blank

b)

B) Trigger fails

c)

C) Description becomes "Opportunity Won"

d)

D) StageName changes automatically

90.
  1. What will be the output of the following JavaScript code used in LWC?

let data = [1, 2, 3];

let result = data.map(num => num * 2);

console.log(result);

a)

A) [1,2,3]

b)

B) [2,4,6]

c)

C) [1,4,9]

d)

D) Error

91.
  1. What is the output of the following code?

let x = 5;

function test() {
let x = 10;
console.log(x);
}

test();
console.log(x);

a)

A) 5 5

b)

B) 10 10

c)

C) 10 5

d)

D) 5 10

92.

What will be the output of the following SOQL query?

SELECT Name FROM Account LIMIT 3

a)

A) Returns all Account records

b)

B) Returns first 3 Account names

c)

C) Returns only one Account

d)

D) Query throws error

93.
  1. hat is wrong with the following Apex code?

List<Account> accList = [SELECT Id, Name FROM Account WHERE Name = 'ABC'];

System.debug(accList.Name);

a)

A) SOQL syntax error

b)

B) List cannot directly access field values

c)

C) Account object is invalid

d)

D) WHERE clause is incorrect

94.
  1. What will happen when this query executes?

Account acc = [SELECT Id FROM Account];

a)

A) Always returns one record

b)

B) Returns all Account records

c)

C) May throw "List has more than 1 row for assignment" exception

d)

D) Syntax error

95.
  1. Which SOQL query correctly fetches Contacts related to an Account?

a)

A)

SELECT Name FROM Contact WHERE Account.Name = 'ABC'

b)

B)

SELECT Name FROM Contact WHERE AccountId != null

c)

C)

SELECT Name, Account.Name FROM Contact

d)

D) Both B and C

96.
  1. What will be the output of the following code?

List<Account> accs = [SELECT Id FROM Account LIMIT 5];

System.debug(accs.size());

a)

A) 0

b)

B) 1

c)

C) 5

d)

D) Depends on available records up to 5

97.
  1. Which query is used to fetch child Contacts from Account?

a)

A)

SELECT Name FROM Contact

b)

B)

SELECT Name, (SELECT LastName FROM Contacts) FROM Account

c)

C)

SELECT Contacts FROM Account

d)

D)

SELECT LastName FROM Contacts

98.
  1. What is the issue in the following code?

for(Account acc : [SELECT Id FROM Account]){

Contact con = [SELECT Id FROM Contact WHERE AccountId = :acc.Id];

System.debug(con.Id);
}

a)

A) Invalid binding variable

b)

B) SOQL inside loop causing governor limit issue

c)

C) Contact object is invalid

d)

D) Query cannot be used in loop

99.
  1. What will be the result of the following query?

SELECT Name FROM Account WHERE Name LIKE 'A%'

a)

A) Accounts ending with A

b)

B) Accounts containing A only in middle

c)

C) Accounts whose names start with A

d)

D) Query error

100.
  1. Which aggregate query correctly counts total Accounts?

a)

A)

SELECT COUNT(Name) FROM Account

b)

B)

SELECT COUNT() FROM Account

c)

C)

SELECT TOTAL() FROM Account

d)

D)

SELECT SUM(Account) FROM Account