CoverPhoto
HCLTech logo
Premium Employer

HCLTech

Verified
3.5
based on 36.2k Reviews
Filter interviews by
Automation Engineer
Skills
Clear (1)

10+ HCLTech Automation Engineer Interview Questions and Answers

Updated 8 Oct 2024

Q1. what is the output of below code class Animal{ Animal(){ System.out.println("animal is created") } class Dog extends Animal{ Dog(){ System.out.println("Dog is created")} class TestSuper4{ public static void mai...

read more
Ans.

The output of the code will be 'animal is created' followed by 'Dog is created'.

  • The code defines a class Animal with a constructor that prints 'animal is created'.

  • It also defines a class Dog that extends Animal, with a constructor that prints 'Dog is created'.

  • In the main method, an instance of Dog is created, which will trigger the constructors of both Animal and Dog classes.

Add your answer
right arrow

Q2. Which is valid or invalid a. ChromeDriver driver=new ChromeDriver(); b. WebDriver driver=new ChromeDriver(); c. WebDriver driver2=new WebDriver(); driver2=new ChromeDriver();

Ans.

Option a is valid, option b is valid, option c is invalid.

  • Option a is valid because ChromeDriver is a subclass of WebDriver, so it can be assigned to a WebDriver reference.

  • Option b is valid because ChromeDriver is a subclass of WebDriver, so it can be instantiated using a WebDriver reference.

  • Option c is invalid because WebDriver is an interface and cannot be instantiated directly. It can only be used as a reference type.

Add your answer
right arrow

Q3. difference between getwindowhandle and getwindowhandles() and what is output type

Ans.

getwindowhandle returns the handle of the current window, getwindowhandles() returns handles of all open windows

  • getwindowhandle returns a single window handle, while getwindowhandles() returns a set of window handles

  • getwindowhandle is used to switch between windows in Selenium WebDriver

  • Output type of getwindowhandle is String, while output type of getwindowhandles() is Set

Add your answer
right arrow

Q4. Find the combained charected in the given testing exmple : " Testing Testing Testing" , cobained text is "te"

Ans.

The combined characters in the given testing example 'Testing Testing Testing' is 'te'.

  • Iterate through the text and check for consecutive characters 'te'.

  • Combine the characters 'te' whenever they are found together.

  • Return the combined text 'te' as the result.

Add your answer
right arrow
Discover HCLTech interview dos and don'ts from real experiences

Q5. Program to sort the input in descending order without using inbuild method/functions

Ans.

Sort input array of strings in descending order without using inbuilt functions

  • Iterate through the array and compare each element with the rest to find the largest element

  • Swap the largest element with the first element, then repeat the process for the remaining elements

  • Continue this process until the array is sorted in descending order

Add your answer
right arrow

Q6. Output of this : String name="Hello"; name=name+"There"; system.out.println(name)

Ans.

The output will be 'HelloThere'

  • Concatenation of 'Hello' and 'There' results in 'HelloThere'

  • The final string is printed using System.out.println()

Add your answer
right arrow

Q7. StringBuffer buffer=new StringBuffer("Hello") buffer.append("There"); System.out.println(buffer);

Ans.

The code creates a StringBuffer object with 'Hello' and appends 'There' to it before printing the final string.

  • StringBuffer is mutable, so the original 'Hello' string can be modified

  • The append() method adds the specified string to the end of the buffer

  • The final output will be 'HelloThere'

Add your answer
right arrow

Q8. Difference between String and StringBuilder?

Ans.

String is immutable, while StringBuilder is mutable and more efficient for concatenating strings.

  • String is immutable, meaning its value cannot be changed once it is created.

  • StringBuilder is mutable, allowing for modifications to the string without creating a new object.

  • StringBuilder is more efficient for concatenating multiple strings as it does not create new objects each time.

  • Example: String str = "Hello"; StringBuilder sb = new StringBuilder("Hello");

Add your answer
right arrow

Q9. difference between findElement and findElements

Ans.

findElement returns the first matching element on the page, while findElements returns a list of all matching elements.

  • findElement returns a single WebElement matching the locator provided

  • findElements returns a list of WebElements matching the locator provided

  • findElement will throw NoSuchElementException if no element is found, while findElements will return an empty list

Add your answer
right arrow

Q10. Find the 2nd largest number in the given array

Ans.

Find the 2nd largest number in the given array

  • Sort the array in descending order

  • Get the element at index 1, which will be the 2nd largest number

Add your answer
right arrow
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos

Interview Process at HCLTech Automation Engineer

based on 4 interviews
1 Interview rounds
Technical Round
View more
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Automation Engineer Interview Questions from Similar Companies

View all
Recently Viewed
INTERVIEWS
EPAM Systems
10 top interview questions
INTERVIEWS
Capgemini
No Interviews
INTERVIEWS
HCLTech
No Interviews
INTERVIEWS
Tech Mahindra
No Interviews
INTERVIEWS
HCLTech
No Interviews
SALARIES
HCLTech
INTERVIEWS
Tech Mahindra
No Interviews
INTERVIEWS
Infosys
20 top interview questions
INTERVIEWS
GEA Group
10 top interview questions
INTERVIEWS
Amdocs
10 top interview questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter