NTT Data
10+ TCS Interview Questions and Answers
Q1. When does APEX CPU Limit Exceeded error happens. What's the best practice to avoid getting this error?
APEX CPU Limit Exceeded error happens when code consumes too much CPU time. Best practices include optimizing code, reducing loops, and using asynchronous processing.
Avoid using nested loops and optimize code for better performance
Use asynchronous processing like @future or Queueable to offload CPU intensive tasks
Limit the use of SOQL queries inside loops to reduce CPU consumption
Q2. Write a SOQL query to fetch the values of description field from the Account. Why does "the description field cannot be filtered in the query call"?
SOQL query to fetch description field from Account and reason for inability to filter
SOQL query: SELECT Description FROM Account
Description field is not filterable because it is a long text field
Long text fields cannot be filtered in SOQL queries
Q3. What's the use of @track decorator. Is it mandatory to explicitly use it? If yes, for which use case?
The @track decorator in Salesforce is used to track changes to a property in a Lightning web component.
Used to make a property reactive and trigger re-renders when its value changes
Not mandatory but recommended for properties that need to be reactive
Use @track when you want changes to a property to be reflected in the UI
Q4. Debug the following code: var a=10; function abc() { console.log(a); var a=2; } abc();
The code will output 'undefined' because variable 'a' is hoisted within the function.
Variable 'a' is hoisted to the top of the function scope, so when 'console.log(a)' is called, 'a' is undefined.
To fix this, move the declaration of 'var a=2;' above the 'console.log(a);' statement.
Q5. Can we call future method from batch class
Yes, future methods can be called from a batch class in Salesforce.
Future methods can be called from batch classes to perform asynchronous processing.
This can be useful for offloading long-running tasks to future methods to avoid hitting governor limits.
Example: Calling a future method from a batch class to update records in Salesforce asynchronously.
Q6. When does Mixed DML Exception occurs?
Mixed DML Exception occurs when DML operations are performed on setup and non-setup objects in a single transaction.
Occurs when DML operations are performed on both setup and non-setup objects in a single transaction
Setup objects include User, Profile, PermissionSet, etc.
Non-setup objects include custom objects, standard objects like Account, Contact, etc.
Q7. What is dynamic polymorphism
Dynamic polymorphism is the ability of a single function or method to operate on different types of data.
Allows a function to behave differently based on the object it is operating on
Achieved through method overriding in object-oriented programming languages
Enables code reusability and flexibility in software development
Q8. Lifecycle hook of lwc
Lifecycle hooks in LWC are methods that allow developers to interact with the component at specific stages of its lifecycle.
ConnectedCallback - called when a component is inserted into the DOM
RenderedCallback - called after a component's template has been rendered
DisconnectedCallback - called when a component is removed from the DOM
Q9. Uses of aura component
Aura components are used in Salesforce to build dynamic web applications with reusable components.
Create interactive user interfaces
Enhance user experience with dynamic content
Enable communication between components
Leverage event-driven architecture
Support client-side controller logic
Q10. Connected apps via salesforce
Connected apps in Salesforce allow external applications to integrate with Salesforce using APIs.
Connected apps are created in Salesforce to establish a secure connection with external applications.
They use OAuth protocol for authentication and authorization.
Connected apps define the permissions and access levels for external applications.
They can be used to integrate third-party applications, such as marketing automation tools or custom web applications.
Q11. What is visualforce
Visualforce is a framework that allows developers to build custom user interfaces for Salesforce applications.
Visualforce uses a tag-based markup language similar to HTML.
Developers can use Visualforce to create custom pages, components, and apps within Salesforce.
Visualforce pages can include standard Salesforce components like fields, buttons, and links.
Visualforce allows for dynamic content rendering based on user interactions or data.
Visualforce can be used to create resp...read more
Q12. Wire services in LWC Component
Wire services in LWC Component allow communication between components and Salesforce.
Wire services are used to fetch data from Salesforce without needing to write Apex code.
They enable reactive programming, automatically updating data when it changes in Salesforce.
Examples include @wire(getRecord) to retrieve a record, @wire(getObjectInfo) to get object metadata.
Wire adapters like @wire(getRecord) and @wire(getObjectInfo) are used to specify the data to be fetched.
Interview Process at TCS
Top Salesforce Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month