Question
1. (2 points) What instruction will display data on the screen from a C++ program? int cin cout display 2. (2 points) About how many
1. (2 points) What instruction will display data on the screen from a C++ program?
int
cin
cout
display
2. (2 points) About how many decimal places of accuracy does a float have?
31
12
6
4
3. (2 points) The formula for converting a Fahrenheit temperature to Centigrade is 5/9(F - 32). What is wrong with writing it in C++ as
C = 5/9 * (F - 32);
assuming that C and F are both declared as doubles, and F has a valid value.
4. (2 points) What is the value of the expression 25 % 3?
8
1
0
undefined
5. (2 points) Explain in detail what the following instruction does (assuming i is declared as int):
cin >> i;
6. (2 points) Suppose you have two integer variables (named num and sum) with valid values. Write a single cout instruction to display them as follows:
num is __ sum is __
the underscore characters will show the actual values in num and sum - for example:
num is 4 sum is 24
7. (2 points) Name two libraries that should be #include'd at the top of a C++ program.
8. (2 points) Assuming that two floating point numbers have been saved in the variables num1 and num2, write a chunk of program code that will display the integer result of the sum of num1 and num2. For example, if num1 contains 2.4 and num2 contains 2.5, then the value 4 should be displayed.
9. (2 points) Write a chunk of program code that asks the user to enter two floating point numbers and saves the values in two float variables called val1 and val2.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started