MCIT Newest Actual Exam Complete
Questions & Correct Detailed Answers
(Verified )
Question 1
How do you construct a LinkedList?
Correct Answer
LinkedList constructs a list containing the elements of the specified collection, in
order they are returned by the collection's iterator
Question 2
What are the pros of the Singly Linked Lists?
Correct Answer
The linked list is more efficient at memory allocation because we don't need to
indicate the capacity -- like with the ArrayList Stack implementation
Question 3
What is a false negative / positive in our unit test?
Correct Answer
It's a bug in your test case and code.
Question 4
What is external quality?
Correct Answer
Executable program running on hardware in some environment.
Functionality - adheres to specifications
Reliability - maintains level of performance
Usability - ease with which suers can perform tasks
Efficiency - minimal use of resources
Security - confidentiality, integrity, availability
Page 1 of 48
,Question 5
What are the three places we can add a value to a LinkedList?
Correct Answer
front: link new node to current head; point head at a new node
rear: link tail node to a new node; point tail at a new node
middle: link new node to one that follows it; link previous node to new node
Question 6
What is the most efficient way of copying an array?
Correct Answer
System.arraycopy()
Question 7
What is a stack?
Correct Answer
A data structure that works like a LinkedList but only has two operations:
push - add the specified element to the top of the stack
pop - remove the element from the top of the stack
Page 2 of 48
,Question 8
What is a "generic" class?
Correct Answer
Uses parameters of different types that it uses
Use the type parameter in the class definition:
## definition
public class GenericArrayList {
protected E[] data;
....
public GenericArrayList(int capacity){
data = (E[]) new Object[capacity];
}
public void add(E value) {
....
}
public E get(int index) {
....
}
}
## implementation
GenericArrayList dogs = new GenericArrayList<>();
dogs.add(new Dog("Pearl"));
Question 9
What is a double-ended queue?
Correct Answer
Queue-like data structure that supports insertion and deletion at both the front and
the back of the queue. It is more abstract and general than the stack and queue
ADTs.
Page 3 of 48
, Question 10
How should you access instance variables in JUnit tests?
Correct Answer
Use the "protected" keyword to access instance variables. This will make the variable
able to be set in the JUnit test (because it's a part of the package).
Question 11
What is unit testing?
Correct Answer
test small piece of code; intuition is that bugs will be easier to find/fix
Question 12
How do you find an element in a LinkedList?
Correct Answer
public class LinkedList {
...
public boolean contains(E value) {
Node current = head;
while (current != null) {
if (current.value.equals(value)) {
return true;
}
current = current.next;
}
return false;
}
}
Page 4 of 48
Questions & Correct Detailed Answers
(Verified )
Question 1
How do you construct a LinkedList?
Correct Answer
LinkedList constructs a list containing the elements of the specified collection, in
order they are returned by the collection's iterator
Question 2
What are the pros of the Singly Linked Lists?
Correct Answer
The linked list is more efficient at memory allocation because we don't need to
indicate the capacity -- like with the ArrayList Stack implementation
Question 3
What is a false negative / positive in our unit test?
Correct Answer
It's a bug in your test case and code.
Question 4
What is external quality?
Correct Answer
Executable program running on hardware in some environment.
Functionality - adheres to specifications
Reliability - maintains level of performance
Usability - ease with which suers can perform tasks
Efficiency - minimal use of resources
Security - confidentiality, integrity, availability
Page 1 of 48
,Question 5
What are the three places we can add a value to a LinkedList?
Correct Answer
front: link new node to current head; point head at a new node
rear: link tail node to a new node; point tail at a new node
middle: link new node to one that follows it; link previous node to new node
Question 6
What is the most efficient way of copying an array?
Correct Answer
System.arraycopy()
Question 7
What is a stack?
Correct Answer
A data structure that works like a LinkedList but only has two operations:
push - add the specified element to the top of the stack
pop - remove the element from the top of the stack
Page 2 of 48
,Question 8
What is a "generic" class?
Correct Answer
Uses parameters of different types that it uses
Use the type parameter in the class definition:
## definition
public class GenericArrayList {
protected E[] data;
....
public GenericArrayList(int capacity){
data = (E[]) new Object[capacity];
}
public void add(E value) {
....
}
public E get(int index) {
....
}
}
## implementation
GenericArrayList dogs = new GenericArrayList<>();
dogs.add(new Dog("Pearl"));
Question 9
What is a double-ended queue?
Correct Answer
Queue-like data structure that supports insertion and deletion at both the front and
the back of the queue. It is more abstract and general than the stack and queue
ADTs.
Page 3 of 48
, Question 10
How should you access instance variables in JUnit tests?
Correct Answer
Use the "protected" keyword to access instance variables. This will make the variable
able to be set in the JUnit test (because it's a part of the package).
Question 11
What is unit testing?
Correct Answer
test small piece of code; intuition is that bugs will be easier to find/fix
Question 12
How do you find an element in a LinkedList?
Correct Answer
public class LinkedList {
...
public boolean contains(E value) {
Node current = head;
while (current != null) {
if (current.value.equals(value)) {
return true;
}
current = current.next;
}
return false;
}
}
Page 4 of 48