SlideShare a Scribd company logo
1 of 144
Data structures
CLASS 6
1
HASHING
Types of hash functions
• Truncation
• Mid square method
• Folding method
• Division method (modulo division)
Truncation
• Here we take only a part of the key
• Eg: rightmost digit, leftmost digit, centre
• K=56276273
• H(k)= ?
Digit folding method
• Divide the elements into parts
• Combine these parts by any mathematical operation.
• Eg: k=23576623
• H(k)=235+766+23=1024
(Open hashing)
(closed hashing)
Open addressing (probing)
• Linear probing
• Quadratic probing
• Double hashing
H( k, i)=[h(k)+i]mod n
H( k, i)=[h(k)+i²]mod n
H( k, i)=[h1(k)+i*h2(k)]mod N
• Reduces clustering in an optimised way
Programmer-2022
db
CONTENTS
● Previous Year Question Discussion
○ 042/2016-Tradesman in CS
○ 143/2016-Tradesman in IT
○ 114/2016-Instructor in IT
○ 151/2016-Tradesman InCS
○ 002/2012..Lecturer in CS
042/2016-Tradesman inCS
Ans: option b
[Number of Leaf nodes =Number of Internal nodes +1]
042/2016-Tradesman inCS
Ans:Option D
042/2016-Tradesman inCS
Ans:Option C
042/2016-Tradesman inCS
Ans:Option B
042/2016-Tradesman inCS
Ans: option a [Average time complexity]
[Note: Average no.of comparisons is (n+1)/2]
Time Complexity Linear Search Binary Search
Best Case O(1) O(1)
Average Case O(n/2) O(log n)
Worst Case O(n) O(log n)
143/2016-Tradesman inIT
Ans:Option A
143/2016-Tradesman inIT
Ans:Option D
114/2016-Instructor inIT
Ans:Option C
114/2016-Instructor inIT
Ans: Option A
114/2016-Instructor inIT
Ans: Option A
114/2016-Instructor inIT
Ans: Option C
151/2016-Tradesman InCS
Ans: Option B
002/2012..Lecturer inCS
Ans: Option D
002/2012..Lecturer inCS
Ans: Option C
002/2012..Lecturer inCS
Ans: Option D [L =(N –1) *I+1]
● An m-ary tree is a rooted tree in which each node has no more
than m children ie at most m children.
● A full m-ary tree is an m-ary tree where within each level every
node has either 0 or m children ie internal node has m children
and leaf node has 0.
● For a full N -ary tree
L =(N –1) *I+1.
Where ‘I’- internal nodes, ‘L’-Leaf nodes‘
002/2012..Lecturer inCS
Ans: Option C
002/2012..Lecturer inCS
Ans: Option D
002/2012..Lecturer inCS
Ans: Option B
002/2012..Lecturer inCS
Ans:Wrong Options [ Answer is AB+C*DE-FG+^- ]
002/2012..Lecturer inCS
Ans: Option A
[Quicksort also uses divide and conquer strategy]
002/2012..Lecturer inCS
Ans: Option B [Hint: Dynamic]
002/2012..Lecturer inCS
Ans: Option A
CONTENTS
● Previous Year Question Discussion
○ 123/2016-Assistant Professor in CS
○ 140/2016-Assistant Professor in IT
123/2016-Assistant Professor in CS
Ans: options wrong [Preorder- Root Left Right]
Correct Answer: 14,2,1,3,11,10,7,40,30
123/2016-Assistant Professor in CS
Ans:Option c
Quicksort
● Partition Exchange sort
● Uses divide and conquer concept.
● Partition is based on a pivot element(key element)
● Here pivot element is one of the elements in the list( May be first
or last or median or any random element ).
● The list is divided into two partitions such that "all elements to
the left of pivot are smaller than the pivot and all elements to the
right of pivot are greater than or equal to the pivot".
● Best and average case time complexity is O(n log n)
● Worst case time complexity is O(n2)
○ 123/2016-Assistant Professor in CS
Ans:Option D
○ 123/2016-Assistant Professor in CS
Ans:Option B
123/2016-Assistant Professor in CS
Ans: option c [In a graph with n vertices, a Hamiltonian cycle
consists of n edges.]
140/2016-Assistant Professor in IT
Ans: B
[The maximum number of nodes possible in a binary tree of height
‘h’ is 2
h+1-1. Or 2
h-1 ]
[The minimum number of node possible in a binary tree of height ‘h’
is h+1. Or h ]
140/2016-Assistant Professor in IT
Ans:Option D
140/2016-Assistant Professor in IT
Ans:Option D [Hint: Worst case complexity for deletion operation in
singly linked list is O(n). But here the pointer to the deleting node is
given .So O(1) ]
140/2016-Assistant Professor in IT
Ans:Option A
[Acyclic undirected graph--tree]
140/2016-Assistant Professor in IT
Ans:Option B [Number of Leaf Nodes(n0) =Number of Internal nodes
with 2 children(n2) +1]
Number of Leaf Nodes =10 +1
Number of Leaf Nodes =11
140/2016-Assistant Professor in IT
Ans:Option C
CONTENTS
● Previous Year Question Discussion
○ 073/2018-Lecturer in CS (Collegiate Education)
○ 198/2010-Lecturer in Computer Engineering( Polytechnic)
073/2018-Lecturer inCS
Ans: Option D
073/2018-Lecturer inCS
Ans: Option c
073/2018-Lecturer inCS
Ans: Option B
073/2018-Lecturer inCS
Ans: Option D
073/2018-Lecturer inCS
Ans: Option D
073/2018-Lecturer inCS
Ans: Option C
073/2018-Lecturer inCS
Ans: Option D
073/2018-Lecturer inCS
Ans: Option C
073/2018-Lecturer inCS
Ans: Option A [For m-way Btree,
■ Maximum m-1 keys
■ Minimum keys ceil(m/2)-1 ]
B-tree
● A balanced m-way search tree which maintains sorted data.
● A node in B tree can have more than one key and more than 2
children.
● All the leaf node must be at the same level.
● Properties of B tree with order m:
○ Every node has maximum m children
○ Minimum children--leaf--0
Root--2
Internal nodes----ceil(m/2)
○ Every node has maximum m-1 keys
○ Minimum keys-- ----Root--1
All other nodes----ceil(m/2)-1
073/2018-Lecturer inCS
Ans: Option A
073/2018-Lecturer inCS
Ans: Option B
073/2018-Lecturer inCS
Ans: Option B
073/2018-Lecturer inCS
Ans:Mistake in question[Not tree . It is a graph] ---Wrong options
198/2010-Lecturer inCE
Ans: X
Correct Ans: -A/B+*CDE
198/2010-Lecturer inCE
Ans: Option B
[Hint:2n-1]
198/2010-Lecturer inCE
Ans: Wrong options
Correct ans: 1 1 2 4 6 9 12 7 3 3
198/2010-Lecturer inCE
Ans: Option D
198/2010-Lecturer inCE
Ans: Option A
198/2010-Lecturer inCE
Ans: Option B
198/2010-Lecturer inCE
Ans: Option C
[In question,“ n edges wrong..n vertices correct”]
198/2010-Lecturer inCE
Ans: Option A
Explanation
Address of A[I] = B + W * (I – LB)
I = Subset of element whose address to be found,
B = Base address,
W = Storage size of one element store in any array(in byte),
LB = Lower Limit/Lower Bound of subscript(If not specified assume
zero).
Eg:Find the address
of 5th element .
1100+4*(5-0)
=1100+20
=1120
CONTENTS
● Previous Year Question Discussion
○ 18/2015-Lecturer in IT (Technical Education)
○ 60/2015-Computer Programmer in Technical Education
○ 79/2015-Computer Engineer(Descriptive Type)
○ 73/2015-Lecturer in CS(Descriptive Type)
18/2015-Lecturer inIT
Ans: X
Ans:n-1
18/2015-Lecturer inIT
Ans: Option A
18/2015-Lecturer inIT
Ans: Option D
[Ans: FRONT=REAR !=Null]
18/2015-Lecturer inIT
Ans: Option A
60/2015-Computer Programmer
Ans: Option B
Complexities of searching algorithms
Binary Search
● Search on sorted tree
● Uses divide and conquer concept
60/2015-Computer Programmer
Ans:Option B
60/2015-Computer Programmer
Ans: Option B
60/2015-Computer Programmer
Ans: Option D
60/2015-Computer Programmer
Ans: Option A
60/2015-Computer Programmer
Ans: Option D
60/2015-Computer Programmer
Ans: Option D
60/2015-Computer Programmer
Ans: Option C
60/2015-Computer Programmer
Ans: Option C
79/2015-Computer Engineer
Ans: - (Minus operator)
79/2015-Computer Engineer
73/2013-Lecturer inCS
Ans: Scheduling
73/2013-Lecturer inCS
Ans: Garbage Collection
CONTENTS
● Previous Year Question Discussion
○ 145/2015-Programmer
○ 12/2014-Vocational instructor-VHSE-Computer
Application
145/2015-Programmer
Ans: Option A
Note: Bucket sort is also known as bin sort
145/2015-Programmer
Ans: Option A
145/2015-Programmer
Ans: Option B
Explanation
145/2015-Programmer
Ans: Option A
145/2015-Programmer
Ans: Option D
145/2015-Programmer
Ans: Option A
[Mistake in question: Complete graph k6]
[Ifit is complete bipartite graph ,k3,3---then answer in one]
Complete graph
● A complete graph is a graph with N vertices and an edge
between every two vertices.
● Number of edges in a complete graph with n vertices is n(n−1)/2
edges.
● Eg:k6(No.of edges-15)
After removed 3
edges k6
became planar.
CompleteBipartiteGraph:
● A graph G = (V, E) is called a complete bipartite graph if its
vertices V can be partitioned into two subsets V1 and V2 such
that each vertex of V1 is connected to each vertex of V2.
● The number of edges in a complete bipartite graph is m.n as
each of the m vertices is connected to each of the n vertices.
● Eg: k3,3
Itis not planar. So remove
one edge ,then it will
become planar.
145/2015-Programmer
Ans: Option C
Explanation
● &represents address.
● Array name by itself is the base address,ie the array name is a pointer which
points to the starting address of the array or base address of array.
145/2015-Programmer
Ans:Option D
[Since AVL trees are always balanced, time complexity in
searching, Insertion and deletions are O(logn). Where in
case of BST it is O(n)]
145/2015-Programmer
Ans: Option D
Euler Graph
● An Euler Graph is a connected graph that contains an Euler
Circuit. An Euler circuit is a Euler path which starts and ends on
the same vertex. An Euler path is a path in a graph that visits
every edges exactly once .
● Let G be a connected graph. Then G is Eulerian if and only if
every vertex of G has even degree.
145/2015-Programmer
Ans: Option b
145/2015-Programmer
Ans: option B
12/2014-Vocational instructor
Ans: Option B
12/2014-Vocational instructor
Ans: Option A
12/2014-Vocational instructor
Ans: Option D
12/2014-Vocational instructor
Ans: Option C
[Best case is O(N)]
12/2014-Vocational instructor
Ans: Option C [Tree]
12/2014-Vocational instructor
Ans: Option C
● An abstract data type (ADT) is a mathematical model for data
types.
● An abstract data type is defined by its behavior (semantics) from
the point of view of a user, of the data, specifically in terms of
possible values, possible operations on data of this type, and the
behavior of these operations.
● This mathematical model contrasts with data structures, which
are concrete representations of data, and are the point of view of
an implementer, not a user.
12/2014-Vocational instructor
Ans: Option B
12/2014-Vocational instructor
Ans: Option A
12/2014-Vocational instructor
Ans:option A
12/2014-Vocational instructor
Ans: Option A
12/2014-Vocational instructor
• Ans: Option B [Correct ans: null graph]
• [Trivial graph-Only one vertex with no edge]
12/2014-Vocational instructor
Ans:Option A

