You are on page 1of 10

http://www.psexam.

com (Computer Science Exam Preparation)


http://new.psexm.com (Computer Operator Exam Preparation)
Attempt online MCQ test on Data Structures and Algorithms presented by PS Exam (www.psexam.com).
Visit Data Structures And Algorithms section of PS Exam for more about the topic.
Attempt online MCQ test on Data Structures and Algorithms presented by PS Exam (www.psexam.com). Questions presented here suits the level
for Higher Secondary or Bachelors in Computer Science or BCA, BIT, BSc IT and competitive exams like Computer Officer, IT Officer.
Confused on any question? Check http://data-structures-and-algorithms.psexam.com/dsa-mcq-set-1/ for explanations on these questions.
Visit Data Structures And Algorithms on PS Exam

PSC01
FM: 50

PM: 30

Time: 1 hrs

Attempt All of the following questions. Each question carry equal mark
Total Questions 50

shkhanal
Your Name
Q.1)

6 files X1, X2, X3, X4, X5, X6 have 150, 250, 55, 85, 125, 175 number of records respectively. The order of storage ot optimize
access time is
A.
B.
C.
D.

Q.2)

B.
C.
D.

X1, X3, X2, X4, X5, X6


None of the above

L1,L2
Max(L1,L2)
Min(L1,L2)
L1+L2-1

Average successful search time for sequential search on 'n' item is


A.
B.
C.
D.

Q.4)

X3, X4, X1, X5, X6, X2

Consider two sorted lists of size L1, L2. Number of comparisions needed in worst case my merge sort algorithm will be
A.

Q.3)

X1, X2, X3, X4, X5, X6

n/2
(n-1)/2
(n+1)/2
log (n) + 1

In the following tree:

http://msword.psexam.com (Learning MS Word in PS Exam)


http://cplusplus.psexam.com (C++ Programming Language Tutorial and Exam Preparation)
http://data-structures-and-algorithms.psexam.com (Algorithms and Data Structures Tutorials and Exam Preparation.

http://www.psexam.com (Computer Science Exam Preparation)


http://new.psexm.com (Computer Operator Exam Preparation)
If post order traversal generates sequence xy-zw*+, then label of nodes 1,2,3,4,5,6,7 will be
A.
B.
C.
D.
Q.5)

B.
C.
D.

B.
C.
D.

B.
C.
D.

B.
C.
D.

log (n)
log (n -1)n -1
log (n) + 1

S [Top-n]
S [Top+n]
S [Top-n-1]
None of the above

Bubble sort
Quick sort
Merge sort
Heap sort

Log n
n
n2
nn

On which principle does stack work?


A.
B.
C.
D.

Q.10)

log (n +1) - 1

Time complexity of an algorithm T(n), where n is the input size is given by T(n) = T (n-1) + 1/n, if n>1 otherwise T(n) = 1. The order
of algorithm is
A.

Q.9)

-, x, y, +, *, z, w

To arrange the books of library the best method is


A.

Q.8)

x, y, z, w, -, *, +

In a stack the command to access nth element from the top of the stack S will be
A.

Q.7)

x, -, y, +, z, *, w

Depth of a binary tree with n node is


A.

Q.6)

+, -, *, x, y, z, w

FILO
FIFO
LIFO
Both a and c above

The centricity of node labeled 5 is

http://msword.psexam.com (Learning MS Word in PS Exam)


http://cplusplus.psexam.com (C++ Programming Language Tutorial and Exam Preparation)
http://data-structures-and-algorithms.psexam.com (Algorithms and Data Structures Tutorials and Exam Preparation.

http://www.psexam.com (Computer Science Exam Preparation)


http://new.psexm.com (Computer Operator Exam Preparation)

A.
B.
C.
D.
Q.11)

B.
C.
D.

B.
C.
D.

bubble sort
selection sort
insertion sort
merge sort

2.15
3.01
2.3
1.78

A queue has configuration a,b,c,d. To get configuration d,c,b,a. One needs a minimum of
A.
B.
C.
D.

Q.14)

A text is made up of five characters, T1, T2, T3, T4, T5. The probability of occurance of each character is .12, .4, .15, .88 and .25,
respectively. The optimal coding technique will have average length of
A.

Q.13)

Arranging a pack of cards by picking one by one is an example of


A.

Q.12)

2 deletion and 3 additions


3 deletions and 2 additions
3 deletions and 3 additions
3 deletions and 4 additions

A hash tabale with 10 buckets with one slot per bucket is depicted in following diagram. Symbols S1 to S7 are initially entered
using a hashing function with linear probing. Maximum number of comparisions needed in searching an item that is not present is

http://msword.psexam.com (Learning MS Word in PS Exam)


http://cplusplus.psexam.com (C++ Programming Language Tutorial and Exam Preparation)
http://data-structures-and-algorithms.psexam.com (Algorithms and Data Structures Tutorials and Exam Preparation.

http://www.psexam.com (Computer Science Exam Preparation)


http://new.psexm.com (Computer Operator Exam Preparation)

A.
B.
C.
D.
Q.15)

B.
C.
D.

B.
C.
D.

