41
Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2012 PATTERN , U.O.P. UNIT-2 Marks distribution for Unit 2 4 + 4 +2 +1 +1+1 = 13 Marks (Only 2 Question will be asked  for 4 marks , 1 Questions will be asked for 2 Marks , 3 Questions will be asked for 1 Marks )  Syllabus for Unit-2 Programming using Trees and Graphs Programming using Trees and Graphs Concept of stack & Queue data structure, Types of Queue, Programmer’s perspective of a tree, binary tree and its properties, representation using sequential and linked organization, Full and complete binary trees, Algorithm for converting tree to binary tree, Binary tree traversal: BFS, DFS (non-recursive and recursive), infix, prefix, postfix, Huffman’s codes. Binary search trees and operations: BST as ADT, Threaded Binary Tree, Insertion and deletion of nodes in a threaded binary tree, pre-order, in-order and post-order traversal of threaded binary tree, Algorithmic applications of binary trees: Gaming, Expression and decision trees, Analysis of algorithms Reference Book. “E. Horowitz S. Sahani, D. Mehata, “Fundamentals of data structures in C++”, Galgotia Book Source, New Delhi, 1995, ISBN: 16782983 R. Gilberg, B. Forouzan, “Data Structures: A pseudo code approach with C++”, Cengage Learning Practical Assignment Based on Unit-2 1. A Vegetable and Fruit Mall wants to organize its vegetables and fruit products in a combination of purchase pattern of customers. Solve the problem by suggesting appropriate data structures. Design necessary class. 2. Write a program using object oriented programming features to implement Doubly circular linked list with different manipulation facilities in C++. 3. Write a modular program using object oriented programming features to implement primitive operations on of Queues using Java Frame/Applet. 4. Write a program using object oriented programming using C++ to create a binary tree if inorder& preorder or inorder & postorder any two traversals are given. 5. Write a C++ program to implement traversals on Threaded Binary Tree using object oriented programming features. Design necessary class. 6. Write a program to find shortest path for given source & destination of a given graph using C. 7. Write a C program to generate optimal Binary Search Tree for given data. 8. Tic-Tac- Toe gaming application using C++ Programming. 9. Binary tree traversals BFS & DFS using Python classes. 10. Write a program to create a binary tree if pre-order & post-order traversals are given in JAVA. 11. Write binary search program using multi-threading in Java programming. 12. Write Tree Traversal Program using Java programming. Note:- Highlighted questions belongs to Unit 1 mistakenly they printed in Unit 2 DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .    

UNIT2 Marks distribution for Unit 2 Syllabus for Unit2 · Marks distribution for Unit 2 ... BFS, DFS (nonrecursive and ... Write a program using object oriented programming features

  • Upload
    doananh

  • View
    215

  • Download
    1

Embed Size (px)

Citation preview

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

UNIT­2Marks distribution for Unit 2

4 + 4 +2 +1 +1+1 = 13 Marks (Only 2 Question will be asked  for 4 marks , 1 Questions will be asked for 2 Marks ,

3 Questions will be asked for 1 Marks ) 

 Syllabus for Unit­2 

Programming using Trees and Graphs

Programming using Trees and Graphs Concept of stack & Queue data structure, Types of Queue, Programmer’s perspective of a tree, binary tree and its   properties,   representation   using   sequential   and   linked   organization,   Full   and   complete   binary   trees, Algorithm for converting tree to binary tree, Binary tree traversal: BFS, DFS (non­recursive and recursive),  infix, prefix, postfix, Huffman’s codes. Binary search trees and operations: BST as ADT, Threaded Binary Tree,  Insertion and deletion of nodes in a threaded binary tree, pre­order, in­order and post­order traversal of threaded binary   tree,   Algorithmic   applications   of   binary   trees:   Gaming,   Expression   and   decision   trees,   Analysis   of algorithmsReference Book. 

• “E. Horowitz S. Sahani, D. Mehata, “Fundamentals of data structures in C++”, Galgotia Book Source,  

New Delhi, 1995, ISBN: 16782983

• R. Gilberg, B. Forouzan, “Data Structures: A pseudo code approach with C++”, Cengage Learning

Practical Assignment Based on Unit­2 

1. A Vegetable and Fruit Mall  wants to organize its vegetables and fruit products in a combination of  

purchase pattern of customers.  Solve the problem by suggesting appropriate data structures.  Design 

necessary class.

2. Write a program using object oriented programming features to implement Doubly circular linked list 

with different manipulation facilities in C++.

3. Write a modular program using object oriented programming features to implement primitive operations 

on of Queues using Java Frame/Applet.

4. Write  a  program using object  oriented programming using C++ to  create a  binary   tree   if   inorder& 

preorder or inorder & postorder any two traversals are given.

5. Write   a   C++   program   to   implement   traversals   on   Threaded   Binary   Tree   using   object   oriented 

programming features. Design necessary class.

6. Write a program to find shortest path for given source & destination of a given graph using C.

7. Write a C program to generate optimal Binary Search Tree for given data.

8. Tic­Tac­ Toe gaming application using C++ Programming.

9. Binary tree traversals BFS & DFS using Python classes.

10. Write a program to create a binary tree if pre­order & post­order traversals are given in JAVA.

11. Write binary search program using multi­threading in Java programming.

12. Write Tree Traversal Program using Java programming.

Note:­ Highlighted questions belongs to Unit 1 mistakenly they printed in Unit 2 

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .1    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

M.C.Q. Bank for unit 2Id Keep it blank

Question The number of leaf nodes in a complete binary tree of depth is

A 2^d

B 2^(d+1)­1

C 2^(d­1)­1

D 2^d+1

Answer A

Marks 2

Unit 2

Id Keep it blank

Question To arrange a binary tree in ascending order we need

A Post­order traversal

B In­order traversal

C Pre order traversal

D None of these

Answer B

Marks 2

Unit 2

Id Keep it blank

Question When converting binary tree into extended binary tree, all the original nodes in binary tree are

A internal nodes on external tree

B external nodes on extended tree

C Vanished on extended tre

D None of the above

Answer A

Marks 2

Unit 2

Id Keep it blank

Question A BST is traversed in the following order recursively: Right, root, Left. The output sequence will be in

A Ascending order

B Biometric sequence

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .2    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

C Descending order

D No specific order

Answer C

Marks 2

Unit 2

Id Keep it blank

Question Which of the following statements is false ?

A Every tree is a bipartite

B A tree contains a cycle

C A tree with n nodes contains n­1 edges

D A tree is a connected graph

Answer B

Marks 2

Unit 2

Id Keep it blank

Question Which of the following remarks about Tree­indexing are true

A It is an m­array tree

B Successful searches should terminate in leaf nodes

C Unsuccessful searches may terminate in leaf nodes level of the tree structure

D All of these

Answer D

Marks 2

Unit 2

Id Keep it blank

Question 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 called

A full binary tree

B Binary search tree

C Threaded binary tree

D Complete binary tree

Answer D

Marks 2

Unit 2

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .3    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Id Keep it blank

Question A complete binary tree with the property that the value at each node is at least as large as the values at its children is called

A Binary search tree

B Binary tree

C Complete Balanced Tree

D Heap

Answer D

Marks 2

Unit 2

Id Keep it blank

Question A full binary tree with n leaves contain

A n nodes.

B log2n nodes

C 2n­1 nodes

D 2n+1 nodes

Answer C

Marks 2

Unit 2

Id Keep it blank

Question The recurrence relation that arises in relation with the complexity of binary search is

A T(n)=T(n/2)+k, where k is constant

B T(n)=2T(n/2)+k, where k is constant

C T(n)=T(n/2)+log(n)

D T(n)=T(n/2)+n

Answer Correct option A

Marks 2

Unit 2

Id Keep it blank

Question In the given binary tree, the number of terminal nodes is

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .4    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

A 3

B 5

C 4

D 6

Answer B

Marks 2

Unit 2

Id Keep it blank

Question Suppose we convert a binary tree into an extended binary tree, then nodes in the original tree T becomes _________ nodes in the extended tree.

A Dead

B Internal

C External

D Leaf

Answer B

Marks 2

Unit 2

Id

Question Keep it blank

A The average running time to search an item in the binary search tree is proportional 

B n

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .5    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

C log2 n

D log2 n2

Answer n2

Marks B

Unit 4

Id Keep it blank

Question

The above tree is       1. Strictly binary tree     2. Not a strictly binary tree  3. Almost complete binary tree   4. Complete binary tree

A 1 and 3

B Only 3

C Only 4

D 2 and 4

Answer D

Marks 2

Unit 2

Id Keep it blank

Question The almost complete binary tree with 7 nodes has depth

A 2

B 3

C 7

D Data insufficient

Answer A

Marks 2

Unit 2

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .6    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Id Keep it blank

Question 1.Preorder  a)Left­node­right(LNR)2.Inorder     b)Node­left­right(NLR)3.Postorder c)Left­right­node(LRN)

