Data Structures using C++ Program: Chapter 8: Standard Template Library (C++ Program): Anna University Part A Two Marks Important Questions and Answers
Data Structures using C ++
Chapter 8: Standard Template Library
Two Marks Questions with Answers
1. Enlist
various types of container used in STL.
Answer:
There
are three types of containers used in STL‒
a.
Sequence container
b.
Associative container
c.
Derived container
2. What
do you mean by mutating algorithm ?
Answer:
The
mutating algorithms used in STL can modify the contents of the container. For
example ‒ copy() operation will modify the contents of the container.
3. What
do you mean by non mutating algorithm?
Answer:
The
non mutating algorithms used in STL cannot modify the contents of the container
as they work. For example count() will simply count the occurrences in container.
4. What
is the use of iterators?
Answer:
The
iterators are basically the objects that are used to traverse the contents of
container. There are five types of iterators
a.
Random access
b.
Forward
c.
Input
d.
Output
e.
Bidirectional.
5.
Explain the vector used in STL.
Answer:
Vector
is basically a container class in STL. It stores the elements in contiguous
memory locations. Any element of vercto can be accessed directly using index of
it. It supports dynamic array. Dynamic array is an array that can grow or
shrink dynamically. The memory allocation for vector is done at run time.
6. What
is STL ?
Answer:
The
Standard Template Library (STL) is a collection of well structured generic C++
classes and functions.
7. What
is a template?
OR
What is
the use of templates ?
Answer:
Template
is a tool for general programming that allows to write the code for any data
type element.
8. What
is an Iterator? List out the characteristic of an Iterator.
Answer: Iterators
are the objects that are used to transverse the contents of the container.
characteristics :
1)
Random access iterator is used to store or retrieve elements randomly.
2)
Forward iterator is used to store or retrieve the elements with forward moving
only.
3)
Input iterator allows to retrieve elements with forward moving.
4)
Output iterator allows to store elements with forward movement.
5)
Bidirectional iterator allows to store or retrieve elements with
forward/backward moving.
Data Structures using C PlusPlus: Chapter 8: Standard Template Library : Tag: Data Structure, C++ Programing : Data Structures using C++ Program - Standard Template Library (C++ Program): Two Marks Important Questions and Answers
Data Structures using CPlusPlus
CS25C05 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
English Essentials II
EN25C02 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Tamils and Technology தமிழர்களும் தொழில்நுட்பமும்
UC25H02 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Linear Algebra
MA25C02 2nd Semester | 2025 Regulation
Electron Devices
EC25C01 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
Data Structures using CPlusPlus
CS25C05 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
Circuits and Network Analysis
EC25C02 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
Re-Engineering for Innovation
ME25C05 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Engineering Drawing - Laboratory
ME25C01 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Data Structures using CPlusPlus - Laboratory
CS25C05 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
Devices and Circuits Laboratory
EC25C03 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation