Lesson 2

docx

School

Ashworth College *

*We aren’t endorsed by this school

Course

K08V.1.1

Subject

Computer Science

Date

Jan 9, 2024

Type

docx

Pages

6

Uploaded by PrivateIronPorcupine45

Report
Question 1 A programmer created a while loop in C#, but failed to provide an action in the while statement, which caused the condition of the while to return false. What will the result be? Question options: A compiler error An infinite loop Code execution stops after 100 loops based on the debugger settings True Question 2 Assuming a is a bool with a value of false, which of the following evaluates to true? Question options: !(!a) a !a !a! Question 3 Which of the following operators ensures that at least one out of multiple conditions is TRUE? Question options: || && == ^ Question 4 The | and & operators will __________ evaluate all operands in a conditional statement. Question options: never
always conditionally prematurely Question 5 In a loop, the programmer can terminate execution within the executing block of code by using the __________ statement. Question options: default continue break XOr Question 6 In a switch statement, the __________ case will execute code when no match occurs between the switch's expression label and the case label. Question options: default continue break XOr Question 7 In a loop, the programmer can continue execution within the executing block of code, but skip all remaining lines and simply return to the loop continuation test by using the __________ statement. Question options: default continue break XOr
Question 8 Which case of the following would warrant using the boolean logical inclusive OR (|) rather than the conditional OR (||)? Question options: Testing if two conditions are both true Testing if at least one of two conditions is true Testing if at least one of two conditions is true when the right operand has a required side effect Testing if at least one of two conditions is true when the left operand has a required side effect Question 9 The __________ loop always performs the logic condition test before attempting to execute the loop's body. Question options: for case do while switch Question 10 In a switch statement, the programmer can terminate execution within the executing case by using the __________ statement. Question options: default continue break XOr Question 11
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
The for loop header has three items specified: control variable initialization, the loop continuation condition, and __________ of the control variable. Question options: increment/decrement looping switch break Question 12 The Boolean logic AND operator is represented by which of the following? Question options: && & || ! Question 13 What is the Windows key sequence for typing the end-of-file indicator in Command Prompt window? Question options: <Alt>z <Ctrl>z <Windows>z <Shift>z Question 14 The conditional OR operator is represented by which of the following? Question options: && |
|| ^ Question 15 Which statement below is FALSE? Question options: Structured programming produces programs that are easier to test. Structured programming requires four forms of control. Structured programming produces programs that are easier to modify Structured programming promotes simplicity. Question 16 The conditional AND operator is represented by which of the following? Question options: && & || ^ Question 17 The loop body of a do…while statement always executes: Question options: zero times. at least once. more than once. undeterminable. Question 18 Which of the following statements about the break statement is FALSE?
Question options: The break statement is used to exit a repetition statement early and continue execution after the loop. A break statement can only break out of an immediately enclosing <strong>while, for, do… while</strong> , or <strong>switch </strong> statement. The break statement, when executed in a <strong>while, for</strong> , or <strong>do…while</strong> , skips the remaining statements in the loop body and proceeds with the next iteration of the loop. Common uses of the break statement are to escape early from a loop or to skip the remainder of a switch. Question 19 Control-statement stacking is the process of: Question options: placing control statements within each other. placing control statements one after another. reducing the number of statements required by combining statements. None of the above Question 20 The exclusive OR operator is represented by which of the following? Question options: ^ ! $ @
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help