Question set 41 to 50:
Let's assume we have below arraylist:
ArrayList<String> arrlst = new ArrayList<>();
- How to convert List to array and array to list?
- How to remove a SubList from a List in Java ?
Ans: List.subList(int fromIndex, int toIndex).clear() - How to do Sorting of An Array?
Click Here For Answer - Difference between ArrayList and HashMap in Java?
==>ArrayList implement List Interface while HashMap is an implementation of Map interface.
==>ArrayList maintains the insertion order while HashMap does not maintain insertion order.
==>ArrayList allows duplicate elements while HashMap doesn’t allow duplicate keys but does allow duplicate values. - How to add element to arrlst?
Ans: arrlst.add(element);
- Does list maintains insertion order?
Ans: Both the ArrayList and LinkedList maintain the elements insertion order which means while displaying ArrayList and LinkedList elements the result set would be having the same order in which the elements got inserted into the List.
Top Kubernetes Commands-Click Here - How to get length of Array and List?
- How to add element at any index?
Ans: arr.add(index,element);
- Difference between ArrayList and LinkedList?
Ans: Click here for answer with explanation
Ans: Click here for answer with explanation
- How to get element or index in arrlst?
Ans: arr.get(element);
arr.get(index); How to Declare, Create and Initialize Array on same line
- How to remove element and index in arrlst?
Ans: arr.remove(element); //returns boolean value
arr.remove(index);//returns boolean value
Know About DevOps How to get duplicate elements in an array?Very Imp
- How to set a specified value to a specified index of arrlst?
Ans: arr.set(index,element); Difference between an array and an ArrayList in Java?
Ans: The main difference between array and ArrayList is that the array is static and the arraylist is dynamic. We cannot change the size of the array once created, but ArrayList can increase its size automatically.Explore more java related questions : Click here for Java Coding Q&A
Bonus Questions:
--> Difference between arraylist and linkedlist?
Click Here For Answer
****************************************************
Try to find the answer and do reply in the comment section, will explain in next post.Keep reading. Subscribe my youtube channel: https://youtu.be/SmTbXizVzfU
- Selenium Interview Question SET-1
- Selenium Interview Question SET-2
- Selenium Interview Questions SET-3
- Selenium Interview Question SET-4
*******************************************************************
****************************************
TOP 15 BDD - CUCUMBER Interview Q&A
************************************************
✍️AUTHOR: LinkedIn Profile
************************************************
Learn (API-Microservice)Testing+ Selenium UI Automation-SDET with Self Paced Videos prepared by FAANG employees and LIVE Doubt Session
*************************************************
SeleniumWebdriver Automation Testing Interview Questions:
https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver
API Testing Interview Question Set:
https://automationreinvented.blogspot.com/2022/03/top-80-api-testing-interview-questions.html
DevOps Interview Q&A:
https://automationreinvented.blogspot.com/2021/11/top-11-devops-interview-questions-and.html
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes
Docker Interview Question Set
https://automationreinvented.blogspot.com/Docker
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign
Java Related Interview Question Set
https://automationreinvented.blogspot.com/search/label/Java
GIT Interview Question Set:
https://automationreinvented.blogspot.com/2021/09/top-40-git-interview-questions-and.html
Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions
Mobile Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Mobile%20Testing
Python Interview Question Set for QAE - SDET - SDE:
https://automationreinvented.blogspot.com/search/label/Python
Good list of questions Sidharth. Keep sharing.
ReplyDelete