0% found this document useful (0 votes)
147 views5 pages

Cognizant Recent Interview Questions and Answers

Uploaded by

akmajith1998
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views5 pages

Cognizant Recent Interview Questions and Answers

Uploaded by

akmajith1998
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

AJITH KUMAR M

[email protected]

Cognizant Recent Interview Questions and Answers:

Round 1

Tell me something about yourself?

Explain Automation Testing Framework?

An automation testing framework is a structured set of guidelines to create and execute test
scripts efficiently. Common frameworks include:

Data-Driven Framework: Tests are driven by external data sources like Excel or CSV files.

Keyword-Driven Framework: Uses predefined keywords to perform specific actions.

Hybrid Framework: Combines data-driven and keyword-driven approaches.

Page Object Model (POM): Helps create maintainable and reusable code by separating test
scripts from the locators.

Explain agile processes and day-to-day activities?

Agile is an iterative development methodology emphasizing collaboration, adaptability, and


incremental delivery. My day-to-day activities include:

Participating in daily stand-ups to discuss progress, roadblocks, and plans.

Collaborating with developers, business analysts, and stakeholders during sprint planning
and review.

Writing and executing test cases, raising defects, and revalidating fixes.

Automating regression test cases and maintaining test scripts in repositories.

How did you push and pull your code to remote?

Push: After committing changes locally, I use git push origin <branch> to upload changes to
the remote repository.

Pull: To sync the latest updates, I use git pull origin <branch> to fetch and merge remote
changes.

Can we use another framework instead of just POM?

Yes, frameworks like BDD (Behavior-Driven Development) with tools like Cucumber can be
used, which allow writing tests in plain English. This approach enhances collaboration with
non-technical stakeholders.
Difference between implicit wait and explicit wait?

Implicit Wait: Sets a global wait time for all elements (e.g.,
driver.manage().timeouts().implicitlyWait(time, unit);).

Explicit Wait: Waits for a specific condition to occur before proceeding (e.g.,
WebDriverWait).

Automation script runs sometimes and gets stuck. How to solve it?

It could be due to dynamic elements or synchronization issues.

Use explicit waits for dynamic elements or debug the script using logs.

Refactor flaky scripts and validate locators.

Absolute XPath vs Relative XPath? Which is preferred and why?

Absolute XPath: Specifies the full path (e.g., /html/body/...).

Relative XPath: Starts from any node (e.g., //div[@id='example']).

Preferred: Relative XPath is preferred for flexibility and maintainability.

Accessing the 2nd login button with same properties in XPath?

Use indexing: (//button[@class='login'])[2].

Difference between method overload and method overriding?

Overloading: Same method name, different parameters, within the same class.

Overriding: Subclass provides a specific implementation of a method in the parent class.


Same method name, same parameters, within different class

When to use implicit and explicit wait?

Use implicit wait for general synchronization across elements.

Use explicit wait for specific, dynamic conditions like waiting for elements to be clickable.

How do you cover end-to-end API testing?

Validate request and response formats.

Perform CRUD operations, verify response codes, and handle edge cases.

Check authentication, authorization, and error handling.

Conduct performance testing using tools like JMeter.

Exceptions faced in API testing?


Authentication issues (401 Unauthorized).

Timeout errors (504 Gateway Timeout).

Invalid input responses (400 Bad Request).

Modifying JSON data and authentication in API request?

Use tools like Postman to edit JSON payloads.

Add authentication tokens in headers (e.g., Bearer Token).

Status codes:

500: Server error.

201: Resource created.

403: Forbidden access.

Round 2

Explain your project.

Provide a concise explanation of your most recent project, focusing on its objectives, your
role, tools used, and contributions.

Program to reverse each word in a string:

String sentence = "Hello World";

String[] words = sentence.split(" ");

for (String word : words) {

System.out.print(new StringBuilder(word).reverse().toString() + " ");

Program to find duplicate words in a string:

Map<String, Integer> wordCount = new HashMap<>();

String[] words = "This is a test test".toLowerCase().split(" ");

for (String word : words) {

wordCount.put(word, wordCount.getOrDefault(word, 0) + 1);

wordCount.forEach((k, v) -> { if (v > 1) System.out.println(k); });

Program to retrieve Excel data:


Use Apache POI for handling Excel files.

Sort 2nd column in a web table and get 4th row value:

Locate the table rows using XPath and write logic to sort based on the 2nd column.

Steps to connect to DB and retrieve data:

Load the driver: Class.forName("com.mysql.jdbc.Driver");.

Establish connection: Connection con = DriverManager.getConnection(url, username,


password);.

Execute query: Statement stmt = con.createStatement();.

Process ResultSet.

Explain OOP concepts:

Encapsulation, Inheritance, Polymorphism, Abstraction.

Encapsulation

Bundling data and methods that operate on the data into a single unit (class).

Ensures data security by restricting access through access modifiers (private, public,
protected).

Inheritance

Enables a class (child) to inherit properties and behavior from another class (parent).

Promotes code reuse and hierarchical relationships.

Polymorphism

Allows a single interface or method to represent different forms or behaviors.

Achieved via method overloading (compile-time) and method overriding (runtime).

Abstraction

Hides implementation details and exposes only essential features to the user.

Implemented using abstract classes or interfaces.

Maven and its usage?

Maven manages dependencies, builds projects, and generates reports. We define


dependencies in pom.xml.

Page Object Model?


POM separates page elements into reusable classes, improving maintainability.

Screenshot of a failed test case?

File src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);

FileUtils.copyFile(src, new File("path/failedTest.png"));

Round 3

3 best things about your previous organization?

Strong learning environment.

Excellent mentorship and guidance.

Exposure to cutting-edge technologies.

Why are you looking for a change?

I am looking for a role that offers more challenging opportunities to expand my technical
skills and contribute to impactful projects.

What did you like most in your previous job?

The collaborative team culture and opportunities to work on mission-critical applications.

Where do you see yourself in 5 years?

A test automation engineer, mentoring a team, contributing to quality delivery, and driving
innovative solutions.

You might also like