Which of the following algorithms solves the all pair shortest path problem?
Diskstra’s algorithm
Floyd algorithm
Prim’s algorithm
Warshall’s algorithm
The minimum number of colors required to color a graph having n (n>3) vertices and 2 edges is
4
3
2
1
The maximum degree of any vertex in a simple graph with n vertices is
n
n-1
n+1
2n-1
A graph G with n nodes is bipartite if it contains
n edges
a cycle of odd length
no cycle of odd length
n2 edges
A graph can be represented as an _ _ _ _ _ _
Linked list
Structure
Union
Queue
A graph can be represented as an _ _ _ _ _ _
Array
Structure
Union
Queue
The minimum number of edges in a connected cyclic on n vertices is
n-1
n
n+1
n+2
Which of he following is useful in traversing a given graph by breadth first search?
Stack
Set
List
Queue
Sparse matrices have
many zero entries
many non-zero entries
higher dimensions
lower dimensions
The maximum no.of edges in an undirected graph with out loops with n vertices is
n
n*(n-1)
n*(n-1)/2
n-1
Which of the following abstract data types can be used to represent a many to many relationship
tree
graph
queue
stack
In a directed graph without self loops with n verices , the maximum no.of edges is
n
n*(n-1)
n*(n-1)/2
n-1
An n vertex undirected graph with exactly n*(n-1)/2 edges is said to be
Complete graph
Un complete graph
Directed graph
Un directed graph
To create a node dynamically in a singly linked list _ _ function in C is used
malloc()
calloc()
alloc()
dealloc()
In an undirected graph, the sum of degrees of all the nodes
must be even
is thrice the number of edges
must be odd
need not be even
In an undirected graph, the sum of degrees of all the nodes
is thrice the number of edges
is twice the number of edges
must be odd
need not be even
_ _ _ function is used to in C to dynamically allocate space for more than one object
malloc()
calloc()
alloc()
dealloc()
_ _ _ function is used to in C to dynamically allocate space for one object
malloc()
calloc()
alloc()
dealloc()
If n=2, then the value of O(n log n) is
2
4
8
16
Calloc(m,n); is equivalent to
malloc(m*n,0);
memset(0,m*n);
ptr=malloc(m*n);memset(p,0,m*n)
ptr=malloc(m*n);strcpy(p,0)
If the sequence of operations push(1),push(2) ,pop, push(1),push(2),pop, pop, pop, push(2),pop, are performed on a stack, the sequence of popped out values are
2,2,1,1,2
2,2,1,2,2
2,1,2,2,1
2,1,2,2,2
return type of a realloc( ) function is
int
float
char
void
To delete an element from a queue we use the _ _ _ _ _ operation
pop
push
enqueue
dequeue
To add an element to a queue we use the _ _ _ _ _ operation
pop
push
enqueue
dequeue
Which of the memory function allocates a contiguous memory
malloc( )
calloc( )
release( )
free( )
Return type of a malloc( ) function is
int
float
char
void
A queue is a _ _ _ _ _ _ structure
first in-last out
lasting-first-out
first in-first out
last in-last out
A queue is a list in which insertion can be done _ _ _ _
any where in the list
only at the beginning
only at the end
only at the middle
A _ _ _ _ _ _ is a first in – last out(FIFO) data structure in which insertions are restricted to one end, called the rear, and deletions are restricted to another end ,called the front
Stack
queue
tree
binary tree
The pointer(s) in a queue points to
start of the queue
end of the queue
middle of the queue
both start and end of the queue
The disadvantage of the queue is
when the item is deleted, the space for that item is not claimed
when the item is deleted, the space for that item is claimed
a non destructive
increases the memory space
A queue is a list in which deletion can be done _ _ _ _
any where in the list
only at the beginning
only at the end
only at the middle
Read() operation in queue is
non-destructive
additive
push()
destructive
In which of the data structure, space for the item is not claimed ,when an item is deleted
queue
circular queue
stack
linked list
As the items from a queue get deleted, the space for item is not reclaimed in queue. This problem is solved by
circular queue
stack
linked list
doubly linked list
Which of the following operation is used to add an item in a queue
write()
read()
pop()
push()
_ _ _ _ no.of pointers are required to implement read and write operations in a queue
two
three
four
five
FIFO is
stack
queue
linked list
tree
Which of the following operation is used to an item in a queue
write()
read()
pop()
push()
The number of swapping needed to sort the numbers 8,22,7,9,31,19,5,13 in an ascending order, using bubble sort is
11
12
13
14
Given two sorted list of size ‘m’ and ‘n’ respectively. The number of comparisons needed by the merge sort algorithm will be
m x n
maximum of m,n
minimum of m,n
m+n-1
For merging two sorted lists of sizes m and n into a sorted list of size m+n, requires _ _ _ _ _ _ _ _ no.of comparisons
O(m)
O(n)
O(m+n)
O(log(m)+log(n))
The principle of locality justifies the use of
interrupts
DMA
polling
cache memory
The concatenation of two lists is to be performed in O(1) time. Which of the following implementations of a list could be used?
Singly linked list
Doubly linked list
Circularly doubly linked list
Array implementation of list
The initial condition of a queue is
front=rear=-1
front=rear
front=rear=n
front=rear=1
A sorting technique that guarantees , that records with the same primary key occurs in the same order in the sorted list as in the original unsorted list is said to be
stable
consistent
external
linear
The average number of comparisons performed by the merge sort algorithm , in merging two sorted lists of length 2 is