Introduction to Programming MCQs with Answers

Practice important Introduction to Programming MCQs with answers and explanations.

Multiple Choice Questions

Q691: What is the width set for the columns in the matrix display?
  • A: 8
  • B: 10
  • C: 12
  • D: 14
View Answer
B

Q692: What type of matrix does the code deal with?
  • A: Integer
  • B: Float
  • C: Double
  • D: Char
View Answer
C

Q693: Which function is used to avoid scientific notation in output?
  • A: os.setf(ios::showpoint)
  • B: os.setf(ios::fixed,ios::floatfield)
  • C: os << setw(10)
  • D: os << setprecision(2)
View Answer
B

Q694: What does the Matrix::output function do?
  • A: Inputs matrix values
  • B: Outputs matrix with graphics
  • C: Transposes the matrix
  • D: Multiplies matrices
View Answer
B

Q695: What must be output before the matrix values when saving to a file?
  • A: Matrix type
  • B: Matrix size (rows and columns)
  • C: Matrix elements
  • D: None of the above
View Answer
B

Q696: What function is responsible for reading a matrix from a file?
  • A: input(ifstream &is)
  • B: input(istream &is)
  • C: output(ofstream &os)
  • D: transpose()
View Answer
A

Q697: What condition is checked first in the transpose() function?
  • A: Number of elements
  • B: Matrix type
  • C: Square matrix (rows = columns)
  • D: Matrix dimensions
View Answer
C

Q698: What happens if the matrix is not square in the transpose() function?
  • A: An error is thrown
  • B: A temporary matrix is created
  • C: The transpose is skipped
  • D: The matrix is resized
View Answer
B

Q699: What is returned by the transpose() function?
  • A: The original matrix
  • B: A copy of the original matrix
  • C: A reference to the transposed matrix
  • D: Nothing
View Answer
C

Q700: Which operator is overloaded to handle matrix assignment?
  • A: +
  • B: -
  • C: =
  • D: *
View Answer
C

Test Your Knowledge

Take a timed quiz on Introduction to Programming

🚀 Start Quiz Now