Get Job-ready: Java Course with 45+ Real-time Projects! - Learn Java
Abstract Data Types (ADTs) are the cornerstones of data structures in computer science. Imagine them as blueprints for organizing and manipulating data, but without getting bogged down in the nitty-gritty details of how that data is actually stored in memory.
ADTs define the operations (functions) you can perform on the data, like adding elements to a list or searching for a specific value in a set. This separation of concerns is what makes ADTs so powerful. By focusing on what the data structure can do, rather than how it does it, you can write more reusable and maintainable code.
Furthermore, ADTs promote platform independence – the same ADT concepts can be applied across different programming languages and hardware architectures.
This quiz is designed to be a fun and engaging way to test your understanding of fundamental ADTs in Java. By tackling these questions, you’ll solidify your grasp of essential building blocks for crafting efficient and versatile Java programs. So, put on your thinking cap and get ready to dive into the world of ADTs!
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 15 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 15
1. Question
Which of the following is not an example of Abstract data type in Java ?
CorrectIncorrect -
Question 2 of 15
2. Question
class StackADT {
public static void main ( String args [ ] )
{
Stack<Integer> s = new Stack<Integer> ();
s.push(2);
s.push(4);
s.push(6);
s.setSize(4);
s.push(8);
boolean value = s.isFull();
System.out.println(value);
}
}
What is the output of the program ?
CorrectIncorrect -
Question 3 of 15
3. Question
class Abstract {
public static void main ( String args [ ] )
{
Stack <Integer> stack = new Stack <Integer> ();
stack.size(1);
stack.push(2);
stack.push(3);
stack.push(4);
}
public void display()
{
System.out.println(stack);
}
display();
}
}
What will be the output of the program?
CorrectIncorrect -
Question 4 of 15
4. Question
Which of the following is not present in Abstract data type ?
CorrectIncorrect -
Question 5 of 15
5. Question
class ListFunction {
public static void main ( String args [ ] )
{
List<String> list = new List<String> ();
list.add(“one”);
list.add(“two”);
list.add(“three”);
list.add(“four”);
list.add(“five”);
String value = list.removeAt(4);
System.out.println(list);
}
}
What is the error in the program ?
CorrectIncorrect -
Question 6 of 15
6. Question
class ListSample {
public static void main ( String args [ ] )
{
List <Boolean> l = new List<Boolean> ();
l.add(True);
l.add(False);
l.add(True);
l.add(False);
print();
}
void print() {
List<l> sublist(1,2);
}
}
What is the output of the program ?
CorrectIncorrect -
Question 7 of 15
7. Question
Which of the following data structures is used to arrange the elements in ascending order ?
CorrectIncorrect -
Question 8 of 15
8. Question
class QueueProgram {
public static void main ( String args [ ] )
{
Queue < String > q = new Queue < String> ();
q.add(“DataFlair);
q.add(“Webservices”);
System.out.println(q.dequeue);
}
}
What will be the output of the program ?
CorrectIncorrect -
Question 9 of 15
9. Question
class QueueADT {
public static void main ( String args [ ] )
{
Queue <Integer> queue = new Queue<Integer> ();
System.out.println(queue.isEmpty();
}
}
What is the output of the program ?
CorrectIncorrect -
Question 10 of 15
10. Question
Which of the following is not a method in Queue Abstract data type ?
CorrectIncorrect -
Question 11 of 15
11. Question
class Queue {
public static void main ( String args [ ] )
{
Queue < Integer > q = new Queue < Integer > ();
q.dequeue();
}
}
What is the error in the program ?
CorrectIncorrect -
Question 12 of 15
12. Question
class Demo {
public static void main ( String args [ ] )
{
List < Integer> lst = new List < Integer> ();
l.add(10);
l.add(9);
l.add(8);
l.add(7);
l.add(6);
int value = l.indexOf(8);
System.out.println(value);
}
}
What is the output of the program ?
CorrectIncorrect -
Question 13 of 15
13. Question
Which of the following is not a classification of Abstract data type in Java ?
CorrectIncorrect -
Question 14 of 15
14. Question
class List {
public static void main ( String args [ ] )
{
List<Integer> l = new List<Integer> ();
l..add(100);
l.add(200);
l.add(300);
int a = l.get(2);
System.out.println(a);
}
}
What will be the output of the program ?
CorrectIncorrect -
Question 15 of 15
15. Question
class Stacksize {
public static void main ( String args [ ] )
{
Stack < String > stk = new Stack<String> ();
stk.push(“DataFlair”;
stk.push(“Webservices”);
stk.push(“Private”);
stk.push(“Limited”);
int limit = 2 ;
Iterator it = stk.Iterator();
if( stk.size()>limit)
{
it.remove();
}
System.out.println(stk);
}
}
What is the output of the program ?
CorrectIncorrect
Summary:
So you’ve taken the quiz on Abstract Data Types in Java! Hopefully, it provided valuable insights into your understanding of ADTs and their role in Java programming. If you aced the quiz, congratulations! You’ve established a strong foundation in this crucial concept. If you encounter some challenges, don’t worry.
Utilize the wealth of online resources available, such as tutorials, practice problems, and online communities, to delve deeper into ADTs and refine your knowledge. Remember, consistent practice and exploration are key to mastering any programming concept.