A 1­b, 2­a, 3­c

B 1­a, 2­b, 3­c

C 1­c, 2­b, 3­a

D 1­c, 2­a, 3­b

Answer A

Marks 4

Unit 2

Id Keep it blank

Question The Preorder traversal of T is

A ABDCEF

B ADBCFE

C ABDECF

D ABDFEC

Answer C

Marks 4

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .7    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Unit 2

Id Keep it blank

Question The Inorder traversal of T is

A DBECAF

B DBCEAF

C DBEAFC

D DBEACF

Answer D

Marks 4

Unit 2

Id Keep it blank

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .8    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Question The postorder traversal of T is

A D E B C F A

B D B E A C F

C D E B F C A

D D B A E C F

Answer C

Marks 4

Unit 1

Id Keep it blank

Question Let T be a binary tree, and let each node N of T has the following property: the value at N is greater than every value in the left subtree of N and is less than every value in the right subtree of N. Then such a tree is called ___________

A Binary sorted tree

B Binary search tree

C Binary threaded tree

D Both (A) and (B)

Answer D

Marks 2

Unit 2

Id 130

Question Any C program

A must contain at least one function

B need not contain any function

C needs input data

D none of these

Answer Correct Option A

Marks 1

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .9    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Unit 1

Id 16

Question In a certain language, the expression 5-3+2 x 4+1, evaluates to 0. Which of the following conclusions about the precedence and associativity of the operators +, -, * are correct?

A + has precedence over - and - has precedence over *

B All these have equal precedence and associate to the right

C All these have equal precedence and associate to the left

D + and – have equal precedence, which is over * and all associate to the left

Answer A

Marks 2

Unit 1

Id 18

Question Which of the following comparison between static and dynamic type-checking is incorrect?

A Dynamic type-checking slows down execution

B Dynamic type-checking offers more flexibility to the programmers

C Dynamic type-checking is more reliable

D Dynamic type-checking is done during compilation, unlike static type checking

Answer A

Marks 2

Unit 1

Id 19

Question The period of time between an allocation and its subsequent disposal is called

A Scope

B (dynamic) binding

C Lifetime

D Longevity

Answer C

Marks 2

Unit 1

Id 20

Id 21

Question Consider the following sequence of statements Statement 1: A := B+C Statement 2: D := A+C Statement 3: E := A+B Statement 4: G := D-E Statement 5: H := E+A

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .10    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Statement 6: I := H+GWhich of the statements can be executed in parallel?

A 2 and 4

B 4 and 5

C 5 and 6

D 4, 5 and 6

Answer A

Marks 2

Unit 1

Id 22

Question If instructions are executed in parallel, whenever the required operands are available, then the execution time of the previous problem is logically same as that of sequential algorithm consisting of

A 3 statements

B 2 statements

C 4 statements

D 5 statements

Answer C

Marks 2

Unit 1

23 23

Question Aliasing is a situation where

A Two commands with different names share the same code

B A particular location is associated with more than one name

C Different functions have the same name but require parameter of different types

D None of the above

Answer A

Marks 2

Unit 1

Id 25

Question A recursive function f(x), is defined as follows: if(x>100) return(x-10) else return(f(f(x+11)))For which of the values of x, f(x) = 91?

A 100

B 91

C 1

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .11    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

D 101

Answer A

Marks 2

Unit 1

Id 26

Question English language uses full stop as a sentence

A Separator

B Terminator

C Delimiter

D All of the above

Answer B

Marks 2

Unit 1

Id Keep it blank

Question The ASCII (American Standard Code for Information Interchange) character set contains ------------- characters.

A 652

B 562

C 256

D 265

Answer c

Marks 2

Unit 1

Id Keep it blank

Question The character data set, sometimes called alphanumeric data set, consists of all------

A a, A

B A, Z

C #, &

D a, A, Z, 3, #, &

Answer D

Marks 2

Unit 1

Id Keep it blank

Question Character data or string data can be joined together with the + operator in an operation called-----------

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .12    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

A Palindrome

B Join

C Reverse String

D concatenation

Answer D

Marks 2

Unit 1

Id Keep it blank

Question When two pieces of character data are joined, the concatenation results in “4” + “4” = ? (Replace ? With suitable option)

A “44”

B 8

C “8”

D 4+4

Answer A

Marks 2

Unit 1

Id Keep it blank

Question Identify the data type for following data set : The price of an Item: 7.39, 12.98

A Numeric: real

B Character string

C Numeric: integer

D Logical

Answer A

Marks 2

Unit 1

Id Keep it blank

Question Identify the data type for following data set : An account number: “A2453,” “2987”

A Numeric: real

B Character string

C Numeric: integer

D Logical

Answer B

Marks 2

Unit 1

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .13    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Id Keep it blank

Question Identify the data type for following data set :A quantity:12389

A Numeric: real

B Numeric: integer

C Reverse String

D Logical

Answer B

Marks 2

Unit 1

Id Keep it blank

Question Identify the data type for following data set :A credit check:True, False

A Numeric: real

B Numeric: integer

C Logical

D Character string

Answer C

Marks 2

Unit 1

Id Keep it blank

Question Choose the correct syntax for defining the function

A Function(Data);

B DefineFunction(value)

C FunctionName(Value)

D FunctionName(data)

Answer C

Marks 2

Unit 1

Id Keep it blank

Question absolute value, or a random number are belongs to which function type?

A Mathematical functions

B String functions.

C Conversion functions.

D Statistical functions.

Answer A

Marks 2

Unit 1

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .14    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Id Keep it blank 93

Question A machine need a minimum of 100 second sec to sort 1000 numbers by quick sort The minimum time needed to sort 100 name will be approximately

A 50.2 sec

B 6.7 sec

C 72.7 sec

D 11.2 sec

Answer Correct option B

Marks 2

Unit 1

Id Keep it blank

Question Unrestricted use of goto is harmful because

A It makes debugging difficult

B It increase the running time of program

C It increase memory requirements of program

D It result in the compiler generating longer machine code

Answer Correct option A

Marks 2

Unit 1

Id Keep it blank

Question The recurrence relation that arises in relation with the complexity of binary search is

A T(n)=T(n/2)+k, where k is constant

B T(n)=2T(n/2)+k, where k is constant

C T(n)=T(n/2)+log(n)

D T(n)=T(n/2)+n

Answer Correct option A

Marks 2

Unit 2

Id Keep it blank

Question Link list are not suitable for which of the following problems

A Insertion sort 

B Binary search 

C Radix sort

D Polynomial manipulation

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .15    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Answer Correct option B

Marks 2

Unit 1

Id Keep it blank

Question Literal means

A a string

B a string constant

C a character

D an alphabet

Answer Correct Option B

Marks 2

Unit Unit1

Id Keep it blank

Question The value of an automatic variable that is declared but not initialized will be

A 0

B -1

C unpredictable(garbage value)

D none of these

Answer Correct Option C

Marks 2

Unit Unit 1

Id Keep it blank

Question Which of the following is true of external variables?

A they provide a way for two way communication between functions

B their scope extends from the point of definition through the remainder of the program

C if they are not initialized, they will be initilised to zero

D All of these

Answer Correct Option D

Marks 2

Unit Unit 1

Id Keep it blank

Question The declaration int x : 4;means

A x is a four digit integer

B x cannot be greater than a four digit integer

C x is a four-bit integer

D none of these

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .16    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Answer Correct Option C

Marks 4

Unit Unit 1

Id Keep it blank

Question As soon as a pointer variable is freed, its value

A is set to null

B becomes unpredictable

C is set to 1

D remains the same

Answer Correct Option D

Marks 2

Unit Unit 1

Id Keep it blank

Question What is the correct way to round off x, a float, to an int value?

A y=(int) (x+0.5)

B y=int (x+0.5)

C y=(int) x+0.5

D y=(int)(int) x+0.50

Answer Correct Option A

Marks 4

Unit Unit1

Id Keep it blank

Question By default, any real number in 'C' is treated as

A A float

B A double

C A long double

D Depends on the memory model you are using

Answer Correct Option B

Marks 2

Unit Unit 1

Id Keep it blank

Question To print out a and b given below, which printf() statement would you use?float a = 3.14;double b = 3.14;

A printf("%f%f",a,b);

B printf("%Lf%f",a,b);

C printf("%f%Lf",a,b);

D printf("%Lf%Lf",a,b);

Answer Correct Option A

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .17    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Marks 4

Unit Unit 1

Id Keep it blank

Question In the following 'C' code, in which order the functions would be called ?a = ( f1(23,14 ) * f2 (12/14)) + f3 () ;

A f1,f2,f3

B f3,f2,f1

C The order may vary from compiler to compiler

D None of these

Answer Correct Option A

Marks 4

Unit Unit 1

Id

Question Which one of the following is not the step in ensuring best decision

A Identify the problem.

B Understand the problem.

C Discard the problem & solution

D Evaluate the solution.

Answer C

Marks 2

Unit 1

Id

Question Solutions that cannot be reached through a direct set of steps are called..........

A algorithmic solutions.

B alternative Solution

C heuristic solutions.

D straightforward Solution

Answer C

Marks 2

Unit 1

Id

Question A problem that can be solved with a series of actions is called............

A heuristic solutions.

B algorithmic solutions.

C straightforward Solution

D alternative Solution

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .18    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Answer B

Marks 2

Unit 1

Id

Question heuristic types of problems is called..........

A Operation Research

B Artificial intelligence

C Fuzzy Logic

D None of these

Answer B

Marks 2

Unit 1

Id

Question The .................... steps in problem solving lead to the best possible solution to a problem.

A Six

B Four

C Five

D Seven

Answer A

Marks 2

Unit 1

Id

Question The..................solutions are reached in a series of steps.

A algorithmic solutions

B heuristic solutions

C Artificial intelligence

D straightforward Solution

Answer A

Marks 2

Unit 1

Id

Question The...................... solutions are attained through trial and error.

A straightforward Solution

B alternative Solution

C algorithmic solutions.

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .19    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

D heuristic solutions.

Answer D

Marks 2

Unit 1

Id

Question The programmer defines each .............and ............... in a problem solution as a particular data type

A Pointer , Array

B Integer , Double

C String , Float

D constant , variable

Answer D

Marks 2

Unit 1

Id

Question Variable also known as .....

A Font

B Constant

C Identifier

D File

Answer C

Marks 2

Unit 1

Id

Question A constant is a value that never changes during the processing of all the instructions in a solution

A FALSE

B None of these

C TRUE

D Both A &C

Answer D

Marks 2

Unit 1

Id

Question In UML Sequence diagram used to indicate----------

A to create a logical model of your solution

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .20    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

B how a system functions from the user’s standpoint

C describe how a class functions

D interactivity between objects

Answer D

Marks 2

Unit 1

Id

Question In UML Use case diagrams Used to indicate----------

A how a system functions from the user’s standpoint

B to create a logical model of your solution

C describe how a class functions

D interactivity between objects

Answer A

Marks 2

Unit 1

Id

Question In UML Class diagrams Used to indicate----------

A describe how a class functions

B how a system functions from the user’s standpoint

C to create a logical model of your solution

D interactivity between objects

Answer A

Marks 2

Unit 1

Id

Question Two main measures for the efficiency of an algorithm are

A Processor and memory

B Complexity and Capacity

C Time and Space

D Data and Space

Answer C

Marks 2

Unit 1

Id

Question The time factor while determining the efficiency of algorithm is measured by

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .21    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

A Counting microseconds

B Counting the number of key operations

C Counting the number of statements

D Counting the kilobytes of algorithm

Answer B

Marks 2

Unit 1

Id

Question The worst case occur in linear search algorithm when

A Item is somewhere in the middle of the array

B Item is not in the array at all

C Item is the last element in the array

D Item is the last element in the array or is not there at all

Answer D

Marks 2

Unit 2

217 Keep it blank

Question A binary tree in which if all its  level except possibly  the last  , have the maximum number of nodes and all the  nodes at the last level appear as far as possible , is known as

A Full binary tree

B 2­tree

C Threaded tree

D Complete binary tree

Answer D

Marks 2

Unit 2

218 Keep it blank

Question A linear list of element in which deletion can be done from one end(front) and insertion can take place only at the other end (real) is known as

A Queues

B Stack

C Trees

D Branch

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .22    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Answer A

Marks 2

Unit 2

219 Keep it blank

Question Which data structure is needed to convert infix notation to postfix notations?

A Branch 

B Queue

C Tree

D Stack

Answer D

Marks 2

Unit 2

220 Keep it blank

Question which of the following operations is performed more efficiently  by  doubly linked list than by linear linked list ?

A Deleting a node whose location is given

B Searching an unsorted list for a given item 

C Inserting a node after the node with a given location

D Traversing the list to process each node

Answer A

Marks 2

Unit 2

222 Keep it blank

Question A stack is a linear data structure in which data is stored and retrieved in a

A Last out first in (LOFI)

B Last in first out(LIFO)

C First in first out (FIFO)

D Last out last in(LOLI)

Answer B

Marks 2

Unit 2

227 Keep it blank

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .23    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Question The postfix or of  A + (B*C) is

A ABC +*

B ABC *+

C AB +C*

D AB *C +

Answer A

Marks 4

Unit 2

228

Question The postfix of (A+B)*C is

A AB+C*

B ABC*+

C ABC*C+

D ABC+*

Answer A

Marks 4

Unit 2

229 Keep it blank

Question The postfix form of A$B*C­D+E/F/(G+H) is

A AB$C*D ­ EF/GH+/+

B  AB$*C ­ D+ EF/GH+

C AB$C+D ­ EF/GH/­+

D AB$C – D*EF/GH/++

Answer A

Marks 4

Unit 2

230 Keep it blank

Question The postfix form of A­B(C*D$E) is

A ABCDE$*/­

B AB/C*DE$

C ABCDE$­/*

D ABCDE/­*$

Answer A

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .24    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Marks 4

Unit 2

231 Keep it blank

Question The prefix form of A­B/(C*D$E)is

A ­/*$ACBDE

B ­ABCD*$DE

C ­A/B*C$DE

D ­A/BC*$DE

Answer C

Marks 4

Unit 2

232 Keep it blank

Question The prefix of (A+B) *(C­D)is

A +­AB*CD

B *+­ABCD

C *+AB­CD

D *AB+CD

Answer C

Marks 4

Unit 2

233 Keep it blank

Question What is the postfix form of the following prefix­A/B*C$DE

A ABCDE$*/­

B A­BCDE$*/­

C ABC*ED*/

D A­BCDE­*$

Answer A

Marks 4

Unit 2

234 Keep it blank

Question What is the postfix form of the following prefix*+AB­CD

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .25    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

A AB+CD­*

B ABC+*­

C AB+CD­*

D AB+*CD­

Answer A

Marks 4

Unit 2

Id Keep it blank

Question17

A list of integers is read in, one at a time, and a binary search tree is constructed. Next the tree is traversed and the integers are printed. Which traversed would result in a printout in which duplicate the original order of the list of integers?

A Preorder

B Post order

C In order

D None of the above

Answer Correct Option (D)

Marks 4

Unit 2

Id Keep it blank

Question18

The five items: A,B,C,D and E are pushed in a stack, one after the other starting from A. the stack is popped four times and each element is inserted in queue. Then two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack. The popped item is

A A

B B

C C

D D

Answer  Correct option (D)

Marks 4

Unit 2

Id Keep it blank

Question The time required to search an element in a binary search tree having n element is

A O(1)

B O(log2 n)

C O(n)

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .26    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

D O(n log2 n)

Answer Correct Option (B)

Marks 2

Unit 2

Id Keep it blank

Question24

If each node in a tree has value greater than every value in its left sub tree and has value and less than value in its right sub tree ,the tree is known is 

A Complete tree 

B Full binary tree

C Binary search tree

D Threaded tree

Answer Correct Option (C)

Marks 2

Unit 2

Id Keep it blank

Question 26 The infix expression A+((B­C)*D) is correctly represented in prefix notation as

A A+B­C*D

B +A*­BCD

C ABC­D*+

D A+BC­D*

Answer Correct Option (B)

Marks 4

Unit 2

Id Keep it blank

Question27

A list data items usually words or bytes, with the accessing restriction that elements can be added or removed at one end of the list only is known as

A Stack

B Memory

C Linked list

D Heap

Answer Correct Option (A)

Marks 2

Unit 2

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .27    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Id Keep it blank

Question28

In what order the elements of a pushdown stack are accessed

A First in first out(FIFO)

B Last in last out(LILO)

C Last in first out(LIFO)

D None of the above

Answer Correct Option (C)

Marks 2

Unit 2

Id Keep it blank

Question A full binary tree with n non leaf nodes contains

A log n nodes

B n+1 nodes

C 2n­1 nodes

D 2n+1 nodes

Answer D

Marks 4

Unit 2

Id Keep it blank

Question If this tree is used for sorting, then new no 8 should be placed as the

                                                                                                                     

A left child of the node labeled 30

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .28    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

B right child of the node labeled 5

C right child of the node labeled 30