More Related Content

Similar to Data structure multiple choice qn REVISION+hashing.pptx

0580 w08 qp_02
0580 w08 qp_020580 w08 qp_02
0580 w08 qp_02
King Ali
 
0580 w08 qp_02
0580 w08 qp_020580 w08 qp_02
0580 w08 qp_02
King Ali
 
November 9, 2015
November 9, 2015November 9, 2015
November 9, 2015
khyps13
 
Question 11 pointsSaveWhich of the following is an e.docx
Question 11 pointsSaveWhich of the following is an e.docxQuestion 11 pointsSaveWhich of the following is an e.docx
Question 11 pointsSaveWhich of the following is an e.docx
tawnyataylor528
 
DBMS ArchitectureQuery ExecutorBuffer ManagerStora
DBMS ArchitectureQuery ExecutorBuffer ManagerStoraDBMS ArchitectureQuery ExecutorBuffer ManagerStora
DBMS ArchitectureQuery ExecutorBuffer ManagerStora
LinaCovington707
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
hodcsencet
 
Cryptography and Network Security Principles and Practice
Cryptography and Network Security Principles and PracticeCryptography and Network Security Principles and Practice
Cryptography and Network Security Principles and Practice
TaunyaCoffman887
 
Cryptography and Network Security Principles and Practice (2)
Cryptography and Network Security Principles and Practice (2)Cryptography and Network Security Principles and Practice (2)
Cryptography and Network Security Principles and Practice (2)
MargenePurnell14
 
