8/8/2022 Core Java Day - 7 Test (Array, Collection, List) M.Praveen
This document contains questions and descriptions for a Java test on arrays, collections, and lists. It includes questions about summing and averaging array values, removing duplicates from arrays, finding lengths of ArrayList, LinkedList and Vector, getting index values from lists, printing and iterating through lists, adding, removing and replacing values in lists, and finding common values between lists. The questions cover a range of basic operations on arrays and common collection types in Java.
8/8/2022 Core Java Day - 7 Test (Array, Collection, List) M.Praveen
This document contains questions and descriptions for a Java test on arrays, collections, and lists. It includes questions about summing and averaging array values, removing duplicates from arrays, finding lengths of ArrayList, LinkedList and Vector, getting index values from lists, printing and iterating through lists, adding, removing and replacing values in lists, and finding common values between lists. The questions cover a range of basic operations on arrays and common collection types in Java.
8/8/2022 Core Java Day – 7 Test (Array, Collection, List) M.
Praveen
Q.1 Write a Java program to sum values of an array
Q2. Java program to calculate the average value of array elements.
Q3. Write a java program to remove duplicates from Array.
Q4.(4.1) Create ArrayList and find its length.
Q4.(4.2). Enter values into LinkedList and find its length.
Q4.(4.3). Enter values into Vector and find its length.
Q.5.1 Get the first index value of 10. Input: List = 10,20,30,90
Q5.2 Get last index of 10 in List = [10,20,30,90,10,10,40,50]
Q.5.3. Get the index value of 50 . Input: List = 10,20,30,90,10,10,40,50
Q.5.4. Get the index value of 90. Input: List = 10,20,30,90,10,10,40,50
Q.5.5. Get the each index value of 10 present in below list. Input: List = 10,20,30,90,10,10,40,50,10
Q.5.6. Get the each index value of 70 present in below list
Input: List = 10,20,30,90,10,10,40,50,10 Q.6.1. Print the value at 2nd index position in a given list.
Q.6.2. Get value present at 4th index of a list.
Q.6.3. Get the value at 7th index of given list.
Q. 6.4. Print values of a list using normal for loop.
Q.6.5. Using enhanced for loop print a list.
Q.7.1. Remove value at 2nd index in given array.
Q.7.2. Remove the value present at 10th index Input: List = 10,20,30,90,10,10,40 O/P: must be IndexOutOfBound Exception
Q.7.3. Description : Remove the last value of 10 present in the list
Input: List = 10,20,30,90,10,10,40 Q.8.1. Add a value 50 in the 2nd index and display the list after adding. Input : List = 10,20,30,90,10,10,40,50
Q.8.2. Add a value 70 at the end of the list
Input : List = 10,20,30,90,10,10,40,50 Q.8.3. Add a value 80 at the 8th index of list Input : List = 10,20,30,90,10,10,40,50
Q.8.4. Add a value 100 at the last index of 10 in the list
Input : List = 10,20,30,90,10,10,40,50 Q.9.1. Replace the value 300 into 350 in the list Input : List = 100,200,300,400,500,600,700
Q.9.2. Replace the value present in 7th index as 90
Input: List = 10,20,30,90,10,10,40,50,10 Q.9.3. Replace all the 10 into 100 in List Input: List = 10,20,30,90,10,10,40,50,30 Q.10.1. Create a new ArrayListlists with values and return the common values Input : List = 10,20,30,90,10,10,40,50 Input : List = 30,40,50,60,80 Q.10.2. Create a new ArrayListlists with values and return the common values Input : List = 10,20,30,90,10,10,40,50 Input : List = 10,20,60,50,40,70,80,90 Q.10.3. Create a new ArrayListlists with values and return the common values Input : List = 10,20,30,40,50,60,70,80 Input : List = 100,200,300,400,500,600,700,8000 Q.11.1. Create a new ArrayListlists with values and perform removeAll() function Input : List = 10,20,30,90,10,10,40,50 Input : List = 30,40,50,60,80 Q.11.2. Create a new ArrayListlists with values and perform removeAll() function Input : List = 10,20,30,90,10,10,40,50 Input : List = 10,20,60,50,40,70,80,90 Q.11.3. Create a new ArrayListlists with values and perform removeAll() function Input : List = 10,20,30,40,50,60,70,80 Input : List = 100,200,300,400,500,600,700,8000