Interface vs abstract class
An interface defines a contract: what an implementing class must provide. An abstract class can define both incomplete behaviour (abstract methods) and shared implementation/state (concrete methods and fields). A.
Prepare for Altimetrik interviews with 65 curated questions. The answer examples below explain key concepts; personalize project and experience responses truthfully. These are independent study resources, not official company interview materials.
These study answers summarize the associated PDF material. Adapt personal, project and experience details to your own background.
An interface defines a contract: what an implementing class must provide. An abstract class can define both incomplete behaviour (abstract methods) and shared implementation/state (concrete methods and fields). A.
String is immutable: an operation that appears to modify it creates another String. StringBuffer is mutable and synchronizes its methods, making it thread-safe for shared use but often slower than StringBuilder. Use String for ordinary text; use StringBuffer when a mutable buffer must be shared safely across threads; use StringBuilder for most single-threaded string construction.
An empty string ("") contains zero characters and has length 0. A string containing one space (" ") has length 1. Both are non-null strings. This distinction matters in validation: trim().isEmpty() detects empty or whitespace-only text, while isEmpty() alone detects only zero-length text.
JVM (Java Virtual Machine) executes Java bytecode and provides runtime services such as memory management and garbage collection. JRE (Java Runtime Environment) traditionally means the JVM plus the libraries and files needed to run Java applications. JDK (Java Development Kit) includes development tools such as javac plus runtime components. Modern Java distributions may not package a separate JRE, but the conceptual distinction remains useful. javac Hello.java // compiler: .java source -> .class bytecode java Hello // launcher runs the compiled class on a JVM.
HashSet is a Set implementation that stores unique elements and has no guaranteed iteration order; it permits one null element. Hashtable is a legacy Map implementation that stores key-value pairs, is synchronized, and does not permit null keys or values. They solve different problems: use HashSet for uniqueness and HashMap/ConcurrentHashMap for key-value lookup in modern code, depending on thread-safety needs. Set<String> names = new HashSet<>(); names.add("Ana"); names.add("Ana");.
An array has a fixed length once created and can store primitives or references. ArrayList is a resizable collection of objects, offers methods such as add/remove/contains, and uses generics for type safety. Arrays can be more direct and compact for fixed-size data; ArrayList is usually more convenient when the number of elements changes.
A Set models a collection of unique elements, so adding an element already present does not create a duplicate. HashSet is generally used for fast membership checks without order; LinkedHashSet preserves insertion order; TreeSet keeps elements sorted. Equality and hashCode must be implemented consistently for custom objects used in hash-based sets. Set<String> browsers = new LinkedHashSet<>(); browsers.add("Chrome"); browsers.add("Firefox"); browsers.add("Chrome");.
Overloading means same method name with different parameter lists, usually in the same class; it is resolved at compile time. Overriding means a subclass provides a compatible implementation of an inherited instance method; the chosen implementation is determined at runtime. Return type alone cannot distinguish overloaded methods. Static methods are hidden rather than overridden.
Polymorphism means one reference type can represent objects of different concrete classes. Runtime polymorphism commonly uses method overriding: the method implementation is chosen according to the actual object. This supports extensible code and reduces dependency on concrete implementations.
An assertion checks an expected condition and normally fails the test immediately if it is false. In Selenium with TestNG, Assert is the usual hard assertion; SoftAssert records failures and reports them when assertAll() is called. 'Verify' is often an informal term for checking an expected result rather than a separate Selenium API. waitFor usually means waiting until a condition becomes true before interacting; in Selenium use WebDriverWait/ExpectedConditions rather than fixed sleeps when possible.
super refers to the immediate parent class. It can call a parent constructor (super(...)), access an accessible parent field/method, or invoke a parent implementation that has been overridden. A constructor call to super(...) must be the first statement in a constructor.
Locate links with By.linkText/partialLinkText when the visible text is stable, or use CSS/XPath. For an anchor, getText() reads visible text, getAttribute("href") reads its destination, and click() activates it. Prefer stable IDs or test attributes when available; avoid broad selectors that match several elements. Check count/visibility before acting if the page contains repeated links.
In a Java program, System.out.println() prints to the console. In a Cucumber feature file, the keyword is 'Then/When/And', not echo; 'echo' is commonly a shell command or a command in other test tools. For framework diagnostics, prefer a logger (for example SLF4J/Log4j) because it supports levels, timestamps, and file output.
Yes. A Java String object's character sequence cannot be changed after creation. Methods such as replace(), concat(), and toUpperCase() return a new String when a change is needed. Immutability helps safe sharing, caching, and use as map keys, but repeated concatenation in a loop can create many temporary objects; use StringBuilder for that pattern.
Typical STLC phases are: requirement analysis, test planning, test case design/development, test environment setup, test execution, defect reporting/retesting/regression, and test closure. Each phase has entry criteria, activities, deliverables, and exit criteria. In Agile, these activities happen iteratively within a sprint rather than only once at the end. Example: for a login feature, analyse lockout/password rules; estimate and plan; write positive/negative test cases; prepare test data/environment; execute; log defects and retest fixes; then report coverage and lessons learned.
First reproduce it and confirm scope, severity, business impact, and whether it blocks a critical user journey. Immediately communicate facts to the QA lead, developer, product owner, and release manager; do not hide or downgrade the issue to protect the date. Capture evidence, logs, environment, and steps. Work with developers on root cause and fix; validate the fix and run targeted regression.
Common ways include a string literal, using new String(...), and creating a String from a character array or another data source. Literals are usually preferred because the JVM can reuse interned literal instances. new String("Java") explicitly creates a distinct String object and is rarely needed.
javac is the Java compiler: it converts source files (.java) into bytecode (.class). java launches a class or JAR and runs its bytecode on a JVM. The JDK must be installed and its bin directory available on PATH, or commands must be run with full paths. javac Hello.java java Hello.
Answer honestly and tie the data structure to a practical task. In a Selenium framework, List<WebElement> is used to collect table rows or matching elements; Map<String,String> can hold test data or expected values; Set<String> is useful for unique window handles or duplicate detection; Queue can model ordered work in suitable utilities. Explain why the structure was selected and how it improved clarity or performance. Set<String> windowHandles = driver.getWindowHandles();.
Give a defensible rating, not an inflated one. Separate strengths from areas being developed and support the rating with examples. For instance: “I would rate my Java 7.5/10 and Selenium WebDriver 8/10. I am comfortable with OOP, collections, exception handling, waits, locators, POM, and debugging automation failures.
Use a 60–90 second structure: experience and current role; core technical skills; project/framework responsibilities; leadership and quality impact; role you are seeking. Keep it relevant and avoid personal details unless asked. Adapt this sample to your real experience: “I have around 13 years of experience in software testing across manual and automation testing. My technical experience includes Java, Selenium WebDriver, Cucumber, TestNG, API automation, and Playwright, along with Agile delivery.
Based on the stated framework context, a suitable explanation is a Cucumber + Page Object Model (POM) hybrid framework. Cucumber feature files express scenarios in business-readable Gherkin; step definitions map steps to Java methods; page classes encapsulate locators and UI actions; hooks handle setup/teardown; a driver manager/config layer creates browser sessions; test data and configuration are externalised; TestNG/JUnit and Maven execute tests; reports capture results; CI can run the suite. Explain only components actually used in your project. Feature: Login Scenario: Valid user logs in Given the user opens the login page When the user enters valid credentials Then the home page is.
Choose a realistic rating and connect it to evidence. Example: “I rate myself 8/10 in Selenium. I can design locators, handle waits, alerts, frames, windows, tables, dropdowns, actions, screenshots, and build POM-based tests. I am strengthening my expertise in advanced grid/cloud execution, accessibility, and flaky-test diagnostics.” Do not claim a skill you cannot demonstrate in a coding round.
An interface defines method contracts that implementing classes fulfil. Selenium's WebDriver is an interface. Browser-specific drivers such as ChromeDriver and FirefoxDriver implement WebDriver, so test code can use the common API and switch browsers with less change.
An abstract method is declared without a method body and must be implemented by a concrete subclass, unless that subclass remains abstract. You cannot place executable method-body code inside an abstract method. An abstract class can also contain normal methods with implementations. Interfaces can contain abstract methods and, in modern Java, default/static methods with bodies. abstract class BrowserPage { abstract void verifyPageLoaded(); // no body void logPageName() { System.out.println("Page"); }.
First wait for the table or target row to appear. Locate rows and cells relative to the table, then iterate through them and match a unique key (such as order ID) instead of relying on a fixed row index. Dynamic tables may paginate, virtualise rows, or load asynchronously; handle pagination and wait for the target data. Use getText() for visible cell text.
Use Selenium's Actions class for context-click (right-click) and doubleClick. Ensure the target is visible and interactable first. A right-click may open a browser context menu that Selenium cannot inspect like normal DOM content; if the application has a custom context menu, locate its DOM element after the action.
Selenium's standard locator strategies are id, name, className, tagName, linkText, partialLinkText, cssSelector, and xpath. Prefer stable unique IDs or test attributes; CSS is often concise; XPath is useful for text matching and navigating relationships. Avoid brittle absolute XPath and indexes unless justified.
WebDriver is an interface in Selenium. ChromeDriver, FirefoxDriver, EdgeDriver, and other browser drivers implement it. This allows test code to depend on the interface rather than one browser-specific implementation.
List is ordered and permits duplicates; it supports index-based access. Set represents unique elements and does not provide index-based access. HashSet does not guarantee iteration order, LinkedHashSet preserves insertion order, and TreeSet sorts elements. Choose based on whether ordering, duplicates, or fast membership checks matter.
Use a version suited to the role. For a hands-on automation role, emphasise coding and framework design; for a QA Lead role, emphasise planning, risk, people coordination, and release decisions. Keep the answer consistent with your resume and avoid memorised claims that you cannot support with examples. “I combine hands-on automation experience with QA coordination. I have worked with Java and Selenium, Cucumber, TestNG, API testing, and modern browser automation.
Use the same project-specific answer as Question 22, then describe one real scenario end to end: feature file → step definition → page object → driver/wait utility → assertion → report. Explain how test data, configuration, parallel execution, and CI are managed only if your project genuinely includes them. Example flow: Feature scenario -> StepDefinition.login() -> LoginPage.enterUsername() -> LoginPage.enterPassword() -> LoginPage.clickSubmit() -> HomePage.isDisplayed() -> assertion -> report.
Give two separate ratings and explain the evidence for each. Example: “Java 7.5/10; Selenium 8/10.” For Java, mention OOP, collections, strings, exceptions, and coding. For Selenium, mention locators, waits, browser interactions, POM, debugging, and test stability. Ratings are subjective; consistency and demonstrated skill matter more than the number.
An interface specifies behaviour and cannot be instantiated directly, so new WebDriver() is invalid. You can declare an interface reference and assign it an instance of an implementing class. An anonymous class or lambda can implement certain interfaces, but it still creates an implementation object rather than an.
Overloading is having methods with the same name but different parameter lists. It can make helper APIs convenient, for example one click helper accepting a locator or a WebElement. Selenium itself has overloaded methods such as findElement(By) and various WebDriverWait/Actions APIs, but in project discussions, explain your own actual helper implementation if you used one.
The likely interview concept is interface implementation: a class uses implements to adopt an interface contract, rather than extends a class. However, implements is not inheritance of class state in the same sense as extending a class. Java also supports composition, where one class contains an instance of another and delegates work. Ask for clarification if the interviewer means a specific inheritance pattern.
In Selenium 4, install compatible Selenium and Chrome versions and let Selenium Manager resolve the driver in common setups. Create the driver, optionally configure browser options, navigate, and always quit in teardown. In frameworks, keep driver creation in a driver factory or hooks rather than duplicating it in every test.
Choose two or three genuine examples and explain symptom, root cause, action, and outcome. Common examples include flaky tests due to timing, unstable/dynamic locators, test-data dependencies, OTP/captcha restrictions, asynchronous UI overlays, parallel-test isolation, browser/version changes, and slow suites. Good responses show root-cause analysis rather than adding Thread.sleep everywhere. Use explicit waits, stable selectors, isolated test data, logging/screenshots, retries only for known transient infrastructure issues, and collaboration with developers.
The Java Collections Framework includes List (ArrayList, LinkedList, Vector), Set (HashSet, LinkedHashSet, TreeSet), Queue/Deque (PriorityQueue, ArrayDeque, LinkedList), and Map (HashMap, LinkedHashMap, TreeMap, Hashtable, ConcurrentHashMap). Map is part of the Collections Framework but does not extend the Collection interface. Choose implementations based on ordering, duplicates, lookup needs, sorting, and concurrency. Examples: List for ordered test steps; Set for unique window handles; Map for named test data; Queue for first-in-first-out processing.
Create a LoginPage class that owns locators and actions, a HomePage class that verifies the destination, and a test that orchestrates them. Use explicit waits and assertions. The example is intentionally compact; adapt locators to the actual application and add driver lifecycle handling in your framework.
Keep the answer positive and future-focused. Avoid criticising managers, colleagues, or the company. Mention growth, broader responsibility, deeper automation/quality engineering work, or alignment with long-term goals. Do not claim a reason that is not true.
State the current CTC accurately, clarify fixed versus variable components if asked, and give an expected range based on role, responsibilities, market, and benefits. Your previously mentioned current CTC was around ₹18.9 LPA; verify the latest figure and whether it includes variable pay before using it in an interview. Avoid inventing an expected figure without considering the offer and your target. Sample wording: “My current CTC is ₹ move, I am looking for a market-aligned package based on the role and responsibilities, and I am open to discussing the complete compensation structure.”.
Keep it brief and comfortable: family members and general support, if you wish. Interviewers should not need sensitive personal details. Then return the conversation to your professional suitability. Do not feel obliged to disclose private financial, medical, or other sensitive information.
Answer honestly. If you can work the shift, confirm that clearly and ask whether it is fixed or rotational and whether transport or occasional schedule changes apply. If you have a genuine constraint, state it professionally and propose a workable alternative; do not agree if you cannot sustain it. Sample if available: “I do not have a constraint with a 2 PM–10 PM shift.
Describe project context, what you automated, the stack, your contribution, and the result. Include examples such as regression/smoke suites, reusable POM components, data-driven scenarios, CI execution, reporting, and defect triage only if true. Quantify outcomes only when you have reliable measurements. Explain how you handle flaky tests and maintain scripts as the UI changes.
Use a LinkedHashSet to retain the first occurrence order while removing repeated characters. Decide how to treat spaces and case; the example preserves both and is case-sensitive. For Unicode code points beyond basic characters, iterate over code points rather than char values.
A palindrome reads the same forwards and backwards. Decide whether comparison should ignore case, spaces, and punctuation. The example normalises to lowercase and removes non-alphanumeric characters before comparison.
Extent Reports produces readable HTML reports with test status, steps, screenshots, exceptions, and execution details. It is useful for sharing failures with developers and stakeholders. It is a reporting library, not a substitute for proper assertions or logs. Exact setup differs by ExtentReports version; keep one report instance per run and flush it at the end.
TestNG listeners receive lifecycle callbacks, for example when a test starts, succeeds, fails, or is skipped. Implement ITestListener to centralise logging, screenshots on failure, and reporting. Register listeners with @Listeners or testng.xml. Avoid putting all test logic into listeners; keep them focused on cross-cutting reporting and diagnostics.
Both are mutable character sequences with similar APIs. StringBuffer synchronizes its methods and is thread-safe for individual operations; StringBuilder is not synchronized and is generally faster in single-threaded code. Neither makes a multi-step business operation automatically atomic. Prefer StringBuilder unless shared concurrent access requires synchronisation.
Selenium automates web browsers, not native desktop applications by itself. It does not provide built-in test reporting, test-data management, or a full test runner; teams combine it with TestNG/JUnit, reporting libraries, and build tools. CAPTCHA and OTP are intentionally difficult to automate reliably and should be handled through approved test environments or service-level test hooks. Selenium can be affected by dynamic UI, browser differences, and asynchronous timing, so stable locators, waits, and good test design are essential.
Actions is the preferred Selenium API for complex user interactions such as hover, drag-and-drop, right-click, double-click, and key combinations. JavaScriptExecutor runs JavaScript in the page; use it sparingly for diagnostics or a genuine application need, because bypassing normal user interactions can hide usability defects. Java Robot controls OS-level keyboard/mouse events and may be useful for native dialogs or OS interactions, but it is platform-sensitive and less reliable in headless/remote environments. Prefer DOM-based file upload via sendKeys on input new Actions(driver).moveToElement(menu).perform(); new Actions(driver).doubleClick(button).perform(); JavascriptExecutor js =.
Java does not allow a class to extend two classes because it can create ambiguity (the diamond problem). A.
A marker interface is an interface with no methods that marks a class as having a property or being eligible for special handling. Classic examples include Serializable and Cloneable. The marker can be checked by frameworks or the JVM/library. Modern Java also has annotations, which often provide metadata more flexibly, but marker interfaces remain relevant in some APIs.
following-sibling:: selects siblings after the current node with the same parent. following:: selects nodes later in document order, not only siblings. Use these axes when relationships are stable; prefer a locator tied to a label or container when possible.
this refers to the current object; it can distinguish instance fields from parameters and call another constructor in the same class using this(...). super refers to the immediate parent portion of the object; it can call a parent constructor or parent implementation. A constructor's this(...) or super(...) invocation must be first, and you cannot use both as separate constructor invocations in the same constructor.
Multithreading allows multiple threads to execute concurrently. It can improve throughput for independent work but introduces shared-state risks such as race conditions and visibility issues. Java supports Thread, Runnable, Callable, ExecutorService, and concurrency utilities. In Selenium, parallel tests need isolated WebDriver instances (often ThreadLocal in a carefully designed framework), isolated test data, and thread-safe reporting; never share one driver across parallel tests.
Use equals() for case-sensitive content comparison and equalsIgnoreCase() for case-insensitive comparison. == compares object references, not text content. compareTo() provides lexicographic ordering. For null-safe comparison, use Objects.equals(a, b). Normalise whitespace/case first only when the business requirement says those differences should be ignored.
Each browser tab/window has a handle. Store the parent handle before clicking a link that opens a new window, wait until the handle count increases, switch to the new handle, perform checks, and switch back when needed. Do not rely on handle order being meaningful; identify the target by title/URL where possible.
static belongs to the class rather than a particular object; static methods are called on the class and cannot directly access instance members without an object. final means a variable can be assigned once, a method cannot be overridden, or a class cannot be subclassed. A final reference cannot point to another object, but the referenced object's mutable state may still change. A static final field is commonly used for constants.
Conceptually, static fields belong to the class rather than each object and have one class-level value per loaded class. In modern JVM implementations, class metadata is managed in Metaspace, while static field values are associated with the class runtime data; exact implementation details vary by JVM version. Do not say static variables are stored on each object's heap instance: instance fields belong to individual objects. Static fields remain available while the defining class is loaded, subject to class-loader lifecycle.
Insert the asterisk at the required position. If the requirement is always after the third character, validate that the input is long enough and use substring.
A frame/iframe contains a separate browsing context. Selenium must switch into it before locating its elements, and switch back to defaultContent() afterward. You can switch by index, name/id, or WebElement; the WebElement approach is often clearest when there are multiple frames. Wait for frame availability rather than using a fixed sleep.
Selenium WebDriver supports browser-specific driver classes, commonly ChromeDriver, FirefoxDriver, EdgeDriver, SafariDriver, and InternetExplorerDriver in legacy environments (Internet Explorer is retired and support is deprecated/limited). RemoteWebDriver connects to a remote browser/Grid or cloud provider. Selenium Manager can help discover/download compatible drivers in supported Selenium versions. Availability depends on the operating system, browser version, and Selenium version.