What two things are needed for computational problem solving?
A representation that captures only relevant data is called what?
What does abstraction provide?
Which of the following is important for the performance of a computer?
CPU clock speed
HDD/SSD read/write speed
Bus speed
Cache
RAM
Which software manages and interacts with the hardware resources of a computer?
Which software is geared more toward fulfilling the user's specific needs?
A CPU is designed to interpret and execute is what?
Software translates program into machine code to be executed by the CPU is called a?
What are the benefits of modular programming?
The __________ tells the compiler current statement has been terminated and the following other statements are new statements.
Billy Bob can't get his program to compile. Review the following code and make the necessary corrections for it to function properly.
#include < iostream >
using namespace std;
int main()
{
cout >> "My favorite color is dark blue.
cout >> "\nWhat is your favorite color?: "
cin << favorite color;
cout >> favorite color " is a nice color too.";
return 0;
}
Billy Bob's program allows division by zero. Use a selection to stop this from happening and display an error to the user. Billy also want the program to provide an answer rounded to the nearest hundredth; fix it as necessary.
#include < iostream >
using namespace std;
int main()
{
int num1, num2;
cout << "Please provide two numbers to divide: ";
cin >> num1, num2;
cout << num1 << " divided by " << num2 << " is " << num1/num2;
return 0;
Billy Bob cannot get his program to work correctly. Fix it for him.
Hint:
When the user provides a number less than 0, the program displays "Negatives not allowed."
When the user provides 0, the program should display "Neither positive nor negative."
When the user provides 1, the program should display "What an odd number.
When the user provides 2, the program should display "Twice and even.
When the user provides a number above 2, the program should display "I can't count that high;"
#include < iostream >
using namespace std;
int main()
{
string num;
cout << "Give me a number: ";
switch(num)
{
case > 0:
cout << "Negatives not allowed.";
case "0":
cout << "Neither positive nor negative.";
case "1":
cout << "What an odd number.";
case "2":
cout << "Twice and even.";
default:
cout << "I can't count that high.";
}
return 0;
}
Billy Bob is once again having problems with a program. His program is supposed to ask the user for a number and provide the half of it. For example, half of 5 should provide an answer of 2.5. It also looks like Billy understands neither how to use functions nor the side effects of global variables. Fix the program for him.
#include < iostream >
using namespace std;
int num;
int half()
{
return num/2;
}
int main()
{
cout << "Provide a number to halve: ";
cin >> num;
num = half();
cout << num << " in half is " << num;
return 0;
}