Software Engineering-I MCQs with Answers
Practice important Software Engineering-I MCQs with answers and explanations.
Chapter: 29
Q521:
The use of magic numbers in code should be avoided. What should be used instead?
A. Variables
B. Named constants
C. Global variables
D. Inline comments
Correct Answer:
B
Chapter: 29
Q522:
Fill in the blank: Floating point constants should always be written with a _______ before the decimal point.
A. digit
B. zero
C. comma
D. space
Correct Answer:
A
Chapter: 29
Q523:
What is the effect of declaring classes in individual header files?
A. Increased compilation time
B. Reduces readability
C. Ensures organized code
D. Complicates debugging
Correct Answer:
C
Chapter: 29
Q524:
What is the recommended practice for loop variable initialization?
A. At the end of the loop
B. After the loop
C. Immediately before the loop
D. At the beginning of the loop
Correct Answer:
C
Chapter: 29
Q525:
In what situation should the use of goto statements be considered?
A. Always
B. Rarely
C. Only for structuring
D. When breaking nested loops
Correct Answer:
B
Chapter: 29
Q526:
What should be declared in the top of a C++ header file to avoid compilation errors?
A. Function prototypes
B. Class definitions
C. Include statements
D. Macro definitions
Correct Answer:
D
Chapter: 29
Q527:
Which statement about floating point constants is true?
A. They can be written without a decimal point.
B. They should always have a decimal point.
C. They should not have digits before the decimal point.
D. They should always be integers.
Correct Answer:
B
Chapter: 29
Q528:
When using conditional statements, what should be avoided?
A. Executable statements
B. Temporary variables
C. Clear comments
D. Readable conditions
Correct Answer:
A
Chapter: 30
Q529:
What is a major problem with comments in code?
A. They are always accurate
B. They can become inaccurate over time
C. They are mandatory
D. They are always helpful
Correct Answer:
B
Chapter: 30
Q530:
What is the preferred language for writing comments in an international environment?
A. Spanish
B. French
C. English
D. German
Correct Answer:
C
Chapter: 30
Q531:
Which symbol should be used for single-line comments in Java and C++?
A. #
B. //
C. /*
D. --
Correct Answer:
B
Chapter: 30
Q532:
What is the recommended basic indentation size for code?
A. 1 space
B. 2 spaces
C. 3 spaces
D. 4 spaces
Correct Answer:
B
Chapter: 30
Q533:
Using parentheses in expressions helps to:
A. Increase complexity
B. Reduce ambiguity
C. Make code longer
D. Remove comments
Correct Answer:
B
Chapter: 30
Q534:
What does the following expression check: if (x & MASK == BITS)?
A. Correctness of MASK
B. Shift operations
C. Comparison of two variables
D. None of the above
Correct Answer:
D
Chapter: 30
Q535:
What is the issue with complex expressions in code?
A. They are easier to read
B. They are always correct
C. They can be hard to understand
D. They do not need parentheses
Correct Answer:
C
Chapter: 30
Q536:
Which of the following is a guideline for writing comments?
A. Use any language
B. Use only block comments
C. Use English for all comments
D. Make comments lengthy
Correct Answer:
C
Chapter: 30
Q537:
How should the following line be written for clarity? subkey = subkey >> (bitoff – (bitoff >> 3) << 3);
A. subkey = subkey >> (bitoff & 0x7);
B. subkey = subkey >> (bitoff - (bitoff >> 3));
C. subkey = subkey >> bitoff;
D. subkey = subkey >> (bitoff + 0x7);
Correct Answer:
A
Chapter: 30
Q538:
Which of the following should be used to comment out sections of a file in Java?
A. //
B. #
C. /*
D. --
Correct Answer:
C
Chapter: 30
Q539:
In the context of Java and C++, how should complex expressions be handled?
A. Keep them as is
B. Break them down into simpler statements
C. Always use more operators
D. Make them longer
Correct Answer:
B
Chapter: 30
Q540:
What should be done if a condition is difficult to understand due to negation?
A. Leave it as is
B. Use comments
C. Rewrite it in natural form
D. Use complex expressions
Correct Answer:
C