1/48
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is the appropriate data type to store an email address? ( example blackbirdSR71@spyplane.net)
String data type
What represents storage locations in the computer's memory?
Variables
What will the code below display to the console?
cout << "Monday";
cout << "Tuesday";
cout << "Wednesday";
MondayTuesdayWednesday
(T/F) number and NUMBER are considered to be the same variable name.
False
Which of operator is used to get the remainder from dividing two integers?
Modulus %
(T/F) When C++ is performing assignment, it converts the value on the right-hand side to the type of variable on the left-hand side, even if this causes loss of information.
True
What is the value of the following expression in C++? 18 - 11/2
13. Division first then subtraction
11/2 = 5 (5.5 is truncated to 5, integer division)
18 - 5 = 13
What is the correct way to change the value stored in a variable by adding 1 to is?
variable = variable + 1;
A file must be ______ before data can be written to or read from it.
Opened
(T/F) To read from a file, you must first define a variable of type iostream.
False
What is the correct way to output a number that will have exactly 2 digits after the decimal point?
cout << fixed << setprecision(2);
Is the expression evaluated as true or false?
int a = 2, c = 6;
a + 4 >= 2 *c
False
Is the expression evaluated as true or false?
int a = 2, c = 6;
c > 6
False
Which loop's body will always be executed at least once?
do-while
What is the output of the following c ++ statements?
int x = 1;
while ( x <= 3 )
cout << x;
1111111111111111111111111.......(infinite loop)
(T/F) A variable may be defined (declared) in the initialization expression of the for loop.
True
What kind of expression cannot be used to declare the size of an array in an array declaration?
Variable
What is the subscript of the last element in the following array? int x [100];
99
(T/F) You can used the assignment operator to copy one entire array to another in a single assignment statement. example array1 = array2;
False
Variables that receive values sent into a function are called _______. Example x in: void plusses( int x ) {....}
Parameters
Statements in a function body are executed when the function is :
Called
A function contains this statement: return; What is the return type of the function?
Void
A _______ variable is declared outside all functions.
Global
(T/F) When you use call-by-reference, the parameter is just an alias for the argument variable.(there is only one memory location with two names)
True
Which of the following operators is used to access a member (or field) of a structure?
. (dot)
(T/F) A function may return a structure.
True
(T/F) The contents of and entire structure variable can be displayed by passing the structure variable to the cout object using <<
False
A _______ is used to translate each source code instruction into the appropriate machine language instruction.
Compiler
Which of the following is lost (erased) when its power supply is lost?
Main memory (RAM)
A step by step ordered procedure that solves a problem in a finite number of precise steps is:
An algorithm
What is the exact output of the following C++ code when executed?
cout << "[" << left << setw(8) << 1234 << "]" << endl;
[1234 ]
Which relational expression in C++ will be true when x is between 1 and 100 (inclusive) and false otherwise?
1 <= x && 100 >= x
(T/F) int is a valid variable name in C++.
False
(T/F) MYVARIABLE#3 is a valid variable name in C++.
False
(T/F) a_1_2_3 is a valid variable name in C++.
True
Given the following variables that have been defined and initialized:
int j1 = 7;
int j2 = 5;
double d1 = 11.67;
double d2 = 77.7;
What is the value of the expression?
d2 / j1
11.1
Given the following variables that have been defined and initialized:
int j1 = 7;
int j2 = 5;
double d1 = 11.67;
double d2 = 77.7;
What is the value of the expression?
20 - j2 * 2 + j1
17
Given the following variables that have been defined and initialized:
int j1 = 7;
int j2 = 5;
double d1 = 11.67;
double d2 = 77.7;
What is the value of the expression?
33 % j2
3
Given the following variables that have been defined and initialized:
int j1 = 7;
int j2 = 5;
double d1 = 11.67;
double d2 = 77.7;
What is the value of the expression?
d2 - j1 - 2
68.7
Given the following variables that have been defined and initialized:
int j1 = 7;
int j2 = 5;
double d1 = 11.67;
double d2 = 77.7;
What is the value of the expression?
j1 = d1; // What is stored in j1 after this?
11
The following are all examples of what?
72 'A' " Hello World " 2.8712
Literals
Which of the following is equivalent to x++?
x = x + 1;
The file must exist in secondary storage before you do what?
Open it for input
(T/F) The = operator and the == operator perform the operation when used in a Boolean expression.
False
(T/F) In pass by value, the value of the argument in the function call is copied into the function parameter. (there are two separate variables)
True
(T/F) Two separate functions in the same program may have local variables with the same name.
True
A program will "fall through" a case section of a switch statement unless it has what?
break
When a loop processes data until it reaches a special value that marks the end of a list of values, it is called a :
Sentinel-controlled loop
What is the output of the code below?
float x = 3.0;
if ( x > 0 )
{
float x = 2.2;
}
cout << x << endl;
3.0