Important Introduction to Programming Short Questions
Chapter: 42
Question 1:
How should member functions of a template class be defined?
Answer:
Member functions should be defined outside the class using the syntax template <class T> className<T>::functionName().
Chapter: 42
Question 2:
What does template<class T> class Stack define?
Answer:
It defines a template class Stack where T is a placeholder for any data type.
Chapter: 42
Question 3:
How do you define a member function of a template class?
Answer:
By using template <class T> className<T>::memberFunction(), where T is replaced with the specific type.
Chapter: 43
Question 4:
What is a matrix?
Answer:
A matrix is a two-dimensional array of numbers, represented in rows and columns.
Chapter: 43
Question 5:
What is the order of a matrix?
Answer:
The order of a matrix refers to its dimensions, specified as the number of rows and columns (e.g., 3x4).
Chapter: 43
Question 6:
How is matrix addition performed?
Answer:
Matrix addition is performed by adding corresponding elements of two matrices with the same order.
Chapter: 43
Question 7:
What is the restriction for matrix addition?
Answer:
Both matrices must have the same number of rows and columns to be added.
Chapter: 43
Question 8:
How is a scalar added to a matrix?
Answer:
A scalar is added to each element of the matrix.
Chapter: 43
Question 9:
Describe the process of matrix subtraction.
Answer:
Matrix subtraction involves subtracting corresponding elements of two matrices of the same order.
Chapter: 43
Question 10:
How is matrix subtraction different from scalar subtraction?
Answer:
Matrix subtraction involves two matrices, while scalar subtraction involves subtracting a number from each matrix element.