input into the variable "value"? a) value >> cin; b) cin >> value; c) value << cin; d) cin << value; 2. Which of the following statements outputs the value of variable score? a) score >> cin; b) cin >> score; c) score << cin; d) cout << score; 3. Assuming that the user inputs a value of 25 for the price and 10 for the discount rate in the following code snippet, what is the output? int main() { double price; double discount; cout << "Enter the price: "; cin >> price; cout << "Enter the discount rate: "; cin >> discount; cout << "The new price is "; cout << price - price * (discount / 100.0) << endl; return 0; } a) The new price is 25 b) The new price is 15 c) The new price is 22.5 d) The new price is 20.0 4. What is the value inside the "value" variable at the end of the given code snippet? int main() { int value = 3; value = value – 2 * value; value++; return 0; } a) –2 b) 0 c) 2 d) 4 2 5. What is the output of the following code snippet? int main() { int value = 3; value++; cout << value << endl; return 0; } a) 2 b) 3 c) 4 d) No output due to syntax error 6. What is the output of the following code snippet? int main() { int value = 25; value = value * 2; value--; cout << value << endl; return 0; } a) 25 b) 50 c) 49 d) No output due to syntax error 7. Which of the following options is valid with reference to the code snippet? int main() { double d = 45.326; double r = d % 9.0; cout << r; return 0; } a) The value inside the variable r will be 0.326 b) The value inside the variable r will be 5.036 c) Variable r has to be defined as an integer as the % operator always returns an integer d) The assignment statement for variable r is wrong, as the % operator expects integer values as operands 3 8. What is the result of the following code snippet? int main() { double circle_radius; double circle_volume = 22/7 * circle_radius * circle_radius; cout << circle_volume << endl; return 0; } a) 0 b) 3.14 c) 6.28 d) Unpredictable result 9. What is the value inside the var variable at the end of the given code snippet? int main() { int var = 30; var = var + 2 / var; var++; return 0; } a) 0 b) 1 c) 30 d) 31 10. What is the output of the following code snippet? int main() { int num1 = 10; int num2 = 5; int num3 = 200; num3 = num3 % (num1 * num2); cout << num3 << endl; return 0; } a) 0

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 1TF: Mark the following statements as true or false: a. To use a predefined function in a program, you...
icon
Related questions
Question

1. Which of the following statements places input into the variable "value"?
a) value >> cin;
b) cin >> value;
c) value << cin;
d) cin << value;
2. Which of the following statements outputs the value of variable score?
a) score >> cin;
b) cin >> score;
c) score << cin;
d) cout << score;
3. Assuming that the user inputs a value of 25 for the price and 10 for the discount rate in the
following code snippet, what is the output?
int main()
{
double price;
double discount;
cout << "Enter the price: ";
cin >> price;
cout << "Enter the discount rate: ";
cin >> discount;
cout << "The new price is ";
cout << price - price * (discount / 100.0) << endl;
return 0;
}
a) The new price is 25
b) The new price is 15
c) The new price is 22.5
d) The new price is 20.0
4. What is the value inside the "value" variable at the end of the given code snippet?
int main()
{
int value = 3;
value = value – 2 * value;
value++;
return 0;
}
a) –2
b) 0
c) 2
d) 4
2
5. What is the output of the following code snippet?
int main()
{
int value = 3;
value++;
cout << value << endl;
return 0;
}
a) 2
b) 3
c) 4
d) No output due to syntax error
6. What is the output of the following code snippet?
int main()
{
int value = 25;
value = value * 2;
value--;
cout << value << endl;
return 0;
}
a) 25
b) 50
c) 49
d) No output due to syntax error
7. Which of the following options is valid with reference to the code snippet?
int main()
{
double d = 45.326;
double r = d % 9.0;
cout << r;
return 0;
}
a) The value inside the variable r will be 0.326
b) The value inside the variable r will be 5.036
c) Variable r has to be defined as an integer as the % operator always
returns an integer
d) The assignment statement for variable r is wrong, as the % operator
expects integer values as operands
3
8. What is the result of the following code snippet?
int main()
{
double circle_radius;
double circle_volume = 22/7 * circle_radius * circle_radius;
cout << circle_volume << endl;
return 0;
}
a) 0
b) 3.14
c) 6.28
d) Unpredictable result
9. What is the value inside the var variable at the end of the given code snippet?
int main()
{
int var = 30;
var = var + 2 / var;
var++;
return 0;
}
a) 0
b) 1
c) 30
d) 31
10. What is the output of the following code snippet?
int main()
{
int num1 = 10;
int num2 = 5;
int num3 = 200;
num3 = num3 % (num1 * num2);
cout << num3 << endl;
return 0;
}
a) 0
b) 4
c) 10
d) There will be no output due to a run-time error.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 9 steps with 7 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning