JAVA 1 .Which one is NOT a available traversal algorithm? Select one: a. Doubly-
ID: 3847903 • Letter: J
Question
JAVA
1 .Which one is NOT a available traversal algorithm?
Select one:
a. Doubly-linked list from first to last
b. Singly-linked list from last to first
c. Singly-linked list from first to last
d. Doubly-linked list from last to first
2 .Which data structure uses circular-array when implemented using Java arrays?
Select one:
a. Stack
b. Singly-Linked List
c. Queue
d. Doubly-Linked List
3 Which of the following is NOT an operation on Queue ADT?
Select one:
a. frontValue
b. dequeue
c. enqueue
d. topValue
4 What is the running time performance of binary search algorithm in big-Oh notation?
Select one:
a. O(N)
b. O(logN)
c. O(NlogN)
d. O(N2)
5 In Java programming, when we insert an item to the front of the queue, then:
Select one:
a. The queue will rearrange all items
b. This operation is not allowed
c. The new item automatically switches its position with the next item
d. Queue converts to FIFO organization
6 In Java programming, when we remove an item from bottom of the stack, then:
Select one:
a. This operation is not allowed
b. All items will be automatically rearranged
c. The item at the top will replace the removed item
d. The stack will convert to LIFO
7 Which ADT is best suited for storing method parameters, local variables, and return values in memory?
Select one:
a. Queue
b. Linked List
c. Stack
d. Freelist
8 What is the asymptotic running time of the following algorithm?
public static long F(int n) {
if (n == 0) return 0;
if (n == 1) return 1;
return F(n-1) + F(n-2);
}
Select one:
a. Between O(n) and O(2n) – linear
b. Between O(n 2) and O(n 3) – polynomial
c. Between O(1.5 n) and O(2 n) – exponential
d. None of the above
9 From the following four data structures, which one has the slowest insert operation?
Select one:
a. Insert at the head of a single linked list
b. Queue
c. Insert at the tail of a single linked list
d. Stack
10 Which of the following is NOT an operation on Stack ADT?
Select one:
a. push
b. frontValue
c. topValue
d. pop
11 An unsorted array of size 10,000 contains random integers in the range 10,000 .. 20,000. The program performs 100,000 searches where searched values are randomly selected from the range 10,000 .. 30,000. What will be the average number of comparisons when sequential search algorithm is used?
Select one:
a. 5,000
b. 7,500
c. 10,000
d. 50,000
12 Which of the following is NOT an O(nlogn) sorting algorithm.
Select one:
a. Merge Sort
b. Quick Sort
c. Heap Sort
d. Shell Sort
13 Which data structure allows two structures to be implemented using a single Java array?
Select one:
a. Queue
b. Doubly-Linked List
c. Stack
d. Singly-Linked List
14 Which of the following is not an appropriate strategy for tokenization?
Select one:
a. Using String object’s split() method
b. Using Scanner object’s next() method
c. Using StringBuilder Class
d. Using StringTokenizer class
15 Given their time complexity, which of the following algorithms will be the fastest?
Select one:
a. O(N)
b. O(logN)
d. O(loglogN)
16 From the following four data structures, which one has the slowest remove operation?
Select one:
a. Queue (operation dequeue)
b. Stack (operation pop)
c. Single Linked List (remove the last element)
d. Single Linked List (remove the first element)
Explanation / Answer
1 .Which one is NOT a available traversal algorithm?
b. Singly-linked list from last to first
Because there is no back pointer in single linked list node to take you on previous node
2 .Which data structure uses circular-array when implemented using Java arrays?
Select one:
c. Queue
Queue usese circular arrays, as queue gets element inserted on rear end and ejected from front end.
3 Which of the following is NOT an operation on Queue ADT?
Select one:
d. topValue
There is no top on the queue.. A stack has the top.
4 What is the running time performance of binary search algorithm in big-Oh notation?
Select one:
b. O(logN)
The binary tree has a maximum height of Log(N). Hence the complexity can't be more than that.
5 In Java programming, when we insert an item to the front of the queue, then:
Select one:
b. This operation is not allowed
In queue, elements can be inserted only on rear end.
6 In Java programming, when we remove an item from bottom of the stack, then:
Select one:
a. This operation is not allowed
The stack's top element only can be removed.
7 Which ADT is best suited for storing method parameters, local variables, and return values in memory?
Select one:
c. Stack
Stakc is used to store the method calls one by one along with their params.
8 What is the asymptotic running time of the following algorithm?
public static long F(int n) {
if (n == 0) return 0;
if (n == 1) return 1;
return F(n-1) + F(n-2);
}
c. Between O(1.5 n) and O(2 n) – exponential
As For F(4), there are two calls F(2) and F(3).. similarly.. they again break to 4 calls.. then 8 and so on.. hence exponential
9 From the following four data structures, which one has the slowest insert operation?
Select one:
c. Insert at the tail of a single linked list
To find the tail, you need to traverse from head to tail. Hence O(N) complexity.
10 Which of the following is NOT an operation on Stack ADT?
Select one:
b. frontValue
There is no front on Stack.
11 An unsorted array of size 10,000 contains random integers in the range 10,000 .. 20,000. The program performs 100,000 searches where searched values are randomly selected from the range 10,000 .. 30,000. What will be the average number of comparisons when sequential search algorithm is used?
Select one:
a. 5,000
Assuming the numbers to be distributed uniformly among 10000 positions, average number of comparisions will be 5000.
12 Which of the following is NOT an O(nlogn) sorting algorithm.
Select one:
d. Shell Sort
Complexity: (n(log(n))^2)
13 Which data structure allows two structures to be implemented using a single Java array?
Select one:
b. Doubly-Linked List
14 Which of the following is not an appropriate strategy for tokenization?
Select one:
c. Using StringBuilder Class
It is used to create the string
15 Given their time complexity, which of the following algorithms will be the fastest?
Select one:
d. O(loglogN)
16 From the following four data structures, which one has the slowest remove operation?
Select one:
c. Single Linked List (remove the last element)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.