Introduction to Programming MCQs with Answers
Practice important Introduction to Programming MCQs with answers and explanations.
Multiple Choice Questions
Q191: When dealing with a two-dimensional array, which structure is most commonly used for processing?
- A: Recursive functions
- B: Conditional statements
- C: Loops
- D: Exception handling
View Answer
C
Q192: How do you access an element in a two-dimensional array?
- A: a[column][row]
- B: a[row][column]
- C: a[column][row]
- D: a[row][column]
View Answer
B
Q193: What does the flowchart for inputting a two-dimensional array typically include?
- A: A single loop for rows
- B: Nested loops for rows and columns
- C: A loop for columns only
- D: A recursive function
View Answer
B
Q194: In the provided example, how is the two-dimensional array a flipped for output?
- A: By swapping columns
- B: By swapping rows
- C: By swapping elements randomly
- D: By reversing row order while maintaining column order
View Answer
B
Q195: What character is used to create a tab space in output formatting?
- A: \n
- B: \t
- C: \r
- D: \b
View Answer
B
Q196: When transposing a square matrix, which elements remain unchanged?
- A: Diagonal elements
- B: Off-diagonal elements
- C: All elements
- D: None of the elements
View Answer
A
Q197: What is a common mistake when swapping elements in matrix transposition?
- A: Swapping the diagonal elements
- B: Swapping rows and columns in all cases
- C: Swapping elements without using a temporary variable
- D: Not considering the matrix size
View Answer
C
Q198: How do you handle transposing a matrix without altering diagonal elements?
- A: Process the upper triangle only
- B: Process the lower triangle only
- C: Process the entire matrix
- D: Avoid processing the diagonal elements
View Answer
A
Q199: What is the main purpose of the transposeMatrix function?
- A: To flip the matrix upside down
- B: To interchange rows and columns
- C: To sort the matrix in ascending order
- D: To reverse the matrix elements
View Answer
B
Q200: In the salary calculation problem, what should be done to identify 'unlucky' employees?
- A: Compare their net salaries with those of lower salaries
- B: Compare their gross salaries with those of lower salaries
- C: Identify those with the highest gross salaries
- D: Identify those with the highest net salaries
View Answer
A