Tech Mahindra
Varsity Education Management Interview Questions and Answers
Q1. How do you find the selected option text from dropdown in selenium?
To find the selected option text from a dropdown in Selenium, you can use the getFirstSelectedOption() method.
Use the Select class to work with dropdown elements in Selenium
Use the getFirstSelectedOption() method to get the selected option
Retrieve the text of the selected option using getText() method
Q2. How to switch to frame and come out of it in selenium?
To switch to a frame in Selenium, use driver.switchTo().frame() method. To come out of a frame, use driver.switchTo().defaultContent() method.
Use driver.switchTo().frame() method to switch to a frame
Use driver.switchTo().defaultContent() method to come out of a frame
Example: driver.switchTo().frame("frameName");
Example: driver.switchTo().defaultContent();
Q3. Given a string ="This is my interview for QA engineer"; write code to give an output of each word with vowel count?
Code to output each word with vowel count in a given string.
Split the string into words using space as delimiter
Iterate through each word and count the number of vowels
Store the word and its vowel count in an array of strings
Q4. Given a dropdown contains options with duplicates. Find those duplicates along with its occurrence/frequency?
Find duplicates in a dropdown along with their occurrence/frequency.
Iterate through the dropdown options and store each option in a hashmap with its frequency.
Identify options with frequency greater than 1 as duplicates.
Return the duplicates along with their occurrence/frequency.
Q5. how to bring specific commit changes to your branch?
Use git cherry-pick command to bring specific commit changes to your branch.
Identify the commit hash of the specific changes you want to bring to your branch.
Checkout to the branch where you want to apply the changes.
Use 'git cherry-pick <commit-hash>' command to apply the specific commit changes to your branch.
Q6. Match Atleast one capital, once small case, 1 digit and 1 special character using regex?
Regex pattern to match at least one capital letter, one small case letter, one digit, and one special character.
Use the regex pattern: (?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[^A-Za-z0-9])
Example: Password@123
Q7. How do you resolve merge conflicts in git?
Resolve merge conflicts in git by using git commands and tools.
Pull the latest changes from the remote repository
Use 'git status' to identify conflicting files
Open the conflicting files and manually resolve the conflicts
Add the resolved files to the staging area using 'git add'
Commit the changes with a merge message using 'git commit'
Q8. Given a 2X2 Matrix, find the maximum diagonal sum?
To find the maximum diagonal sum in a 2X2 Matrix, sum the elements of the main diagonal and the opposite diagonal.
Sum the elements of the main diagonal (top left to bottom right) and the opposite diagonal (top right to bottom left).
Compare the sums of both diagonals and return the maximum sum.
Example: For a 2X2 Matrix [[1, 2], [3, 4]], the main diagonal sum is 1+4=5 and the opposite diagonal sum is 2+3=5. The maximum diagonal sum is 5.
Q9. Match 14 characters before @ , given an url
Extract the 14 characters before @ in a given URL
Use string manipulation to extract characters before @ symbol
Consider edge cases like no @ symbol or less than 14 characters before @
Handle special characters like %20 or %40
Top Senior QA Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month