Software Engineering-I MCQs with Answers
Practice important Software Engineering-I MCQs with answers and explanations.
Chapter: 32
Q561:
What is the main benefit of modularity in programming?
A. It reduces the size of functions.
B. It increases the size of functions.
C. It combines multiple functions into one.
D. It eliminates the need for functions.
Correct Answer:
A
Chapter: 32
Q562:
Which operator in C/C++ uses short-circuit evaluation?
A. &&
B. ||
C. ++
D. --
Correct Answer:
A
Chapter: 32
Q563:
What does the function `swap` do in the provided code?
A. It finds the minimum element.
B. It swaps two variables.
C. It sorts an array.
D. It calculates the average of two numbers.
Correct Answer:
B
Chapter: 32
Q564:
In the selection sort algorithm, what does the `minimum` function return?
A. The maximum value in the array.
B. The minimum index in a specified range.
C. The total number of elements.
D. The last element of the array.
Correct Answer:
B
Chapter: 32
Q565:
What is the purpose of the `partition` function in the quicksort algorithm?
A. It swaps two values.
B. It finds the pivot element.
C. It sorts the array.
D. It calculates the minimum value.
Correct Answer:
B
Chapter: 32
Q566:
Which of the following statements is TRUE regarding side effects in functions?
A. They do not affect program execution.
B. They only change the return value.
C. They can modify parameters or external variables.
D. They are beneficial for all functions.
Correct Answer:
C
Chapter: 32
Q567:
What happens if the pointer is NULL in the while loop condition `ptr->data < myData && ptr != NULL`?
A. The program executes normally.
B. The program will crash.
C. The condition will always be true.
D. The loop will not execute.
Correct Answer:
B
Chapter: 32
Q568:
In the context of the provided code, what is a side effect?
A. Returning a value from a function.
B. Modifying external variables.
C. Only returning the sum of two numbers.
D. None of the above.
Correct Answer:
B
Chapter: 32
Q569:
When is short-circuiting particularly useful?
A. When comparing two values.
B. When avoiding null pointer exceptions.
C. When running loops.
D. When initializing variables.
Correct Answer:
B
Chapter: 32
Q570:
Fill in the blank: Modularity helps in improving the _______ of the code.
A. complexity
B. readability
C. inefficiency
D. ambiguity
Correct Answer:
B
Chapter: 32
Q571:
What will be the value of `c` after executing `c = f1(a) + f2(b)` if `a = 3` and `b = 4`?
A. 8
B. 9
C. 10
D. 7
Correct Answer:
A
Chapter: 32
Q572:
What is the main goal of breaking functions into smaller pieces?
A. To make the code longer.
B. To enhance readability and reusability.
C. To reduce the number of functions.
D. To complicate the program structure.
Correct Answer:
B
Chapter: 32
Q573:
Which of the following can lead to programming errors?
A. Short-circuit evaluation.
B. Side effects of functions.
C. Modularity.
D. All of the above.
Correct Answer:
B
Chapter: 32
Q574:
In the context of the selection sort algorithm, which function performs the swapping of elements?
A. selectionSort
B. swap
C. minimum
D. quickSort
Correct Answer:
B
Chapter: 32
Q575:
What is the output of the following code segment if `a = 3`?c = f1(a) + f2(a)
A. 7
B. 6
C. 3
D. 9
Correct Answer:
D
Chapter: 33
Q576:
What happens if i is initially 3 in the statement array[i++] = i;?
A. array[3] is set to 3
B. array[3] is set to 4
C. array[4] is set to 3
D. array[4] is set to 4
Correct Answer:
A
Chapter: 33
Q577:
What is a common coding mistake with the statement array[i++] = array[i++] = x;?
A. Multiple assignments are safe
B. Only one assignment occurs
C. Side effects cause ambiguity
D. No assignments are made
Correct Answer:
C
Chapter: 33
Q578:
In the statement int i, j = 0;, which variable is initialized to 0?
A. i and j
B. i only
C. j only
D. Neither
Correct Answer:
A
Chapter: 33
Q579:
Using “,” in code is generally considered:
A. Safe
B. Very dangerous
C. Redundant
D. Unnecessary
Correct Answer:
B
Chapter: 33
Q580:
According to guidelines, when should you not use multiple assignments?
A. Always
B. When initializing variables
C. When declaring variables
D. Never
Correct Answer:
A