A nested selection structure can be contained in . . . . . . . . of another selected structure.

Only in the truth part
Only in the false part
Either in truth or in false part
Both in truth and in false part

The correct answer is: D. Both in truth and in false part.

A nested selection structure is a selection structure that is contained within another selection structure. The nested selection structure can be contained in either the true or false part of the outer selection structure.

For example, the following code contains a nested selection structure:

if (condition1) {
if (condition2) {
// Do something
} else {
// Do something else
}
} else {
// Do something else
}

In this example, the nested selection structure is contained in the true part of the outer selection structure. If condition1 is true, then the nested selection structure will be executed. If condition1 is false, then the nested selection structure will not be executed.

The following code contains a nested selection structure that is contained in the false part of the outer selection structure:

if (condition1) {
// Do something
} else {
if (condition2) {
// Do something else
} else {
// Do something else
}
}

In this example, the nested selection structure is contained in the false part of the outer selection structure. If condition1 is false, then the nested selection structure will be executed. If condition1 is true, then the nested selection structure will not be executed.

Nested selection structures can be used to create complex programs that can handle a variety of conditions.

Exit mobile version