– Final Exam (Solved Questions &
Answers)
1. return by value - ANSWER ✔ When the return
statement is executed, the function exits immediately,
and the return value is copied from the function back to
the caller. This process is called ___________.
2. argument - ANSWER ✔ a value that is passed from the
caller to the function when a function call is made.
3. pass by value - ANSWER ✔ When a function is called,
all of the parameters of the function are created as
variables, and the value of each of the arguments is
copied into the matching parameter (using copy
initialization). This process is called _______
4. Container - ANSWER ✔ It makes the collections of
objects manageable.
,5. Elements - ANSWER ✔ Container is a class that
provides data storage for a collection of unnamed
objects called _______.
6. Array - ANSWER ✔ It is a linear and homogeneous
data structure that collects elements of the same data
type and stores them in a contiguous and adjacent
memory location.
1. One dimensional arrays 2. Two dimensional arrays
2. Multi-dimensional arrays - ANSWER ✔ Array can be
classified as:
7. One-dimensional arrays - ANSWER ✔ it requires only
one subscript to specify the number of elements in an
array.
,8. Multi-dimensional arrays - ANSWER ✔ it requires
more than one subscript to specify the number of
elements in an array.
9. Two dimensional arrays - ANSWER ✔ It is organized
in the form of a matrix which can be represented as a
collections of rows and columns.
1. Fixed-size
2. Elements are stored in contiguous memory location
3. insertion and deletion of elements can be problematic -
ANSWER ✔ What are the limitations of an array?
1. storing list of elements belonging to the same data type
2. auxiliary storage for other data structures
3. matrices
4. underlying data structure for implementing stacks and
queues - ANSWER ✔ What are the applications of an
array?
1. C-style array
, 2. std::array
3. std::vector - ANSWER ✔ What are the three primary
array types?
10. c-style array - ANSWER ✔ It is a fixed-size, zero-
based indexed collection of elements of the same data
type, which inherited from C language.
11. std::array - ANSWER ✔ It is a fixed-size, static array
container introduced in C++11, providing a safer and
more feature-rich alternative to traditional C-style
arrays.
12. std::vector - ANSWER ✔ It makes arrays safer and
easier to use in c++. Most flexible of the three types.
Variable-size can be changed during runtime.
13. Structure - ANSWER ✔ It is a program-defined data
type that allows user to bundle multiple variables
together into a single type.