Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

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

Username is available taken
show password

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.

Question

An initialization expression may be omitted from the for loop if no initialization is required.
click to flip
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't know

Question

The scope of a variable declared in a for loop's initialization expression always extends beyond the body of the loop.
Remaining cards (78)
Know
0:00
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

Stack #4119023

QuestionAnswer
An initialization expression may be omitted from the for loop if no initialization is required. True
The scope of a variable declared in a for loop's initialization expression always extends beyond the body of the loop. False
The condition that is tested by a while loop must be enclosed in parentheses and terminated with a semicolon. False
The update expression of a for loop can contain more than one statement, for example: for(i = 5; i <= 10; i++, total+= sales) True
Multiple relational expressions cannot be placed into the test condition of a for loop. True
In C++ 11 you can pass a string object as an argument to a file stream object's open member function. True
string objects have a member function named c_str that returns the contents of the object formatted as a null-terminated C-string. True
The two important parts of a while loop are the expression that is tested for a true or false value and a statement or block that is repeated as long as the expression is true
Something within a while loop must eventually cause the condition to become false or a(n) ________ results. infinite loop
The statements in the body of a while loop may never be executed while the statements in the body of a do-while loop will be executed at least once
A statement that may be used to stop a loop's current iteration and begin the next one is continue
A statement that causes a loop to terminate early is break
A special value that marks the end of a list of values is a sentinel
In the following statement, which operator is used first? while (x++ < 10) <
What will the following code display? Int number=6; cout<<number++<<endl; 6
What will the following code display? int number = 6; cout << ++number << endl; 7
In a for statement, this expression is executed only once: initialization
You may define a ________ in the initialization expression of a for loop. variable
The do-while loop is considered a post-test loop
The ________ loop is ideal in situations where you want the loop to iterate at least once. do-while
The ________ loop is a good choice when you know how many times you want the loop to iterate in advance of entering the loop. for
The ________ loop is a good choice when you do not want the loop to iterate if the condition is FALSE in the beginning. while
You should be careful when using the equality operator to compare floating point values because of potential round-off errors. True
The following code correctly determines whether x contains a value in the range of 0 through 100, inclusive. if (x > 0 && <= 100) False
What is assigned to the variable result given the statement below with the following assumptions: x = 10, y = 7, and x, result, and y are all int variables. result = x >= y; 1
Which of the following expressions will determine whether x is less than or equal to y? x <= y
These operators connect two or more relational expressions into one, or reverse the logic of an expression. logical
Without this statement appearing in a switch construct, the program "falls through" all of the statements below the one with the matching case expression. break
The default section of a switch statement performs a similar task similar to the ________ portion of an if/else if statement. trailing else
When a program lets the user know that an invalid choice has been made, this is known as: input validation
The only difference between the get function and the >> operator is that get reads the first character typed, even if it is a space, tab, or the [Enter] key. True
The cin << statement will stop reading input when it encounters a newline character. True
When C++ is working with an operator, it strives to convert the operands to the same type. True
Question 4 1 / 1 pts The following statement will output $5.00 to the screen: cout << setprecision(5) << dollars << endl; False
In C++, it is impossible to display the number 34.789 in a field of 9 spaces with 2 decimal places of precision. False
The ________ causes a program to wait until information is typed at the keyboard and the [Enter] key is pressed. cin object
Which of the following must be included in any program that uses the cin object? the header file iostream
Which of the following will allow the user to input the values 15 and 20 and have them stored in variables named base and height, respectively? cin >> base >> height;
What will be displayed after the following statements execute? int num1 = 5; int num2 = 3; cout << "The result is " << (num1 * num2 + 10) << endl; The result is 25
What is the value of average after the following code executes? double average; average = 1.0 + 2.0 + 3.0 / 3.0; 4.0
What is the value of cube after the following code executes? double cube, side; side = 5.0; cube = pow(side, 3.0); 125.0
When the final value of an expression is assigned to a variable, it will be converted to the data type of the variable
When a variable is assigned a number that is too large for its data type, it overflows
Which statement is equivalent to the following? number += 1; number = number + 1;
This manipulator is used to establish a field width for the value that follows it: setw
You can control the number of significant digits in your output with the ________ manipulator. setprecision
What is TRUE about the following statement? cout << setw(4) << num4 << " "; It allows four spaces for the value in num4.
Which of the following statements will pause the screen until the [Enter] key is pressed? cin.get();
Which of the following statements will allow the user to enter three values to be stored in variables length, width, and height, in that order? cin.get(length, width, height);
Which of the following functions tells the cin object to skip one or more characters in the keyboard buffer? cin.ignore
________ reads a line of input, including leading and embedded spaces, and stores it in a string object. getline
How many characters will the following statement read into the variable myString? cin >> setw(10) >> myString; 9
A debugging process where you, the programmer, pretend you are a computer and step through each statement while recording the value of each variable at each step is known as hand tracing
The preprocessor reads a program before it is compiled and only executes those lines beginning with # symbol. True
In programming, the terms "line" and "statement" always mean the same thing. False
In C++, key words are written in all lowercase letters. True
The preprocessor executes after the compiler. False
When typing your source code into the computer, you should be careful since most of your C++ instructions, header files, and variable names are case sensitive. True
In C++ you are required to name your variables so they indicate the purpose they will be used for. False
Floating point constants are normally stored in memory as doubles. True
C++ does not have a built-in data type for storing strings of data. True
A statement that starts with a hashtag (or pound) symbol (#) is called a preprocessor directive
In the following statement, the characters Hello! are a(n) cout << "Hello!"; string literal
Which of the following must be included in any program that uses the cout object? the header file iostream
The ________ causes the content of another file to be inserted into a program. #include directive
Every complete C++ program must have a function named main
In a cout statement, which of the following will advance the output position to the beginning of the next line? endl or \n
A(n) ________ represents a storage location in the computer's memory. variable
Data items whose values do NOT change while the program is running are literals
A variable definition tells the computer the variable's name and the type of data it will hold
You must have a ________ for every variable you intend to use in a program. variable definition
Which of the following is NOT a valid C++ identifier? 1user
What will the following code display? int x = 23, y = 34, z = 45; cout << x << y << z << endl; 233445
The numeric data types in C++ can be broken into two general categories which are integers and floating-point numbers
A character literal is ________, whereas a string literal is ________ enclosed in single quotation marks, enclosed in double quotation marks
The float data type is considered ________ precision and the double data type is considered ________ precision. single, double
Which of the following lines must be included in a program that has string variables? #include <string>
In memory, C++ automatically places a(n) ________ at the end of string literals which ________. null terminator, marks the end of the string
Select all that apply. Which of the following statements is(are) TRUE about named constants? The content of a named constant is read-only. A named constant is defined using the const qualifier. The value of a named constant cannot be changed while the program is running.
Created by: wbuice
 

 



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