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

Publicis Sapient 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)
474 views5 pages

Publicis Sapient 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]

Publicis Sapient Recent Interview Questions and Answers:

1.What is Polymorphism?

Polymorphism in Java allows objects to take multiple forms. It is achieved through


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

Example:

class Animal {

void sound() { System.out.println("Animal makes a sound"); }

class Dog extends Animal {

void sound() { System.out.println("Dog barks"); }

public class Main {

public static void main(String[] args) {

Animal a = new Dog();

a.sound(); // Output: Dog barks

}
}
2.What is Exception Handling?

Exception handling manages runtime errors to maintain normal program flow.

Key keywords:

try: Encapsulates code that may throw an exception.

catch: Handles the exception.

finally: Executes code regardless of exception occurrence.

throw: Used to explicitly throw an exception.

throws: Declares exceptions that a method can throw.


3.Difference Between throw and throws?

throw: Used to explicitly throw an exception in the code.

Example: throw new ArithmeticException("Error occurred");

throws: Used in the method signature to declare exceptions the method might throw.

Example: void method() throws IOException { /* code */ }


4.What is File In and File Out?

FileInputStream/FileOutputStream are classes used for reading/writing binary data.


Example:

FileInputStream in = new FileInputStream("input.txt");

FileOutputStream out = new FileOutputStream("output.txt");

int data;

while ((data = in.read()) != -1) {

out.write(data);

in.close();

out.close();
5.Explain Abstract Class and Interface with Example?

Abstract Class: Can have abstract and concrete methods. Used for partial
abstraction.

Interface: All methods are abstract by default. Supports full abstraction.

Example:

abstract class Shape {

abstract void draw();

void display() { System.out.println("Shape"); }

interface Color {

void fill();
}
class Circle extends Shape implements Color {

void draw() { System.out.println("Drawing Circle"); }

public void fill() { System.out.println("Filling Circle"); }

}
6.Write a Program for Factorial Using Recursion?

public class Factorial {

static int factorial(int n) {

if (n == 0) return 1;
return n * factorial(n - 1);

public static void main(String[] args) {

System.out.println(factorial(5)); // Output: 120

}
Automation Questions:

1.Explain Selenium Architecture?

Selenium comprises:

Selenium WebDriver: Communicates with the browser using JSON Wire Protocol.

Browsers: Executes commands sent via the WebDriver.

Test Scripts: Written in languages like Java, Python, etc.


2.Explain Selenium Grid and Setup?

Selenium Grid allows parallel execution of tests across multiple machines and
browsers.

Setup:

Install Selenium Server.

Start the Hub: java -jar selenium-server.jar -role hub.

Start Nodes: java -jar selenium-server.jar -role node.


3.Explain Automation Framework and Components?

A framework provides reusable methods, test scripts, and utilities.


Components:

TestNG/JUnit for test execution.

Data-driven approach with Excel/JSON.

Page Object Model for modularity.

Log4j for logging.

Jenkins for CI/CD.


4.Write an XPath for MakeMyTrip Web Elements?

Example XPath:
//input[@id='fromCity']

//div[@class='makeFlex column'].
5.Execute Multiple Test Cases at a Time?

Use TestNG:

Group test cases in a suite XML file.

Run the suite: testng.xml.


6.Difference Between Data Provider and Parameters?

Data Provider: Supplies multiple sets of data for a test method.

Parameters: Provides single configuration data from the test suite XML.
7.Difference Between @BeforeTest and @BeforeClass?

@BeforeTest: Runs before all tests in a <test> tag.

@BeforeClass: Runs once before methods in the current class.


8.Explain BDD and Its Advantages?

BDD (Behavior-Driven Development) uses Gherkin syntax to write test cases in a


human-readable format.

Advantages: Improves collaboration and ensures clear requirements.


9.BDD Cucumber Architecture?

Feature Files: Contains scenarios in Gherkin format.

Step Definitions: Maps Gherkin steps to Java methods.

Runner Class: Executes the tests.


QA Questions:
1.Difference Between Test Plan and Test Strategy?

Test Plan: Document specifying scope, resources, schedule, and test objectives.

Test Strategy: High-level document outlining the testing approach.


2.How to Provide Estimates?

Use the following steps:

Break down tasks.

Consider complexity and risks.

Use historical data.


Add buffer time.
3.Explain Agile and Its Ceremonies?

Agile is an iterative software development approach.

Ceremonies:

Sprint Planning: Define the sprint goal.

Daily Stand-up: Discuss progress and blockers.

Sprint Review: Showcase completed work.

Sprint Retrospective: Analyze and improve the process.

You might also like