UTSA Values of Results Calculus Questions
Question Description
I’m working on a c++ multi-part question and need an explanation and answer to help me learn.
Question 1
Suppose a = 5. After the execution of the statement ++a; the value of a is 6.
True or False
Question 2
Suppose we declare a variable sum as an int. The statement “sum += 7;” is equivalent to the statement “sum = sum + 7;”.
True or False
Question 3
In the following code what is the value of result
int result = 9;
result = result / 2;
Question 4
In the following code what is the value of result
int result = 10;
result = result / 2 + 2;
Question 5
The value ‘$’ can be stored in a char variable?
True or False
Question 6
In the following code what is the value of result
int result = 20;
result = result % 6;
Question 7
The expression
static_cast<int>(9.9)
evaluates to ____.
Question 8
The length of the string “computer science” is ____.
Question 9
The number of input data extracted by cin and >> depends on the number of variables appearing in the cin statement.
True or False
Question 10
You can use the function getline to read a string containing blanks.
True or False
Question 11
Suppose that x = 55.68, y = 476.859, and z = 23.8216.
What is the output of the following statements
cout << fixed << showpoint;
cout << setprecision(2);
cout << x << ‘ ‘ << y << ‘ ‘ << z << endl;
Question 12
A control structure alters the normal sequential flow of execution in a program.
True or False
Question 13
The expression (x >= 0 && x <= 100) evaluates to false if either x < 0 or x >= 100.
True or False
Question 14
What does <= mean?
Question 15
Suppose x is 5 and y is 7. Choose the value of the following expression:
(x != 7) && (x <= y)
Question 16
What is the output of the following C++ code?
int x = 35;
int y = 45;
int z;
if (x > y)
z = x + y;
else
z = y – x;
cout << x << ” ” << y << ” ” << z << endl;
Question 17
What is the value of x after the following statements execute?
int x;
x = (5 <= 3 && ‘A’ < ‘F’) ? 3 : 4
Question 18
What is the output of the following code?
char lastInitial = ‘S’;
switch (lastInitial)
{
case ‘A’:
cout << “section 1” <<endl;
break;
case ‘B’:
cout << “section 2” <<endl;
break;
case ‘C’:
cout << “section 3” <<endl;
break;
case ‘D’:
cout << “section 4” <<endl;
break;
default:
cout << “section 5” <<endl;
}
Question 19
Consider the following code:
string studentName;
cout << “Please enter your name: ” << endl;
cin >> studentName;
cout << “Your name is ” << studentName;
Assume the user types in “Fred Flintstone”. What would the output be in the last line
Question 20
Consider the following code:
bool myFlag = true;
string Hello = “greetings”;
if(myFlag)
{
cout << Hello;
}
else
{
cout << “Hello”;
}
What is the output after the code executes?
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."