ebookggj higuigyfhuuhfffihgffuuytrfhhffhhg
ebookggj higuigyfhuuhfffihgffuuytrfhhffhhgebookggj higuigyfhuuhfffihgffuuytrfhhffhhg
ebookggj higuigyfhuuhfffihgffuuytrfhhffhhg
MallepallyChakravard
 

Similar to Data structure multiple choice qn REVISION+hashing.pptx (20)

Google Farewell Competition.pptx
Google Farewell Competition.pptxGoogle Farewell Competition.pptx
Google Farewell Competition.pptx
 
2.ppt
2.ppt2.ppt
2.ppt
 
WEEK 4- DLD-GateLvelMinimization.pptx
WEEK 4- DLD-GateLvelMinimization.pptxWEEK 4- DLD-GateLvelMinimization.pptx
WEEK 4- DLD-GateLvelMinimization.pptx
 
Chapter One.pdf
Chapter One.pdfChapter One.pdf
Chapter One.pdf
 
AI_Session 8 A searching algorithm .pptx
AI_Session 8 A searching algorithm .pptxAI_Session 8 A searching algorithm .pptx
AI_Session 8 A searching algorithm .pptx
 
0580 w08 qp_02
0580 w08 qp_020580 w08 qp_02
0580 w08 qp_02
 
