Save
Busy. Please wait.
Log in using Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password

why


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't know
Remaining cards (0)
Know
0:00
share
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

C# Chapter 6 Test

Statement/QuestionsTrue/False & Fill in the Blank
int sum = 0; int number = 0; while(number <10) { sum=sum+number; console.writeline(sum); } The statement above prints the values of 0-9 on separate lines False
int sum = 0; int number = 0; while(number <10) { sum=sum+number; console.writeline(sum); } The statement above produces seven random numbers False
The while statement is only type of loop construct that can be used to develop a sentinel-controlled loop False
Iteration is a technique used where a method calls itself repeatedly until it arrives at the solution False
Class diagrams show the data method and property members of a class False
The sentinel value is used as the operand in the conditional expression for an indefinite loop True
Unlike the sentinel-controlled loop, the variable used with a state-controlled loop differs from the variable used to store the data that is being processed True
If a numeric variable is being changed by a consistent amount with each iteration through the loop, the while statement is the best choice of loop constructs False
Windows applications use an event-driven model to manage the interaction between the user and the GUI by handling the repetition for you True
With nested loops, the outermost loop is always totally complete before the innermost loop is executed False
A state-controlled loop should be designed when you know the number of times the statement must be executed. False
In C# curly braces must be added to surround all loop bodies False
The do...while statement is posttest loop, which means that the conditional expression is tested before any of the statements in the body of the loop are performed. True
int sum=0 int number =1 while(number<100) { sum=sum+number; } The program above produces an infinite loop True
In order to use the messagebox.show() method, you need to not only add a reference to the namespace which includes the class, but also add a using directive to the program statements True
With while loops, if the conditional expression evaluates to true, the body of the loop is not performed; control transfers tot he statement following the loop True
To write a recursive solution, a base case needs to be identified True
C# performs automatic garbage collection once the loop is finished and releases any variable declared as part of the loop True
You often need to do a "prime the read" for counter controlled loops which means that you would input a value before going into the body of the loop False
An off-by-one error is common problem associated with counter-controlled loops where the loop body is performed one too many or one too few times True
int loop Variable =0; do { console.writeline("Count = {0:}", ++loopVariable); }while(loopVariable < 5); How many time will be loop body be executed if the conditional expression is changed to (loopVariable ==5)? 5
for (int outer =0; outer < 2; outer ++) { for int inner =0; inner <3; inner ++) { Console.writeline("Outer:{0}\tInner: {1}", outer, inner); } } How many lines will be printed for the above nested loop? 6
The only posttest loop structure available in C# is do...while
The loop control structure used to move through a collection (group of data items) that doesnt require you to increment a loop control variable or test the expression to determine when all data has been process is the ________ statement foreach
int loopVariable = 0; do { writeline("Count = {0}', ++loopVariable); }while(loopVariable <5); What will be printed during the first iteration though the loop? 1
What is a requirement of the sentinel-controlled loop shared by counter-controlled loops? The expression must exeluate to false in order for the loop to be executed.
With the while loop, the body of the loop is _________. performed as long as the conditional expression evaluates to true
To "prime the read" with a loop, you place an input statement_________. before the loop body
You must tell the user what value to type to end the loop for ____. sentinel-controlled loops
int inner; for(int outer =0; outer < 3; outer++) { for(inner=1; inner <2; inner++) writeline("Outer: {0}\tInner:{1}", outer, inner); } The nested for statement above displays how many lines of output? 3
In order to write a recursive solution ___. the simplest case should be determined
for int i =0; i <5; i++) write(i+"\t"); Given the code snippet above, how many times will the loop body be executed? 5
Which of the following is NOT a keyword used to enable unconditional transfer of control to a different program statement? While
The most appropriate sentinel value that might be selected for month of the year is ___. 0
int loopVariable= 0; do { writeline("Count ={0:}", ++loopVariable); }while (loopVariable <5); How many times will be loop body be executed? 5
the conditional expression used with the for statement ___. must evaluate to false in order for the loop body to be executed
a flag-controlled loop is also called a state-controlled loop
int counter =0; while(counter <100) { writeline(counter) counter++ } Looking above, if the loop body was changed from count++; to counter +=5:, how many times would the loop body be executed? 20
The event-driven model used create Windows applications handles the repetition for you
A method that calls itself repeadly until it arrives at the solution is an recursive
Inside the for statement, when you place a semicolon after the parentheses without anything to the left of it, it indicates that no statement or a(n) ____ statemetn is associated with the initialize portion. null
When one of the program statement included within the body of a loop is another loop, a(n) ___ loop is created nested
The ___ statement is a pretest form of loop which is considered a specialized form of the while statement and is usually associated with-controlled types of loops; While
The ____ method of the messagebox class displays a predefined dialog box that can contain text, captions for the title bar, special buttons, and icons. Show()
The only posttest loop structure available with C# is the ___ loop structure do while
A sentinel value is a(n) ___. It is a value that should not be processed. extreme value
if(int.TryParse(inStringValue, out integer
Created by: acat521
 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!

"Know" box contains:
Time elapsed:
Retries:
restart all cards