D left child of the node labeled 10

Answer D

Marks 4

Unit 2

Id Keep it blank

Question  A complete binary tree of level 5 has how many nodes ? 

A 15

B 25

C 63

D 30

Answer C

Marks 2

Unit 2

Id Keep it blank

Question Traversing a binary tree first root and then left and right subtrees called _______traversal.                                                                                  

A Postorder traversal

B Preorder

C Inorder

D none of these

Answer B

Marks 1

Unit 2

Id Keep it blank

Question   Which of the following statements are correct ?I. If each tree node contains a father field, then it's not necessary to use either stack or threadsII. Traversal using father pointers is more time efficient than traversal of a threaded treeIII. A in­threaded binary tree is defined as binary tree that is both left­in threaded and right­in threaded.                                                                                

A II and III

B I and II

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .29    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

C I and III

D All of these

Answer C

Marks 4

Unit 2

Id Keep it blank

Question Number of possible binary trees with 3 nodes is 

A 12

B 9

C 14

D 5

Answer D

Marks 2

Unit 2

Id Keep it blank

Question A binary tree is generated by inserting in order the following integers:50, 15, 62, 5, 20,58, 91, 3,8,37, 60, 24The number of nodes in the left of the root respectively is 

A (4,7)

B (7,4)

C (6,3)

D (3,6)

Answer B

Marks 4

Unit 2

Id Keep it blank

Question If the post order traversal gives a b ­ c d * + then the label of the nodes 1, 2, 3 ... will be         

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .30    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

                                                                                         

A +, ­, *, a, b, c, d

B a, ­, b, +, c, *, d

C a, b, c, d, ­, *, +

D ­, a, b, +, *, c, d

Answer A

Marks 4

Unit 2

Id Keep it blank

Question The Inorder and Preorder traversal of a binary tree are d b e a f c g and a b d e c f g respectively. The postorder traversal of the binary tree is 

A d e b f g c a

B e d b g f c a

C e d b f g c a

D d e f g b c a

Answer A

Marks 4

Unit 2

Id Keep it blank

Question If the post order traversal gives ab­cd+ then the lable of the nodes 1,2,3,….will be

A +, ­, *, a, b, c, d

B a, ­, b,+, c, *, d*, d

C a, b, c, d, ­, *, +

D ­, a, b ,+, *, c, d 

Answer A

Marks 4

Unit 2  

Id Keep it blank

Question 9 The initial configuration of a queue is a,b,c,d(‘a’ is in the front end).To get the configuration d,c,b,a, one needs a minimum of

A 2 deletion and 3 addition

B 3 deletion and 2 addition

C 3 deletion and 3 addition

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .31    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

D 3 deletion and 4 addtion

Answer C

Marks 4

Unit 2 

Id Keep it blank

Question 4 The number of possible ordered trees with  3 nodes A,B,C is

A 16

B 12

C 6

D 10

Answer B

Marks 4

Unit 2 

Id Keep it blank

Question 7 The following sequence of operations is performed on a stack push (1), push (2), pop, push(1), pop, pop, pop, push(2), pop. 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

Marks 4

Unit 2 

Id Keep it blank

Question 10 The depth of a complete binary tree with ‘n’ nodes is (log is to the base two)

A Log (n+1)­1

B Log(n)

C Log(n­1)+1

D Log(n)+1

Answer A

Marks 4

Unit  2  

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .32    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Id Keep it blank

Question 11 Preorder is nothing but

A Depth­first order

B Breadth first­order

C Topological order

D Linear order

Answer A

Marks 2

Unit 2 

Id Keep it blank

Question 12 Which of the following traversal techniques lists the nodes of a binary search tree in ascending order ?

A Post­order

B In­order 

C Pre­order 

D None of the above

Answer B

Marks 2

Unit 2 

Id Keep it blank

Question 13 The average successful search time taken by binary search on a sorted array of 10 times is

A 2.6

B 2.7

C 2.8

D 2.9

Answer D

Marks 2

Unit 2 

Id Keep it blank

Question A binary search tree contains the values ­ 1, 2, 3, 4, 5, 6, 7 and 8. The tree is traversed in Pre­order and the values are printed out. which of the following sequences is a valid output?

A 5 3 1 2 4 7 8 6

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .33    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

B 5 3 1 2 4 6 4 9 7

C 5 3 2 4 1 6 7 8

D 5 3 1 2 4 7 6 8

Answer D

Marks 4

Unit 2

Id Keep it blank

Question Inorder :    B  C  A  E  D  G  H  F  IPreorder :  A  B  C  D  E    F  G  H  I Find Post­order 

A C B E  H G I F D A

B C B A E D HG I F

C C E B H I G F D A

D C B E H G  I F A D

Answer A

Marks 4

Unit 2

Id Keep it blank 59

Question The postfix equivalent of the prefix *+ab­cd is

A ab+cd­*

B abcd+­*

C ab+cd*­

D ab+­cd*

Answer A

Marks 1

Unit 2

Id Keep it blank 60

Question The order of the binary search algorithm is

A n

B n2

C nlogn

D logn

Answer D

Marks 2

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .34    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Unit 2

Id Keep it blank

Question Stack can’t be used to

A Evaluate an arithmetic expression in postfix form

B Implement recursion

C Convert a given arithmetic expression in infix form to its equivalent postfix form

D Allocate resources(like CPU)by the operating system

Answer D

Marks 2

Unit 2

Id Keep it blank

Question57

A full binary tree with n leaves contains

A N nodes 

B  log2 n nodes

C 2n­1 nodes

D 2n nodes

Answer Correct Option (C)

Marks 4

Unit 2

Id Keep it blank

Question A full binary tree with n non­leaf nodes contains

A Log2n nodes

B n+1

C 2n nodes

D 2n+1 nodes

Answer Correct Option(D)

Marks

Unit

Id Keep it blank

Question What is the minimum number of fields with each node of doubly linked list 

A 1

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .35    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

B 2

C 3

D 4

Answer Correct Option (c)

Marks 2

Unit 2

Id Keep it blank

Question A linear list in which elements can be added or removed at either end but not in the middle is known as

A queue

B Deque

C stack

D Tree

Answer Correct Option (B)

Marks Marks for this question

Unit Unit number of question belongs to

Id Keep it blank

Question Select the correct statement:1. The nodes A and B have the same number of successors2. The nodes  B and C have the same number of successors3. The nodes C and H have the same number of successors

A 1 and 2

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .36    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

B 2 and 3

C 1 and 3

D 1, 2 and 3

Answer D

Marks 4

Unit 2

Id Keep it blank

Question Queues serve a major role in

A Simulation of recursion

B Simulation of arbitrary linked list 

C Simulation of limited resource allocation

D Expression evalution

Answer C

Marks 1

Unit 2

Id Keep it blank

Question What is the number of node in a complete binary tree of level 5?

A 15

B 25

C 63

D 71

Answer C

Marks 1

Unit 2

Id Keep it blank

Question The tree shown in figure represents the postfix expression for ­­­­­­

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .37    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

A 6 5 5 3 2 1 + + * * +

B 1 + 2 * 3 + 4 * 5 + 6

C 1 2 + 3 4 + 5 6 + * *

D + 1 2 + 3 4 + 5 6

Answer C

Marks 4

Unit 2

Id Keep it blank

Question Which of the following list of nodes correspond to a postorder traversal of the binary tree shown in figure. 

A A B C D E G H I J 

B A B D E H C F I J 

C D H E B I F J G C A

D D B E H A I F C J G

Answer C

Marks 4

Unit 2

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .38    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Id Keep it blank

Question

Consider the tree shown above. If this tree is used for sorting , then a new number 8 , should be placed as the 

A Left child of node labeled 30 

B Right child of node labeled 5

C Right child of node labeled 30

D Left child of node labeled 10

Answer D

Marks 4

Unit 2

Id Keep it blank

Question

Consider the tree above, If the post order traversal gives a b – c d *+ then the label of the nodes 1, 2, 3... will be as­­­­­­­

A +  ­  *  a  b  c d

B a  ­  b  +  c  *  d 

C a  b  c  d  ­  *  +

D ­ a  b+  * +

Answer A

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .39    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

Marks 4

Unit 2

Id Keep it blank

Question Which of the following lists of nodes correspond to a postorder traversal of the binary tree in the figure shown?

A A B C D E H C F I G J

B D H E B I F J G C A 

C D B E H A I F C J G

D A B C D E F G H H I J

Answer

Marks 4

Unit 2

Id Keep it blank

Question

A

B

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .40    

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT ­2 , SECOND YEAR COMP. ENGG. SEM­1, 2012 PATTERN , U.O.P.  

C

D

Answer

Marks 4

Unit 2

DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO.   .41