1. (TCO 1) Explain how to use loops to process the data stored in a two-dimensio
ID: 3550884 • Letter: 1
Question
1. (TCO 1) Explain how to use loops to process the data stored in a two-dimensional array. In your explanation, include a two-dimensional array declaration and initialization.(Points : 10)Question 2.2. (TCO 2) Explain how encapsulation and data hiding are incorporated in C++ classes. Why are these concepts important in object-oriented programming? (Points : 10)
Question 3.3. (TCO 3) Assume that a definition of class Automobile has two composite objects called myEngine of class Engine and myTransmission of class Transmission. If an object of Automobile is instantiated and then goes out of scope, list the sequence in which all the constructors and destructors are called. Also, provide an explanation of how they are called in this sequence. (Points : 10)
Question 4.4. (TCO 4) Explain what a base class access specifier is and how it affects inheritance. (Points : 10)
Question 5.5. (TCO 5) When dynamically allocating memory for a specific data type, explain why a pointer variable of the same data type must be used. Describe what happens if the memory allocation is successful and what happens if it is unsuccessful. (Points : 10)
Question 6.6. (TCO 6) Explain why the native operators defined in C++ will not work with classes unless they have been properly overloaded. (Points : 10)
Question 7.7. (TCO 7) Define what is meant by the term run-time binding, and list two other terms that are also used to describe it. (Points : 10)
Question 8.8. (TCO 8) Describe what a namespace is, and provide the general syntax of a namespace statement. (Points : 10)
1. (TCO 1) Explain how to use loops to process the data stored in a two-dimensional array. In your explanation, include a two-dimensional array declaration and initialization.(Points : 10) Question 2.2. (TCO 2) Explain how encapsulation and data hiding are incorporated in C++ classes. Why are these concepts important in object-oriented programming? (Points : 10) Question 3.3. (TCO 3) Assume that a definition of class Automobile has two composite objects called myEngine of class Engine and myTransmission of class Transmission. If an object of Automobile is instantiated and then goes out of scope, list the sequence in which all the constructors and destructors are called. Also, provide an explanation of how they are called in this sequence. (Points : 10) Question 4.4. (TCO 4) Explain what a base class access specifier is and how it affects inheritance. (Points : 10) Question 5.5. (TCO 5) When dynamically allocating memory for a specific data type, explain why a pointer variable of the same data type must be used. Describe what happens if the memory allocation is successful and what happens if it is unsuccessful. (Points : 10) Question 6.6. (TCO 6) Explain why the native operators defined in C++ will not work with classes unless they have been properly overloaded. (Points : 10) Question 7.7. (TCO 7) Define what is meant by the term run-time binding, and list two other terms that are also used to describe it. (Points : 10) Question 8.8. (TCO 8) Describe what a namespace is, and provide the general syntax of a namespace statement. (Points : 10) 1. (TCO 1) Explain how to use loops to process the data stored in a two-dimensional array. In your explanation, include a two-dimensional array declaration and initialization.(Points : 10)
Question 2.2. (TCO 2) Explain how encapsulation and data hiding are incorporated in C++ classes. Why are these concepts important in object-oriented programming? (Points : 10)
Question 3.3. (TCO 3) Assume that a definition of class Automobile has two composite objects called myEngine of class Engine and myTransmission of class Transmission. If an object of Automobile is instantiated and then goes out of scope, list the sequence in which all the constructors and destructors are called. Also, provide an explanation of how they are called in this sequence. (Points : 10)
Question 4.4. (TCO 4) Explain what a base class access specifier is and how it affects inheritance. (Points : 10)
Question 5.5. (TCO 5) When dynamically allocating memory for a specific data type, explain why a pointer variable of the same data type must be used. Describe what happens if the memory allocation is successful and what happens if it is unsuccessful. (Points : 10)
Question 6.6. (TCO 6) Explain why the native operators defined in C++ will not work with classes unless they have been properly overloaded. (Points : 10)
Question 7.7. (TCO 7) Define what is meant by the term run-time binding, and list two other terms that are also used to describe it. (Points : 10)
Question 8.8. (TCO 8) Describe what a namespace is, and provide the general syntax of a namespace statement. (Points : 10)
Explanation / Answer
1).
int row,col;
int A[row][col];
elements of array A[0][0],A[0][1],...
A[1][0],A[1][1],... like this
take first row, and increase columns by +1
take second row, and increase columns by +1 ...
do thus until the last row.
int r,c;
for(r=0;r<row;r++)
{
for(c=0;c<col;c++)
{
...do actions...
}
========================================================
2).
Four Basic principle of OOP :
1. Encapsulation, 2. Abstraction, 3. Polymorphism, 4. Inheritance
Encapsulation is important for preventing unauthorized access of data.
a class X have private data like nickname, birthday etc.
to encapsulate these data, you can define the function in this class like
get_nickname(),set_nickname(), get_birthday(),set_birthday().
(get -> to read data, set -> write data)
in class Y, you can't access(not visible) nickname and birthday directly.
but by using get and set function of class X, u can access them.
====================================================================
3).
First call Automobile cunstructor.
then Any one from myEngine and myTransmission who is used first.
**call of destructor is reverse of call of cunstrustor .
destructor of myTransmission and myEngine.
destructor of Automobile .
It
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.