Choosing pivot and place all items smaller than pivot to the left and bigger ones to the right, then repeat the same with two branches is similar to _____________ sort algorithm.
quick
merge
bubble
heap
Inventor of merge sort is ?
John von Neumann
Mr Merge
John Lennon
Professor Sortmerg
А collision occurs when ... ?
two keys hash to the same table index.
two values hash to the same table index
two keys are hashed to big table inde and rehash needed
impossible to answer
What are the two parts of ADT?
private, public
methods and data fields
Parent and Child
Int and Float
Queue and Stack
List two ways of organizing hashtable.
open addressing and chaining
key and value
arraylist and vector
Breadth first search and Depth first search
Which of them has more methods?
Subclass
Superclass
Parentclass
Object
Indicate the relationship of HastableOpen and Entry classes?
has-a
static
is-b
is-a
The relationship when one class is defined inside the definition of another ?
is
Which of them is NOT an example of Data Structure ?
ArrayList
Breadth First Search
Set
Priority Queue
Graph
Redefinition of method of superclass in a subclass with the same name and number of parameters?
Override
Overload
Public
Encapsulation
A set view of a map can be obtained through method_______?
entrySet
setView
goAhead
emptySet
Which of them is NOT feature of collection interface ?
List
Queue
Vector
Redefinition of method with the same name but different number of parameters?
Polymorphism
If you want to call the constructor of superclass you would use
Super()
Parent()
that()
Quadratic probing is usually used to ?
reduce collisions
reallocate array
for fun
enlarge table size
This returns TRUE if the collection contains object
Find(obj)
goTo(obj)
indexF(obj)
contains(obj)
indexOf(obj)
If you want to call different constructor of current class you would use
this()
anay()
which()
Elements of a List are accessed by means of an
index
position
book
loop
switch
Set of ordered pairs whose element are known as the key and value is ?
set
map
graph
array
If there is at least one abstract method in a class, that class is called
Abstract class
Child class
Parent class
Not given
If there are no abstract methods in the class we call that class…
Actual class
Parent
A list can ___ or ___ as items(elements) are added or removed
flow, shrink
grow, shrink
decrease, think
fly, sit
increase, grow
Is it possible to inherit from multiple classes ?
No
Yes
Is it possible to implement multiple interfaces?
no
yes
The Collection is a _____ of a List ?
superinterface
father
node
parent
interface
Every class has _____as a superclass
Object(parent of classes)
Object(childof classes)
int
Which method returns an object at the top of a Stack in JAVA?
top()
pop()
front()
peek()
poll()
InstanceOf used to test
Whether an object belongs to class or not
Division by zero may occur
class belongs to object
Which method adds an item on the top of a Stack in JAVA?
add()
push()
bush()
Two JAVA API Implementation of Set and Map are
tree and hash
graph and vector
list and hash
tree and list
What is not perfect in this code: ave = sum/count;
Division by one may occur
nothing
not given
First in last out structure is...
Tree
Stack
Attempt to convert a string that is not numeric to a number faults …
NumberFormatException
ArrayIndexOutOfBoundsException
DivisionByZero
Which structure is widely used in finding palindrome problem?
Map
Average time complexity of Insertion sort is?
O(n^2)
O(1)
O(nlogn)
O(logn)
O(n)
Attempt to access array element using index less than zero folds
OutOfBoundsException
Which container is not appropriate to implement Stack in JAVA?
Array
________ exception is an error normally due to programmer
unchecked
checked
null
Which structure is widely used to calculate the value of postfix expression?
String
A hash table uses hashing to transform an items key into a table index so that iterations, retrievals and deletions can be performed in expected ___________ time.
________ exception is an error normally not due to programmer
Calculate value of "4 7 * 20 - "
1
3
136
8
144
ADT that enables a user to access information (data) corresponding to a specified key.
Ability of object of one class to act like it is an object of another class is?
Inheritance
Java code
SLOC (Source Line of Code)
What does method empty return for empty stack?
empty
hello
true
false
Which of the following is not example of visibility in Java ?
Eclipse
JetBrains
NetBeans
Waiting line of people is similar to which data structure?
LinkedList
Sets the element on position Index to reference entry
Set (Index, Entry )
GEt(Index, Entry)
Nothing
Set(Entry)
Average time complexity of Merge sort is?
You can reference an object of a ___ type through a variable of a ___ type
subclass, superclass
superclass, subclass
subclass, parent class
interface, subclass
Most sorting algorithm are divided into two basic groups.
fast and slow
go amd play
sort and search
ordered and unordered
What is the time complexity of insert(index) method in ArrayList
O(n^3)
You cast an object referenced by a___ type to an object of a___ type in order to apply methods of the___type to the object –___ :
subclass, superclass, subclass, downcast
superclass, subclass, subclass, downcast
subclass, subclass, superclass, downcast
subclass, subclass, downcast, superclass
Which structure is better to use when printing many documents from multiple computers at one printer?
What is the difference between ArrayList and Vector?
Vector is synchronized, where ArrayList is not
there are same
ArrayLIst is synchronized, where Vectoris not
JAVA API uses ____________ to implement both Set and Map interfaces.
hash table
tree table
vector
If we call remove() function for the queue, which item will be removed
third
second
middle
first
last
Each node is a single-linked list, has a reference to__ and __
next node, previous node
next node, data
data, next node
implement, next node
For(int i=0; i<size; i++){ If(theData[i]==entry){ Return i; }Return -1;} This method is similar to which method of ArrayList
IndexOf(entry)
number
IndexOf(cell)
What function return first added item in the queue?
giveMeFirst()
first()
goBack()
element()
Indicate constant time complexity in terms of Big-O notation
This method associates specified value with the specified key in the map.
put(key,value)
set(key,value)
get(key,value)
key.set(key,value)
Which function is used to add new item in the queue?
suffer()
remove()
offer()
The collection of abstract methods is called
Interface
Indicate logarithm time complexity in terms of big-O notation?
log(n)
log(1)
log(n^2)
log(n^3)
Average time complexity of Shell sort is?
O(n^1.25)
Indicate linear time complexity in terms of big-O notation?
n
logn
n^2
n^3
Indicate exponential time complexity in terms of big-O notation?
O(2^n)
O(3^n)
What determines whether you should use quadratic sort or a logarithmic sort algorithm?
array size
array indexes
array type
array values
swapping conditions
Find the slowest time
O(n!)
What is the time complexity of ArrayList remove(index) method
In a double-linked list, each node has a reference to: ___, ___and ___
next node, previous node, data
implement, data, next node
next node, data, previous node
data, next node previous node
In open addressing you can not remove an item to be deleted, so what should you do instead?
mark as deleted flag
do nothing
delete and save in temporary list
change its palce with another item
What is the time complexity of adding an item in front of a LinkedList
Average time complexity of Bubble sort is?
What is the time complexity of insert(index) method in ArrayList?
O(mxn)
To remove an item from a single -linked list, you need a reference to
previous node
next node
data
the node
What is the time complexity of adding element in the beginning of ArrayList
If two or more keys will be encoded to the same index of a hashtable, it is called.
collision
error
mistake
duplicate
Which method removes an item on the top of a Stack in JAVA?
hop()
drop()
To remove an item from a double -linked list, you need a reference to
next
Which method searches for target and returns its position in LinkedList
IndexOf(target)
ArrayIndexOutOfBloundException
Inheritance is:
powerful code reuse mechanism
providing access to data
ability of object of one class to act like it is an object of another class
hiding an access to data
powerful technique to store all data together
Hiding access to data members of a class is called:
Inheritence
None of them
An iterator allows us to access items of a list
sequentially
ordinal
together
don't know
The relationship when one class is a subclass of another is called:
has
can
are
include
How to remove item from LinkedList
Change Link of previous item to next item of item to be removed
Change Item
Change Link of next item to previous item to be changed
Change Link of next item to previous item of item to be removed
___testing focuses on testing the functional characteristics of a module
Green-box
Terminal
White-box
Black-box
Ideal data structure for a contact list is ?
tree
___testing requires the use of test data that exercise each statement in a module
What is attribute of CircularList
next of last item referencing to the first item
set of Nubmber
Rules
last of next item referencing to the last item
You apply method ____________ to set view to get an object that facilitates sequential access to the Map elements.
iterator
accessor
traversal
preorder
What is popularity used to traverse SingleLinkedList
Iterator
Traversator
Loop and switch
Commutator
Which of the following in Java is very similar to “contract”?
Interface implementation
Access denied
The java linked-list class uses a ___ to implement the list interface
array-linked list
array list
linked list
double-linked list
List iterator and iterator is the same thing in JAVA
Is it possible to traverse containing of a list this way? for(int nextInt : aList){… }
maybe
Show the method which exists in a DoubleLinkedList and not exist in a SingleLinkedList
Previous()
Last()
Next()
This()
Can we access the element of a set by index?
What relationship class Node and LinkedList have?
A listIterator allows us to access the elements
both forward and backward
backward
neither forward nor backward
forward
Search
Search1
A queue is a ___-in ___-out data structure
first, first
first, last
last, first
last, last
Operating system use ___ to determine which print job should be handled next
queue
stack
order
depth
Two JAVA API implementation of Set and Map are:
tree anf hash
arrayList
int xxx(int x){
if(n==1)return 1; return x*xxx(x-1); }
n!
fibonacci
2^n
.Data structure similar to tree but it doesn't have limitation according to number of parents is?
hash
int xxx(int x, int y, int z){ if(z==1){return 1;} return xxx(x+y,x,z-1); }
trash in function
Explain how interface is like a contract
Class implementing interface must define none of it’s methods
Class implementing interface must define all it’s methods
Class implementing interface must define only one of it’s methods
Class implementing interface must define some of it’s methods
Node of a graph is called?
vertex
edge
root
What is the time complexity of recursive Binary Search algorithm?
Recursive implementation works faster than lopped one
It's possible to implement all recursive algorithms without
Recursive solutions are more beautiful and easy to understands
Set of connections between vertices of a graph is called?
path
What are two important differences between abstract class and actual class? What are the similarities?
Abstract class should have abstract methods. It can’t be instantiated. They both may have actual datafields and methods
Actual class should have abstract methods. It can’t be instantiated. They both may have actual datafields and methods
Abstract class should have actual methods. It can be instantiated. They both may have actual datafields and methods
Actual class should have actual methods. It can be instantiated. They both have not abstract datafields and methods
Abstract class should have not abstract methods. It can be instantiated. They both may have actual datafields and methods
Quicksort is implemented recursively
List four subclasses of RuntimeException: IndexOutOfBounds, Arithmetic, IlegalArgument,
OutputMismatch
InputMismatch
Logarithmic
LegalArgument
IllegalMismatch
What the time complexity of LinearSearch algorithm?
Graph where each edge has a direction is called?
directed
symmetric
unconnected
How protected visibility can be equivalent to public?
If two related classes are in the different package.
If two related classes are in the same package.
If one related class is in the same package.
If two related methods are in the same package.
If two related methods are in the different package.
for(i<n) if(a[i] == item) return i; This algorithm is similar to ...
Linear Search
Binary Search
Huffman tree
Full binary search
Adjacent matrix representing undirected graph should be?
assymmetric
connected
Explain why Shape can not be an actual class
Because it has abstract methods
Because it has actual methods
Because it has not abstract methods
Because it has not actual methods
To use Binary Search items should be ...
ordered
traversed
matched
divorced
Vertex is ________ to another vertex if there is an edge connecting them
adjacent
subling
brotherhood
BFS
Overriding
the different method realized differently in a child class.
the same method realized differently in a child class.
the same method realized samely in a child class.
the same method not realized differently in a child class.
the same method realized differently in a parent class.
.A __________ is a sequence of vertices in which each successive vertex is connected to its predecessor. (Graphs)
cycle
route
weight
Overloading
when number of parameters changed then it will be another method.
when single of parameter changed then it will be another method.
when number of parameters changed then it still will be same method.
A ___________ path is a simple path in which only the first and last items are the same.
trip
mapped
looped
The node of a tree without children is called ...?
leaf
subtree
siding
full
Describe the use of the keywords super. and super(...)?
If you want to call some method of parent class then use super.
If you want to call some method of child class then use super.
If you want to call some method of parent class then use normal.
If you want to call some method of child class then use normal.
If you want to call some method of parent class then do not use super.
.If there is no path path from vertex to any other vertex that graph is considered to be ?
A _______ of a node is a tree whose root is a child of that node
child
What can you say about class Object?
Object is child of all classes in JAVA.
Object is parent of one class in JAVA.
Object is child of one class in JAVA.
Object is parent of all classes in JAVA.
Object is parent of some class in JAVA.
Indicate two ways of graph implementations
list and matrix
hash and list
ArrauList and vector
Tree and map
.A __________ graph is one in which [E] is close to but less than [V]^2.
dense
sparse
cute
bad
Describe the difference between is - a and has - a relationships?
Has - a – parent child relationship Is - a – when one class has another inside itself.
Has - a – parent child relationship Is - a – when all classes have another inside itself.
Is - a – parent child relationship Has - a – when one class has another inside itself.
Is - a – parent child relationship Has - a – when all classes have another inside itself.
A ________ graph is one where [E] is much less than [V]^2.
i don`t know
go home and cry
What is the advantage of specifying an abstract data type as an interface instead of just going ahead and implementing it as a class?
Any class can implement many interface and can not extend more than one class
All classes can implement only one interface and can not extend more than one class
All classes can implement only one interface and can extend more than one class
Any class can implement many interface and can extend more than one class
All class can implement many interface and can extend more than one class
Which of the graph implementation is more efficient in terms of memory usage?
list
The ______ of a node is a measure of its distance from the root
level
distance
sibling
Which of the graph implementations is more simple?
matrix
What are two different uses of a term interface in programming
Interface is a java keyword. Relationship between user and computer (HCI).
Interface is not a java keyword. Relationship between user and computer (HCI).
Interface is a java keyword. Relationship between programm and computer (HCI).
Interface is a not java keyword. Relationship between user and programm (HCI).
Interface is a java keyword. Relationship with user and computer (HCI).
Why do we need BFS and DFS algorithms?
to have fun
to traverse a graph
be aware of collision
Distance from the root to its deepest leaf is knows as ______ of a tree?
height
What do abstract methods and interfaces have in common? How do they differ?
In interface methods are defined. But in abstract classes the abstract methods can be defined to show its default behaviour.
In interface methods are not defined. But in actual classes the abstract methods can be defined to show its default behaviour.
In interface methods are not defined. But in abstract classes the abstract methods can be defined to show its default behaviour.
In interface methods are defined. But in abstract classes the actual methods can be defined to show its default behaviour.
In interface methods are defined. But in abstract classes the abstract methods cannot be defined to show its default behaviour.
Traversing graph visiting a start node first, then all nodes that are adjacent to it next.
DFS
List two subclasses of IOException:
EOFException, FileFoundException
EOFException, FileNotFoundException
SQLException, FileNotFoundException
EOFException, SQLException
Traversing graph visiting a start node first, then choose one node that is adjacent to it next.
Dijkstra's algorithm use ______ algorithm to traverse all nodes.
Explain why Shape can not be an interface
Because it has actual and abstract methods
Graph is considered to be ___________ if there is a path from each vertex to any other vertex.
.In ___________ graph is {v, u} is edge then {u, v} is not necessary an edge
Tree where every item must have at most 2 children is called?
Binary Tree
Unary Tree
Huffman Tree
General Tree
Structured set of data is called _______.
data structure
algorithm
What does encapsulation mean, and how it is used in JAVA?
Encapsulation – unlimiting access to datafields.
Encapsulation is one of the OOPs feature that allows us to perform a single action in different ways.
Encapsulation is one of the OOPs feature that is not allows us to perform a single action in different ways.
Encapsulation – limiting access to datafields.
An ordered set of instructions is called.
model
What is the benefit of encoding letters trough Huffman tree
earning space
it is smart
just for fun
more beautiful
it is simple
Describe the use of the keywords this. and this (...)?
This() – used to get datafields of current class This. – used to call the constructor of current class.
This. – used to get datafields of current class This() – used to call the constructor of current class.
This. – used to call the constructor of current class This() – used to get datafields of current class
This. – used to get datafields of all classes This() – used to call the constructor of current class.
This. – used to get datafields of all classes This() – used to call the constructor of all classes.
Explain the relationship between classes Number, Integer and Short.
Number is child of Integer and Short.
Integer is parent of Number and Short.
Number is parent of Integer and Short.
Short is parent of Number and Integer.
Integer is child of Number and Short.
A tree where left child is less and right child is more than its parent called?
Binary
Breadth first search
Search a binary search tree costs?
The four kinds of visibility in order of decreasing visibility are:
Public, package, protected, private
Private, protected, package, public
Package, private, public, protected
Protected, package, private, public
Private, public, protected, package
What is default package visibility?
Classes in the different package are visible to each other without import.
Classes in the same package are visible to each other without import.
Classes in the same package are not visible to each other without import.
Classes in the different package are not visible to each other without import.
Classes in the same package are invisible to each other without import.
Form of method determined by its name and arguments
Java method
Signature method
Get method
Data method
Set method
A tree where all nodes should have 2 children and leaves have no children is called?
full binary tree
general tree
unary tree
perfect tree
binary tree
An____ specifies the requirements of an ADT as a contract between the____ and ____; A ____ implements the ADT
interface, user, developer, method
implemetation, developer, user, class
interface, developer, user,class
implemetation, user, developer, class
implemetation, developer, user, method
Visit root node, traverses left subtree, traverse right subtree traversal is called?
inorder
postorder
An interface can be implemented by multiple classes -
Traverse left subtree, Visit root node, traverse right subtree traversal is called?
traverse left subtree visit root node traversal is called?
This method of a binary tree class return true if tree is a leaf and false otherwise?
isLeaf()
isEmpty()
noMore()
isLast()
goHome()
Element insertion to a Binary Search tree costs?
Does binary search tree contain duplicates?
go home
Complete binary tree where all children must be smaller than parents is?
maxheap
minheap
hiphop
treeheap
Complete binary tree where all children must be bigger than parents is?
fullheap
Insert and remove items from a heap costs?
O(nxn)
The heap is used to implement the special kind of a queue called priority queue
deap
DBS
A ________ tree is a binary tree used to store a code that facilitates the compression
Huffman
Dijkstra
Data structure based on BST where all items are sorted and unique is?
treeMap
treeSet
Recursive nonlinear data structure that is used to represent data organized in a hierarchy?
linkedList
In a Huffman tree, the item with the lowest frequency of occurrence will have the _____ code.
longest
easiest
shortest
binary
deepest
Which of the following is recursive algorithm?
QuickSort
Insertionsort
Selectionsort
BUBBLESORT
Average time complexity of Selection sort is?
O(n^2,25)
Average time complexity of Heap sort is?
Average time complexity of Quick sort is?