which of these methods can be used to move to next element in a collection?
Mohammed
Guys, does anyone know the answer?
get which of these methods can be used to move to next element in a collection? from screen.
Which of these methods can be used to move to next element
Which of these methods can be used to move to next element in a collection?
Home » JAVA Programming » Collections » Question
Collections
Easy Questions
JAVA Programming
Java Basic Basic Syntax Object & Classes Basic Datatypes Variable Types Modifier Types Basic Operators Loop Control Decision Making Numbers Characters Strings Arrays Date & Time Regular Expressions Methods Files and I/O Exceptions Inheritance Polymorphism Abstraction Encapsulation Interfaces Packages Data Structures Collections Generics Serialization Networking Multithreading Applet
Which of these methods can be used to move to next element in a collection?
hasNext() shuffle() move() next() None of these
Correct Option: D
next()
Which of these methods can be used to move to next element in a collection?
Which of these methods can be used to move to next element in a collection? (a) next() (b) move() (c) shuffle() (d) hasNext()
Which of these methods can be used to move to next element in a collection?
← Prev Question Next Question →
1 Answer
← Prev Question Next Question →
Find MCQs & Mock Test
JEE Main 2024 Test Series
NEET Test Series
Class 12 Chapterwise MCQ Test
Class 11 Chapterwise Practice Test
Class 10 Chapterwise MCQ Test
Class 9 Chapterwise MCQ Test
Class 8 Chapterwise MCQ Test
Class 7 Chapterwise MCQ Test
Related questions
Iterators
This section of our 1000+ Java MCQs focuses on iterators of Java Programming Language. 1. Which of these return type of hasNext() method of an iterator? a) Integer b) Double c) Boolean d) Collections Object 2. Which of these methods is used to obtain an iterator to the start of collection? a) start() b) begin() ... Read more
Java Questions & Answers – Iterators
« Prev Next »
This section of our 1000+ Java MCQs focuses on iterators of Java Programming Language.
1. Which of these return type of hasNext() method of an iterator?
a) Integer b) Double c) Boolean
d) Collections Object
View Answer
2. Which of these methods is used to obtain an iterator to the start of collection?
a) start() b) begin() c) iteratorSet() d) iterator() View Answer
3. Which of these methods can be used to move to next element in a collection?
a) next() b) move() c) shuffle() d) hasNext() View Answer
Note: Join free Sanfoundry classes at Telegram or Youtube
advertisement
4. Which of these iterators can be used only with List?
a) Setiterator b) ListIterator c) Literator
d) None of the mentioned
View Answer
5. Which of these is a method of ListIterator used to obtain index of previous element?
a) previous() b) previousIndex() c) back() d) goBack() View Answer
Take Java Programming Practice Tests - Chapterwise!
Start the Test Now: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
6. Which of these exceptions is thrown by remover() method?
a) IOException b) SystemException
c) ObjectNotFoundExeception
d) IllegalStateException
View Answer
7. What will be the output of the following Java program?
advertisement import java.util.*;
class Collection_iterators
{
public static void main(String args[])
{
ListIterator a = list.listIterator();
if(a.previousIndex()! = -1)
while(a.hasNext())
System.out.print(a.next() + " ");
else
System.out.print("EMPTY");
} } a) 0 b) 1 c) -1 d) EMPTY View Answer
8. What will be the output of the following Java program?
import java.util.*;
class Collection_iterators
{
public static void main(String args[])
{
LinkedList list = new LinkedList();
list.add(new Integer(2));
list.add(new Integer(8));
list.add(new Integer(5));
list.add(new Integer(1));
Iterator i = list.iterator();
Collections.reverse(list);
while(i.hasNext())
System.out.print(i.next() + " ");
} } a) 2 8 5 1 b) 1 5 8 2 c) 2 d) 2 1 8 5 View Answer
9. What will be the output of the following Java program?
import java.util.*;
class Collection_iterators
{
public static void main(String args[])
{
LinkedList list = new LinkedList();
list.add(new Integer(2));
list.add(new Integer(8));
list.add(new Integer(5));
list.add(new Integer(1));
Iterator i = list.iterator();
Collections.reverse(list);
Collections.sort(list);
while(i.hasNext())
System.out.print(i.next() + " ");
} } a) 2 8 5 1 b) 1 5 8 2 c) 1 2 5 8 d) 2 1 8 5 View Answer
10. What will be the output of the following Java program?
import java.util.*;
class Collection_iterators
{
public static void main(String args[])
{
LinkedList list = new LinkedList();
list.add(new Integer(2));
list.add(new Integer(8));
list.add(new Integer(5));
list.add(new Integer(1));
Iterator i = list.iterator();
Collections.reverse(list);
Collections.shuffle(list);
i.next(); i.remove(); while(i.hasNext())
System.out.print(i.next() + " ");
} } a) 2 8 5 b) 2 1 8 c) 2 5 8 d) 8 5 1 View Answer
Sanfoundry Global Education & Learning Series Java Programming Language.To practice all areas of Java language, here is complete set of 1000+ Multiple Choice Questions and Answers.
« Prev - Java Questions & Answers – Collection Framework Overview
» Next - Java Questions & Answers – Data Structures-Queue
Next Steps:Get Free Certificate of Merit in Java Programming
Participate in Java Programming Certification Contest
Become a Top Ranker in Java Programming
Take Java Programming Tests
Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Related Posts:Practice Programming MCQs
Buy Programming Books
Practice BCA MCQs
Apply for Java Internship
Buy Java Books advertisement
Recommended Articles:
Java Questions & Answers – Collection Algorithms
C++ Programming Questions and Answers – Iterators
C# Question & Answers – Iterators
Bidirectional Iterators in C++
Java Program to Implement LinkedList API
Java Program to Implement CopyOnWriteArraySet API
Java Program to Implement HashSet API
Java Questions & Answers – Collections Interface
Java Program to Implement SimpeBindings API
Java Program to Implement LinkedHashSet API
advertisement
Additional Resources:Java Applet Programs
Java Programming MCQ Questions
Java Programming Examples
Java Programs on Collections
Java Programs on Classes and Objects
Popular Pages:Event Handling in Java with Examples
Guys, does anyone know the answer?