Description of this paper

DEVRY CIS170B WEEK 3 quiz

Description

solution


Question

Question;Question 1. Question;(TCO 5) When writing a program, if you know exactly how many;times statements in a loop should execute, use the _____ structure.;do while;for;goto;while;Instructor Explanation: With the FOR structure, the programmer;specifies the number of iterations the loop will perform.;Points Received: 4 of 4;Comments;Question 2. Question;(TCO 5) When used within a loop structure, the;statement causes execution to jump out of the loop and proceed with subsequent;statements in the program.;break;continue;goto;jump;Instructor Explanation: BREAK breaks completely out of the loop;whereas CONTINUE transfers control to the loop?s conditional expression.;Points Received: 4 of 4;Comments;Question 3. Question;(TCO 5) A block of statements within the body of a FOR loop;must be surrounded with _____.;curly braces {};parentheses ();square brackets [];None of the above;Instructor Explanation: Although a loop body containing a single;statement needs no braces, several statements must be surrounded with curly;braces.;Points Received: 4 of 4;Comments;Question 4. Question;(TCO 5) What output will this set of statements produce?;int a = 1;while (a;< 1);Console.Write("{0}\t", a);a++;Console.Write("{0}\t", a);An infinite loop;An exception;1;1 1;Instructor Explanation: Because ?a? will never be less than 1, the;WHILE loop will not execute. The value of ?a? will remain 1.;Points Received: 4 of 4;Comments;Question 5. Question;(TCO 5) In this code, the inner FOR loop _____.;int i = 1;j = 1;for (i =;1, i < 4, i++);for (j;= 1, j < 4, j++);Console.Write("{0}{1} ", i, j);contains a syntax error;is nested;is like a blue sky;is like a light;Instructor Explanation: The inner FOR is nested inside the outer FOR;so for every execution of the outer FOR, the inner FOR will execute three;times.;Points Received: 4 of 4;Comments;Question 6. Question;(TCO 5) Your program keeps asking for last names from the;user until he/she enters ?####.? In this context, the ?####? is used as a(n);accumulator;counter;sentinel value;test value;Instructor Explanation: A sentinel value is a dummy variable not used;for processing. It?s used to signify when a loop should stop executing.;Points Received: 4 of 4;Comments;Question 7. Question;GOTO statements should be avoided.;True;False;Instructor Explanation;Yes, since they are often result in unstructured and;confusing code. Break and Continue is a;much better choice.;Note that GOTO usually works with a Label.;Points Received: 4 of 4;Comments;Question 8. Question;A walkthrough is a form of software peer review the;programmer leads members of the development team through the software code, and;the participants ask questions and make comments about possible errors;problems of not adhering to development standards, and other problems.;True;False;Points Received: 4 of 4;Comments;Question 9. Question;Accumulators and counters mean the same thing.;True;False;Points Received: 4 of 4;Comments;Question 10. Question;Nesting or indenting multiple programming loops is a good;coding practice.;True;False;Points Received: 4 of 4;Comments;Question 11. Question;The For Loop is used when the user wishes to stop the Loop;from executing, and is used when the number of Loop Executions is unknown.;True;False;Points Received: 4 of 4;Comments;* Times are displayed;in (GMT-07:00) Mountain Time (US & Canada)

 

Paper#36412 | Written in 18-Jul-2015

Price : $22
SiteLock