DATA TYPES, VARIABLES and OPERATORS 2.1 What is the meaning of the following in the context of Computer Science? a) vari

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

DATA TYPES, VARIABLES and OPERATORS 2.1 What is the meaning of the following in the context of Computer Science? a) vari

Post by answerhappygod »

Data Types Variables And Operators 2 1 What Is The Meaning Of The Following In The Context Of Computer Science A Vari 1
Data Types Variables And Operators 2 1 What Is The Meaning Of The Following In The Context Of Computer Science A Vari 1 (31.73 KiB) Viewed 63 times
Data Types Variables And Operators 2 1 What Is The Meaning Of The Following In The Context Of Computer Science A Vari 2
Data Types Variables And Operators 2 1 What Is The Meaning Of The Following In The Context Of Computer Science A Vari 2 (43.51 KiB) Viewed 63 times
Data Types Variables And Operators 2 1 What Is The Meaning Of The Following In The Context Of Computer Science A Vari 3
Data Types Variables And Operators 2 1 What Is The Meaning Of The Following In The Context Of Computer Science A Vari 3 (68.55 KiB) Viewed 63 times
Data Types Variables And Operators 2 1 What Is The Meaning Of The Following In The Context Of Computer Science A Vari 4
Data Types Variables And Operators 2 1 What Is The Meaning Of The Following In The Context Of Computer Science A Vari 4 (32.49 KiB) Viewed 63 times
Data Types Variables And Operators 2 1 What Is The Meaning Of The Following In The Context Of Computer Science A Vari 5
Data Types Variables And Operators 2 1 What Is The Meaning Of The Following In The Context Of Computer Science A Vari 5 (37.13 KiB) Viewed 63 times
DATA TYPES, VARIABLES and OPERATORS 2.1 What is the meaning of the following in the context of Computer Science? a) variable: b) identifier: c) keyword: d) statement: e) declaring a variable: 1) initializing a variable: g) assignment statement:

2.2 Write a C++ program that allows the user to input two integers, one for the length of the rectangle and one for the width. The program then prints the value for the area of the rectangle. Hint: apply the following formula: A-LxW Output Enter a number for the length: 5 Enter a number for the width: 4 The area of the rectangle is: 20 2.3 Write the exact output. Operations.cpp Output #include<iostream> using namespace std; int main() { int x = 13; int y = 3; cout<< "Summary of Results:"<<endl; cout<<x+y<< endl; cout<<x - y<<endl; cout<<x/y<<endl; cout<<x*y<<endl; cout<<x%y << endl; return 0; 2.4 Write the exact output. C++ Program Output #include <iostream> using namespace std: int main() { int x = 11; double y = 6,2 = 2; y = x/2; x = 3 *y; cout << "y-"<<y<< endl; cout << "x="<<x<<endl; return 0; 2

2.5 Write a C++ program that allows the user to input a temperature value in Celsius and prints the corresponding temperature in Fahrenheit. Hint: apply the following conversion formula: Fahrenheit = Celsius * 1.8 +32 Output Enter the temperature in Celsius: 30 The corresponding temperature in Fahrenheit is: 86 2.6 Write a C++ program that allows the user to input a temperature value in Fahrenheit and prints the corresponding temperature in Celsius. Hint: apply the following conversion formula: Celsius = (Fahrenheit - 32) / 1.8 Output Enter the temperature in Fahrenheit: 86 The corresponding temperature in Celsius is: 30 2.7 Write a C++ program that inputs an integer that represents a length of time in seconds. The program should then output the number of hours, minutes, and seconds that corresponds to that number of seconds. For example, if the user inputs 50391 total seconds then the program should output 13 hours, 59 minutes, and 51 seconds. 2.8 Write a C++ program that asks the user to enter two numbers, obtains the two numbers from the user and prints the sum, product, difference, and quotient of the two numbers. 2.9 Write a C++ program that inputs three integers from the keyboard and prints the sum, average, product of these numbers. 2.10 True-False questions - Circle your choice a) All variables must be declared before being used. ( True - False) b) C++ considers the variable number and NUMBER to be identical. (True - False) c) The arithmetic operators *, /, +, and - have the same level of precedence. (True - False) d) The statement cout << "a = 5;": is a typical assignment statement. (True False) e) The statements +=2; and n = n+2; have the exact same outcome. (True - False)

2.12 2.11 Assuming that x is equal to 6, which of the following statements will not result in y containing the value 7 after execution? a) y = 7; b) y=++x; c) y=x++; d) y=x+1; Which of the following is not a valid C++ identifier? Choose all that apply. a) myNumber b) my number c) my number d) Ist number f) w3e5r6t7 g) &number h) my number 2.13 Assuming that x is equal to 6, which of the following statements will not result in y containing the value 7 after execution? a) y - 7 b) y++ c) y = x +8/2; d) y = (x+8)/2; e) float 2.14 Given the algebraic expression 2x^2 - 5x + 2, which of the following is (are) correct C++ statements for the equation. Circle all that apply. a) y = 2 ****-5 *x+2 b) y=2* ***-5* (x + 2) c) y=(2* ***)-(5x)+2 d) y-2*x*(x - 5) * x + 2

2.15 Which of the following is NOT a valid C++ data type? Circle your choice clearly. a. int b. char c. double d. number 2.16 Write a program that allows the user to input a number for the side of a cube and prints the value for the volume of the cube? Output Enter a number for the side of the cube: 2 The volume of the cube is: 8 a 2.17 Write a complete C++ program that reads two whole numbers into two variables of type int and then outputs both the whole number part and the remainder when the first number is divided by the second. Hint: This can be done using the operators / and % 2.18 Write a program that will read the weight of a package of breakfast cereal in ounces and output the weight in metric tons as well as the number of boxes needed to yield one metric ton of cereal. Hint: A metric ton is 35,273.92 ounces.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply