Filters
Question type

Study Flashcards

Which of the following is not a control statement in C#


A) do…while
B) loop
C) switch
D) for

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

The C# operator ^ can be used for exponentiation.

A) True
B) False

Correct Answer

verifed

verified

Infinite loops are caused when the loop-continuation condition in a while,for or do…while statement never becomes true.

A) True
B) False

Correct Answer

verifed

verified

Which of the following statements about the break statement is false


A) The break statement is used to exit a repetition statement early and continue execution after the loop.
B) A break statement can only break out of an immediately enclosing while, for, do…while or switch statement.
C) The break statement, when executed in a while, for or do…while, skips the remaining statements in the loop body and proceeds with the next iteration of the loop.
D) Common uses of the break statement are to escape early from a loop or to skip the remainder of a switch.

E) A) and B)
F) B) and C)

Correct Answer

verifed

verified

C

The for repetition statement handles the details of counter-controlled repeti tion.

A) True
B) False

Correct Answer

verifed

verified

Which of the following statements is true


A) strings can be used in switch expressions, but string literals cannot be used in case labels.
B) strings cannot be used in switch expressions, but string literals can be used in case labels.
C) strings can be used in switch expressions, and string literals can be used in case labels.
D) strings cannot be used in switch expressions, and string literals cannot be used in case labels.

E) None of the above
F) B) and D)

Correct Answer

verifed

verified

Counting loops should be controlled with whatever data type most closely reflects the operations taking place,whether that is an int,float or double.

A) True
B) False

Correct Answer

verifed

verified

Braces are normally included with do…while statements even when unnec essary to avoid confusion with the while statement.

A) True
B) False

Correct Answer

verifed

verified

Which statement below is false


A) Structured programming produces programs that are easier to test.
B) Structured programming requires four forms of control.
C) Structured programming produces programs that are easier to modify
D) Structured programming promotes simplicity.

E) A) and D)
F) All of the above

Correct Answer

verifed

verified

B

Control-statement stacking is the process of:


A) placing control statements within each other
B) placing control statements one after another
C) reducing the number of statements required by combining statements
D) None of the above.

E) A) and D)
F) A) and C)

Correct Answer

verifed

verified

Only one control variable may be initialized,incremented or decremented in a for statement header.

A) True
B) False

Correct Answer

verifed

verified

for statements cannot be represented as while statements.

A) True
B) False

Correct Answer

verifed

verified

Only the statements for one case can be executed in any one execution of a switch statement.

A) True
B) False

Correct Answer

verifed

verified

The initialization and increment expressions in a for statement can be comma-separated lists that enable you to use ________.


A) multiple initialization expressions
B) multiple increment expressions
C) multiple initialization expressions and/or multiple increment expressions
D) neither multiple initialization expressions nor multiple increment expressions

E) B) and C)
F) All of the above

Correct Answer

verifed

verified

Which of the following is equivalent to this code segment Segment: int total = 0; For (int i = 0;i < = 20;i += 2) { Total += i; }


A) int total = 0;
for (int i = 20; i < 0; i += 1)
{
total += i;
}
B) int total = 0;
for (int i = 0; i <= 20; total += i, i += 2) ;
C) int total = 0;
for (int i = 0, i <= 20, total += i; i += 2) ;
D) int total = 0;
for (int i = 2; i < 20; total += i, i += 2) ;

E) B) and C)
F) None of the above

Correct Answer

verifed

verified

Many classes provide methods to perform common tasks that do not require specific objects-they must be called using a class name.Such methods are called ________ methods.


A) classwide
B) dot (.)
C) console
D) static

E) A) and B)
F) B) and D)

Correct Answer

verifed

verified

A control variable that's declared in a for statement header is not accessible outside of the body of the for statement.

A) True
B) False

Correct Answer

verifed

verified

Suppose variable gender is MALE and age equals 60,how is the expression (gender == FEMALE) && (age >= 65) Evaluated


A) The condition (gender == FEMALE) is evaluated first and the evaluation stops immediately.
B) The condition (age >= 65) is evaluated first and the evaluation stops immediately.
C) Both conditions are evaluated, from left to right.
D) Both conditions are evaluated, from right to left.

E) C) and D)
F) A) and D)

Correct Answer

verifed

verified

It's possible to specify that a constant is of type decimal by appending the letter m to the constant.

A) True
B) False

Correct Answer

verifed

verified

True

Which of the following statements about the continue statement is true


A) The continue statement is used to exit a repetition statement early and continue execution after the loop.
B) The continue statement is used to continue after a switch statement.
C) The continue statement does not alter the flow of control.
D) A continue statement proceeds with the next iteration of the immediately enclosing while, for, do…while statement.

E) None of the above
F) A) and D)

Correct Answer

verifed

verified

Showing 1 - 20 of 66

Related Exams

Show Answer