Instant Systems
10+ HPCL Bottling Plant Interview Questions and Answers
Q1. Locators and line of code to store any data in a textbox
To store data in a textbox, use locators and line of code.
Identify the textbox element using locators such as ID, name, class, or XPath
Use the sendKeys() method to enter data into the textbox
Store the data in an array of strings for later use
Q2. What is maven and Maven hierarchy
Maven is a build automation tool used primarily for Java projects. It manages dependencies and builds the project.
Maven uses a Project Object Model (POM) to manage dependencies and build process
Maven has a hierarchical structure with parent and child projects
Maven plugins can be used to extend its functionality
Maven can be integrated with Continuous Integration tools like Jenkins
Example: mvn clean install command is used to build and package a project
Q3. What is framework and Use of testNG
TestNG is a testing framework for Java. It is used to perform unit, functional, integration, and end-to-end testing.
TestNG is an open-source testing framework for Java
It supports various types of testing such as unit, functional, integration, and end-to-end testing
TestNG provides annotations to define test methods, test suites, and test cases
It generates test reports and allows parallel execution of tests
TestNG can be integrated with other tools such as Selenium and Maven
Q4. Difference between Assert and verify
Assert checks if a condition is true, while verify checks if a condition is true and reports if it is false.
Assert is used to validate the expected result of a test case
Verify is used to validate the actual result of a test case
Assert throws an exception and stops the test execution if the condition is false
Verify reports the failure but continues with the test execution
Assert is used for critical validations, while verify is used for non-critical validations
Q5. Process of manual testing
Manual testing involves executing test cases manually without the use of automation tools.
Identify test scenarios and create test cases
Execute test cases and record results
Report defects and retest after fixes
Perform regression testing
Ensure test coverage and traceability
Q6. Difference between method overloading and overriding, Explain by code example
Method overloading is having multiple methods in the same class with the same name but different parameters. Method overriding is having a method in a subclass with the same name and parameters as a method in the superclass.
Method overloading is achieved within the same class by having multiple methods with the same name but different parameters.
Method overriding occurs in a subclass when a method has the same name and parameters as a method in the superclass, effectively rep...read more
Q7. Count the number of words and their frequency
Count the number of words and their frequency
Split the given text into words using whitespace as delimiter
Create a dictionary to store the word frequency
Iterate through each word and update the frequency in the dictionary
Return the dictionary with word frequency
Q8. Implementing the comparator function for sorting
Implementing the comparator function for sorting an array of strings.
Use the built-in sort() function in most programming languages.
Define a custom comparator function that compares two strings.
Return a negative value if the first string should come before the second, a positive value if it should come after, and 0 if they are equal.
Example: ['apple', 'banana', 'cherry'] can be sorted in alphabetical order using the comparator function.
Q9. Ways to create object in java.
Objects in Java can be created using the 'new' keyword, constructors, and factory methods.
Use the 'new' keyword followed by the class name to create an object
Objects can also be created using constructors to initialize the object's state
Factory methods can be used to create objects without exposing the instantiation logic
Q10. Count frequency of characters.
Count the frequency of characters in a given string.
Iterate through the string and use a hash map to store the count of each character.
Initialize the count of each character to 0 and increment it as you encounter the character.
Finally, iterate through the hash map to get the frequency of each character.
Q11. prepare test case template
Test case template for QA testing
Test case ID
Test case description
Test steps
Expected result
Actual result
Pass/Fail status
Q12. explain hard and soft assert
Hard assert stops the test execution when a failure occurs, while soft assert continues the test execution after logging the failure.
Hard assert is used when a failure should stop the test immediately.
Soft assert is used when a failure should be logged but the test should continue.
Example: Hard assert - assert.assertEquals(actual, expected); Soft assert - softAssert.assertEquals(actual, expected); softAssert.assertAll();
Q13. Reversing the array
Reverses an array of strings
Use a loop to iterate through half of the array
Swap the elements at the current index with the corresponding element from the end of the array
Interview Process at HPCL Bottling Plant
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month