B.
C.
D.

3
Junk value
Run time error
Address of the third element

Max(f(n),g(n))
Min(f(n),g(n))
f(n)+g(n)
f(n)*g(n)

constant
linear
logarithmic
exponential

A binary tree in which every non-leaf node has non-empty left and right sub trees is called a strictly binary tree. Such a tree with 10
leaves
A.
B.
C.
D.

Q.19)

The order of an algorithm that finds whether a given boolean function of 'n' variable produces a '1' is
A.

Q.18)

An algorithm consists of two modules X1, X2. Their order is f(n) and g(n), respectively. The order of algorithm is
A.

Q.17)

Write the output of following program:


int a[ ] = {1,2,3,} *p;
A.

Q.16)

Has 19 nodes
Has 16 nodes
Has 15 nodes
None of the above

Average successful search time taken by binary search on sorted array of 10 items is

http://msword.psexam.com (Learning MS Word in PS Exam)


http://cplusplus.psexam.com (C++ Programming Language Tutorial and Exam Preparation)
http://data-structures-and-algorithms.psexam.com (Algorithms and Data Structures Tutorials and Exam Preparation.

http://www.psexam.com (Computer Science Exam Preparation)


http://new.psexm.com (Computer Operator Exam Preparation)
A.
B.
C.
D.
Q.20)

2.6
2.7
2.8
2.9

If the address of (I,J)th entry, in dope vector representation, where it stores the position of first and last non-zero entries of each
row is given by C, assume l(n) and f(n) represent the last and first non-zero entries in row x

i.

ii.

iii.

iv.
A.
B.
C.
D.
Q.21)

Correct answer is (i)


Correct answer is (ii)
Correct answer is (iii)
Correct answer is (iv)

If the out degree of every node is exactly equal to M or 0 and the num ber of nodes at level K is Mk-1 [con
sider root at level 1], then tree is called as
(i) Full m-ary try
(ii) Com plete m-ary tree
(iii)Positional m-ary tree

A.
B.
C.
D.
Q.22)

Only (i)
Only (ii)
Both (i) and (ii)
Both (ii) and (III)

Running time T(n), where 'n' is input size of recursive algorithm is given as follows:
T(n) = c + T(n-1), if n>1,
T(n) = d if n<1. The order of algorithm is
A.
B.
C.

n2
n
n3

http://msword.psexam.com (Learning MS Word in PS Exam)


http://cplusplus.psexam.com (C++ Programming Language Tutorial and Exam Preparation)
http://data-structures-and-algorithms.psexam.com (Algorithms and Data Structures Tutorials and Exam Preparation.

http://www.psexam.com (Computer Science Exam Preparation)


http://new.psexm.com (Computer Operator Exam Preparation)
D.
Q.23)

Q.24)

In evaluating arithmatic expression 2*3-(4+5) using postfix stack form. Which of the following stack configuration is not possible
A.

-----------|4|6|
------------

B.

-----------|5|4|6|
------------

C.

-----------|9|6|
------------

D.

-----------|9|3|2|
------------

Number of swapping, operations need to sort numbers 8, 22, 7, 9, 31, 19, 5, 13 in ascending order using bubble sort
A.
B.
C.
D.

Q.25)

B.
C.
D.

B.
C.
D.

13
14

16
12
6
10

It decides the best algorithm to solve a problem


It determines maximum size of a problem, that can be solved in given system in given time
It is the lower bound of growth rate of algorithm
None of the above

In which of the following cases linked list implementaion of sparse matrices consumes same memory as a normal array
A.
B.
C.
D.

Q.28)

12

Bib O notation w.r.t algorithm signifies


A.

Q.27)

11

Number of possible ordered trees with 3 nodes A,B,C is


A.

Q.26)

nn

5 x 6 matrix with 9 non-zero entries


5 x 6 matrix with 8 non-zero entries
6 x 5 matrix with 8 non-zero entries
6 x 5 matrix with 9 non-zero entries

In linked lists there are no NULL links in


A.
B.
C.

Single linked list


Linear doubly linked list
Circular linked list

http://msword.psexam.com (Learning MS Word in PS Exam)


http://cplusplus.psexam.com (C++ Programming Language Tutorial and Exam Preparation)
http://data-structures-and-algorithms.psexam.com (Algorithms and Data Structures Tutorials and Exam Preparation.

http://www.psexam.com (Computer Science Exam Preparation)


http://new.psexm.com (Computer Operator Exam Preparation)
D.
Q.29)

A.
B.
C.
D.
Q.30)

B.
C.
D.

B.
C.
D.

B.
C.
D.

B.
C.
D.

n2
nn
n3
n

O(n logn)
O(2n)
O(n2)
None of above

Conceptually easier
Completely dynamic
Efficient in accessing an entry
Efficient if the sparse matr4ix is a band matrix

A1
A2
A3
A4

To arrange a binary tree in ascending order we need


A.
B.
C.
D.

Q.35)

2,1,2,2,2

Four altorithm A1, A2, A3, A4 solves a problem with order log(n), log log(n), nlog(n), n. Which is best algorithm
A.

Q.34)

2,1,2,2,1

The advantage of sparse matrix linked list representationn over dope vector method is, that the former is
A.

Q.33)

2,2,1,1,2

The total number of comparisons in a bubble sort is


A.

Q.32)

2,2,1,2,2

Running time of an algorithm T(n), where n is input size is given by T(n) = 8 T(n/2) + qn, if n>1 T(n) = p, if, n=1 where p and q are
constants. The order of algorithm is
A.

Q.31)

None of these

Following sequence of operation is performed on a stack. Push(1), Push(2), Pop, Push(1), Push(2), Pop, Pop, Pop, Push(2), Pop.
The sequences of popped out values are

post order traversal


inorder traversal
preorder traversal
none of above

The dummy header in linked list contain


A.

First record of the actual data

http://msword.psexam.com (Learning MS Word in PS Exam)


http://cplusplus.psexam.com (C++ Programming Language Tutorial and Exam Preparation)
http://data-structures-and-algorithms.psexam.com (Algorithms and Data Structures Tutorials and Exam Preparation.

http://www.psexam.com (Computer Science Exam Preparation)


http://new.psexm.com (Computer Operator Exam Preparation)
B.
C.
D.
Q.36)

B.
C.
D.

B.
C.
D.

B.
C.
D.

B.
C.
D.

5
6

Dijkastra's algorithm
Floyd's algorithm
Prim's algorithm
Worshal's algorithm

150
140
55
None of the above

Internal sorting is used, if number of items to be sorted is very large


External sorting is used, if number of items to be sorted is very large
External sorting needs auxiliary storage
Internal sorting needs auxuliary storage

In a balance binary tree the height of two sub trees of every node can not differ by more than
A.
B.
C.
D.

Q.41)

Which of the following is correct


A.

Q.40)

In above question average access time will be


A.

Q.39)

None of above

Which algorithm solves all pair shortest path problem


A.

Q.38)

Pointer to the last record of the actual data

Hash function f is defined as f(key) = key mod 7. If linear probing is used to insert the key 37, 38, 72, 48, 98, 11, 56 into a table
indexed from 0 to 6, 11 will be stored at the location
A.

Q.37)

Last record of the actual data

2
1
0
3

Which of the following algorithm has n log (n) time complexity


A.
B.
C.
D.

Heap sort
Quick sort
Insertion sort
Selection sort

http://msword.psexam.com (Learning MS Word in PS Exam)


http://cplusplus.psexam.com (C++ Programming Language Tutorial and Exam Preparation)
http://data-structures-and-algorithms.psexam.com (Algorithms and Data Structures Tutorials and Exam Preparation.

http://www.psexam.com (Computer Science Exam Preparation)


http://new.psexm.com (Computer Operator Exam Preparation)
Q.42)

In array representation of binary tree teh right child of root will be at location of
A.
B.
C.
D.

2
5
3
0

Q.43)
The information about an array used in a program will be stored in
A.
B.
C.
D.
Q.44)

B.
C.
D.

B.
C.
D.

B.
C.
D.

0
5
10
15

Stable
Consistent
External
Linear

xxx
yyy
zzz
Can not be determined

The order of binary search algorithm is


A.
B.
C.
D.

Q.48)

Activation table

If yyy, xxx and zzz are the elements of a lexically ordered binary tree, then in preorder traversal which node will be traverse first
A.

Q.47)

Register vector

A sorting technique which guarrantees that records with same primary key occurs in the sorted list as in the original unsorted list
is said to be
A.

Q.46)

Dope vector

The result of evaluating prefix expression */b+0dacd, where a=3, b=6, c=1, d=5 is
A.

Q.45)

Symbol table

n
n2
n log n
log n

If running time of an algorithm is given by T(n) = T(n-1) + T(n-2) + T(n-3), if n>3 otherwise T(n)=n, what should be relation between
T(1), T(2), T(3) where algorithm order become constant
A.
B.

T(1)=T(2)=T(3)
T(1) + T(2) = 2T2

http://msword.psexam.com (Learning MS Word in PS Exam)


http://cplusplus.psexam.com (C++ Programming Language Tutorial and Exam Preparation)
http://data-structures-and-algorithms.psexam.com (Algorithms and Data Structures Tutorials and Exam Preparation.

http://www.psexam.com (Computer Science Exam Preparation)


http://new.psexm.com (Computer Operator Exam Preparation)
C.
D.
Q.49)

T(1) + T(2) = T(3)

If the following tree is used for sorting, then a new number 10 should be placed at

A.
B.
C.
D.
Q.50)

T(1) - T(3) = T(2)

Right child of node labeled 7


Left child of node labeled 7
Left child of node labeled 14
Right child of node labeled 8

The average number of comparisions performed by merge sort alrotithm in merging two sorted list of length 2 is
A.
B.
C.
D.

8/3
8/5
11/7
11/6

http://msword.psexam.com (Learning MS Word in PS Exam)


http://cplusplus.psexam.com (C++ Programming Language Tutorial and Exam Preparation)
http://data-structures-and-algorithms.psexam.com (Algorithms and Data Structures Tutorials and Exam Preparation.

You might also like