DS MCQs
DS MCQs
DS MCQs
The statement that transfers control to the beginning of the loop is called
A. Break statement
B. Exit statement
C. Continue statement
D. Goto statement
Answer C
The language that the computer can understand and execute is called
A. Machine Language
B. Application Software
C. System Program
D. Assembly language
Answer A
The keyword used to transfer control from a function back to the calling function
is
A. Switch
B. Goto
C. Go back
D. Return
Answer D
The __________ statement causes immediate exit from the loop overriding the
condition test
A. Exit
B. Break
C. Goto
D. None of the above
Answer B
The C language includes the header file standard input & output in
A. stdlib.h library
B. stdio.h library
C. conio.h library
D. #include library
Answer B
Consider the following recursive C function that takes two arguments.
unsigned int foo(unsigned int n,unsigned int r)
{ if(n>0)
return((n%r)+foo(n/r,r));
else
return 0;
}
What is value of function foo when it called as foo(512,2)?
A. 9
B. 2
C. 8
D. 11
Answer B
A Compiler is _____________________.
A. A combination of computer hardware
B. A program which translates from one high-level language to another
C. A program which translates from one high-level to a machine level
D. None of these
Answer C
A binary tree in which if all its levels except possibly the last, have the maximum
number of nodes and all the nodes at the last level appear as far left as possible,
is known as
A. Full binary tree
B. AVL tree
C. Threaded tree
D. Complete binary tree
Answer A
Which allows deletion at only one end of the list but allows insertion at both ends
of the list?
A. Deque
B. Circular queue
C. Output restricted deque
D. Input restricted deque
Answer C
The _______ operator is a technique to forcefully convert one data type to the
others
A. Cast
B. Conversion
C. Type
D. Unary
Answer A
A binary tree whose every node has either zero or two children is called
A. Complete binary tree
B. Binary search tree
C. Extended binary tree
D. None of above
Answer C
Which data structure allows deleting data elements from front and inserting at
rear?
A. Stacks
B. Queues
C. Deques
D. Binary search tree
Answer B
A binary tree in which if all its levels except possibly the last, have the maximum
number of nodes and all the nodes at the last level appear as far left as possible,
is known as
A. Full binary tree
B. AVL tree
C. Threaded tree
D. Complete binary tree
Answer A
What is the correct value to return to the operating system upon the successful
completion of a program?
A. -1
B. 1
C. 0
D. Programs do not return a value.
Answer C
The control automatically passes to the first statement after the loop in
A. Continue statement
B. Break statement
C. Switch statement
D. If statement
Answer B
Answer A
Which of the following was not associated with second generation computers?
A. High level procedural language
B. Operating system
C. Magnetic core and transistor
D. All of the above were associated
Answer D
A linear list of elements in which deletion can be done from one end (front) and
insertion can take place only at the other end (rear) is known as a
A. Queue
B. Stack
C. Tree
D. Linked list
Answer A
An array of pointers is same as
A. Pointer to array
B. Pointers to pointers
C. Pointer to function
D. Pointer to structure
Answer B
A linear list of elements in which deletion can be done from one end (front) and
insertion can take place only at the other end (rear) is known as a
A. Queue
B. Stack
C. Tree
D. Linked list
Answer A
Let the following circular queue can accommodate maximum six elements with the
following data
front = 2 rear = 4
queue = _______; L, M, N, ___, ___
What will happen after ADD O operation takes place?
A. front = 2 rear = 5
queue = ______; L, M, N, O, ___
B. front = 3 rear = 5
queue = L, M, N, O, ___
C. front = 3 rear = 4
queue = ______; L, M, N, O, ___
D. front = 2 rear = 4
queue = L, M, N, O, ___
Answer A
What data structure would you mostly likely see in a nonrecursive implementation of
a recursive algorithm?
A. Stack
B. Linked list
C. Queue
D. Trees
Answer A
Answer A
What will be the output of the following program?
main()
{
int i = 5;
printf(%d, i=++i==6);
}
A. 0
B. 1
C. 7
D. 6
Answer B
Answer C
Answer A
Which of the following data structure is non-linear type?
A. Strings
B. Lists
C. Stacks
D. None of above
Answer D
Answer C
Answer B
Which of the following storage devices can store maximum amount of data?
A. Floppy Disk
B. Hard Disk
C. Compact Disk
D. Magneto Optic Disk
Answer B
Consider the following recursive C function that takes two arguments. unsigned int
foo(unsigned int n,unsigned int r) { if(n>0)return((n%r)+foo(n/r,r)); else return
0; } What is value of function foo when it called as foo(342,10)?
A. 11
B. 12
C. 3
D. 6
Answer B
A linear collection of data elements where the linear node is given by means of
pointer is called
A. Linked list
B. Node list
C. Primitive list
D. None of these
Answer A
If a node having two children is deleted from a binary tree, it is replaced by its
A. Inorder predecessor
B. Inorder successor
C. Preorder predecessor
D. None of the above
Answer B
The process of production of customer list in alphabetical order falls under the
category of
A. Editing
B. Sorting
C. Updating
D. Calculating
Answer B
The statement which is used to terminate the control from the loop is
A. Break
B. Continue
C. Goto
D. Exit
Answer A
The expression P >> 6 shifts all bits of P six places to right. What is the value
of P >> 6 if P 0.6db7 ?
A. 0.1234
B. 0.0001
C. 0.0000
D. 0.1B6
Answer D
Answer C
Literal means
A. A string
B. A string constant
C. A character
D. An alphabet
Answer B
The value of an automatic variable that is declared but not initialised will be
A. 0
B. -1
C. Unpredictable
D. None of these
Answer C
A language in which a statement in a loop that run 100 times and is decoded 100
times is
A. BASIC
B. FORTAN
C. COBAL
D. PASCAL
Answer A
Answer C
A linear collection of data elements where the linear node is given by means of
pointer is called
A. Linked list
B. Node list
C. Primitive list
D. None of these
Answer A
A sort which relatively passes through a list to exchange the first element with
any element less than it and then repeats with a new first element is called
A. Insertion sort
B. Selection sort
C. Heap sort
D. Quick sort
Answer D
A. Stack
B. Queue
C. List
D. Heap
Answer B
You have to sort a list L consisting of a sorted list followed by a few random
elements.Which of the following sorting methods would be especially suitable for
such a task?
A. Bubble sort
B. Selection sort
C. Quick sort
D. Insertion sort
Answer D
The statement which is used to terminate the control from the loop is
A. Break
B. Continue
C. Goto
D. Exit
Answer A
________ unit controls the flow and manipulation of data and information.
A. Arithmetic logic
B. Central
C. Middle
D. Control
Answer D
Answer B
C is often called
A. Object oriented language
B. High level language
C. Assembly language
D. Machine level language
Answer B
Usually, an algorithm will contain a number of procedural steps which are dependent
on results of previous steps and is called _______________.
A. Flowchart
B. Chart
C. Drawing Chart
D. Food Chart
Answer A
Linked lists are not suitable data structures for which one of the following
problems
A. Insertion sort
B. Binary search
C. Radix sort
D. Polynomial manipulation
Answer B
A template stores
A. Styles, macros
B. Auto Text entires, Customized word command Settings
C. Graphics, text
D. All of the above
Answer A
A complete binary tree with the property that the value at each node is atleast as
large as the values at its children is called
A. Binary search tree
B. AVL tree
C. Completely balanced tree
D. Heap
Answer D
In addition to communicating with I/O, the processor must communicate with the
______________ unit.
A. Control
B. Memory
C. Arithmetic
D. Process
Answer B
A BST is traversed in the following order recursively: Right, root, left.The output
sequence will be in
A. Ascending order
B. Descending order
C. Bitomic sequence
D. No specific order
Answer B
A self contained block of statements that perform a coherent task of some kind is
called a
A. Monitor
B. Function
C. Program
D. Structure
Answer B
The directive that can be used to test whether an expression evaluates to a nonzero
value or not is
A. #if
B. #elif
C. #endif
D. #exit
Answer A
What will happen if in a C program you assign a value to an array element whose
subscript exceeds the size of array?
A. The element will be set to 0.
B. The compiler would report an error.
C. The program may crash if some important data gets overwritten.
D. The array size would appropriately grow.
Answer C
Answer A
If a node in a BST has two children, then its inorder predecessor has
A. No left child
B. No right child
C. Two children
D. No child
Answer B
What data structure would you mostly likely see in a non recursive implementation
of a recursive algorithm?
A. Stack
B. Linked list
C. Queue
D. Trees
Answer A
Identify the data structure which allows deletions at both ends of the list but
insertion at only one end.
A. Input-restricted deque
B. Output-restricted deque
C. Priority queues
D. None of above
Answer A
Set of values of the same type, which have a single name followed by an index is
called
A. Function
B. Structure
C. Array
D. Union
Answer C
Which one of the following permutations can be obtained the output using stack
assuming that the input is the sequence 1,2,3,4,5 in that order ?
A. 3,4,5,1,2
B. 3,4,5,2,1
C. 1,5,2,3,4
D. 5,4,3,1,2
Answer: B
The initial configuration of the queue is a,b,c,d (a is the front end). To get the
configuration d,c,b,a one needs a minimum of ?
A. 2 deletions and 3 additions
B. 3 additions and 2 deletions
C. 3 deletions and 3 additions
D. 3 deletions and 4 additions
Answer: C
Linked list are not suitable data structure of which one of the following
problems ?
A. Insertion sort
B. Binary search
C. Radix sort
D. Polynomial manipulation
Answer: B
The number of possible ordered trees with three nodes A,B,C is?
A. 16
B. 12
C. 6
D. 10
Answer: B.
Which of the following algorithm design technique is used in the quick sort
algorithm?
A. Dynamic programming
B. Backtracking
C. Divide and conquer
D. Greedy method
Answer: C
Which of the following algorithm design technique is used in the quick sort
algorithm?
A. Dynamic programming
B. Backtracking
C. Divide and conquer
D. Greedy method
Answer: C
You can make telephone calls over the Internet using a technology called
A. Intertel
B. Telenet
C. VoIP
D. VoRP
Answer: c
What is the result of the following operation Top (Push (S, X))
A. X
B. null
C. s
D. none of these
Answer: A
The number of binary trees with 3 nodes which when traversed in post order gives
the sequence A,B,C is ?
A. 3
B. 9
C. 7
D. 5
Answer: D
The average search time of hashing with linear probing will be less if the load
factor?
a. is far less than one
b. equals one
c. is far greater than one
d.None of the above
Answer: a
Which of the following algorithm solves the all pair shortest path problem?
a. Djikstras algorithm
b. Floyds algorithm
c. Prims algorithm
d. Warshalls algorithm
Answer: b
As part of maintenance work, you are entrusted with the work of rearranging the
library books in a shelf in proper order, at the end of each day. The ideal choice
will be?
a. Bubble sort
b. Insertion sort
c. Selection sort
d. Heap sort
Answer: b
The way a card game player arrange his cards as he picks them up one by one, is an
example?
a. Bubble sort
b. Selection sort
c. Insertion sort
d. Merge sort
Answer: c
The average successful search time for sequential search on n items is?
a. n/2
b. (n-1)/2
c. (n+2)/2
d. Log(n)+1
Answer: c
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?
a. 2,2,1,1,2
b. 2,2,1,2,2
c. 2,1,2,2,1
d. 2,1,2,2,2
Answer: a
A machine took 200 sec to sort 200 names, using bubble sort. In 800 sec, it can
approximately sort?
a. 400 names
b. 800 names
c. 750 names
d. 800 names
Answer: a
A machine needs a minimum of 100sec to sort 1000 names by quick sort. The minimum
time needed to sort 100 names will be approximately?
a. 50.2sec
b. 6.7sec
c. 72.7sec
d. 11.2sec
Answer: b
The number of binary trees with 3 nodes which when traversed in post order gives
the sequence A,B,C is?
a. 3
b. 9
c. 7
d. 5
Answer: d
The average search time of hashing with linear probing will be less if the load
factor?
a. Is far less than one
b. Equals one
c. Is far greater than one
d. None of the above
Answer: a
A binary tree that has n leaf nodes. The number of nodes of degree 2 in this tree
is?
a. Log2n
b. N-1
c. N
d. 2n
Answer: b