0580 w08 qp_02
0580 w08 qp_020580 w08 qp_02
0580 w08 qp_02
 
Travelling salesman problem
Travelling salesman problemTravelling salesman problem
Travelling salesman problem
 
November 9, 2015
November 9, 2015November 9, 2015
November 9, 2015
 
Question 11 pointsSaveWhich of the following is an e.docx
Question 11 pointsSaveWhich of the following is an e.docxQuestion 11 pointsSaveWhich of the following is an e.docx
Question 11 pointsSaveWhich of the following is an e.docx
 
DBMS ArchitectureQuery ExecutorBuffer ManagerStora
DBMS ArchitectureQuery ExecutorBuffer ManagerStoraDBMS ArchitectureQuery ExecutorBuffer ManagerStora
DBMS ArchitectureQuery ExecutorBuffer ManagerStora
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
 
Cryptography and Network Security Principles and Practice
Cryptography and Network Security Principles and PracticeCryptography and Network Security Principles and Practice
Cryptography and Network Security Principles and Practice
 
Cryptography and Network Security Principles and Practice (2)
Cryptography and Network Security Principles and Practice (2)Cryptography and Network Security Principles and Practice (2)
Cryptography and Network Security Principles and Practice (2)
 
sheet6.pdf
sheet6.pdfsheet6.pdf
sheet6.pdf
 
doc6.pdf
doc6.pdfdoc6.pdf
doc6.pdf
 
paper6.pdf
paper6.pdfpaper6.pdf
paper6.pdf
 
lecture5.pdf
lecture5.pdflecture5.pdf
lecture5.pdf
 
ebookggj higuigyfhuuhfffihgffuuytrfhhffhhg
ebookggj higuigyfhuuhfffihgffuuytrfhhffhhgebookggj higuigyfhuuhfffihgffuuytrfhhffhhg
ebookggj higuigyfhuuhfffihgffuuytrfhhffhhg
 
Dimensionality Reduction | Machine Learning | CloudxLab
Dimensionality Reduction | Machine Learning | CloudxLabDimensionality Reduction | Machine Learning | CloudxLab
Dimensionality Reduction | Machine Learning | CloudxLab
 

Recently uploaded

Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 

Recently uploaded (20)

Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Ernest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell TollsErnest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell Tolls
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptxMichaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdfDiuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 

Data structure multiple choice qn REVISION+hashing.pptx