Q35 - Java MCQ | Which Collection Does NOT Allow Duplicates? | Set Interface Explained | Zing Coders
Автор: ZingCoders
Загружено: 2025-11-15
Просмотров: 35
Описание:
Q35 -💡 Which collection does not allow duplicate elements?
A) List
B) Set
C) Queue
✅ Correct Answer: b) Set
🧩 Explanation:
A Set in Java does not allow duplicate elements.
It is part of the java.util package.
Implementations include: HashSet, LinkedHashSet, and TreeSet.
📘 Example:
Set nums = new HashSet(); (angle braces included %)
nums.add(1);
nums.add(2);
nums.add(1);
System.out.println(nums); // Output: [1, 2]
🔥 Follow Zing Coders for:
Java Interview MCQs
Core Java Concepts
Placement-Oriented Learning
⚡ Think Smart. Code Better. Crack Confidently.
#Java #JavaQuiz #CollectionsFramework #SetInterface #HashSet #JavaInterview #LearnJava #CodingQuiz #ZingCoders #TechPrep #ProgrammingBasics
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: