Question: What is a loop for? Makes the code for you It helps repeat a sequence of instructions until a specific condition is met (We can
- What is a loop for?
- Makes the code for you
- It helps repeat a sequence of instructions until a specific condition is met (We can cycle through values, add sums of numbers, repeat functions, and many other things.)
- Dictates the steps that you need to take for a completion of the code
- Blocks a code before it corrupts
- What is the difference between a variable and a constant?
- Why do we use "void" in a function?
- Void functions are created and used just like value-returning functions except they do not return a value after the function executes.
- To ignore any variables sent the function
- Makes the code longer
- To return a void variable to the place a function was called
- What is "cin" used for?
- To read input from an input stream (such as user input information)
- To Output data to assist with the program
- It's a timer used in programing
- It's a typo and has no meaning
- What is "cout" used for?
- It is an output stream that is used to show output
- It's an input stream that is used to display a input
- It is used to terminate the program
- It's a counter used in programs.
- What is the purpose of "endl"?
- It is used to insert a new line character and flush the stream in the program.
- It is used at the beginning to allow the user to input data
- It is used as a counter in the programming
- It's an acronym for "Engage natural download" and allows the user to save program.
For 7-9, Write the appropriate letter from the definitions below next to the term:
- Functions
- Operators
- Parameters
- Special symbols that are used to represent and direct simple computations (many are used to perform math or comparisons).
- A method that carries out tasks defined by a sequence of statements
- variable which takes on the meaning of a corresponding argument passed in a call to a function
For 10-15, Select best choice (bold or underline) or give a short answer
- What is a comment and how do you insert one in a C program?
- Which are the arithmetic operators:
- Operators using: >, <, >=, <=, ==, !=
- Operators using:&&, ||, !
- Operators using: +, -, *, /, %
- When using an if-else statement the else part only happens if the if statement is:
- True
- False
- Inconclusive
- Which is the shortest possible operator to increment an integer variable's value by 1?
- ++
- +1
- 1+
- Use this to specify a block of code to perform if a condition is true.
- else
- cout
- if
- cin
- What does a breakpoint in an IDE allow us to do while debugging?
- Stop code execution at a certain point in order to examine variable values
- Comment portions of code
- Temporarily skip a section of code
- Executes the code after the breakpoint only
For 16-18, Review the code and answer the questions
- What does this code do (either give a specific example or generally what does this code do)?
#include
using namespace std;
int main() {
int r, h;
float vol;
cout<<< "Enter radius";
cin>>r;
cout<< "Enter height";
cin>> h;
vol=(3.14*r*r*h);
cout<<"The volume is: "< return 0; } #include using namespace std; int main() { int first, second; first=10; second=5; while (first>second){ cout<< first << " "; first--; } cout<< "The end!"; } #include using namespace std; // Main program int main() { char op; float num1, num2; //It allows user to enter operator i.e. +, -, *, / cin >> op; // It allow user to enter the operands cin >> num1; cin >> num2; // Switch statement begins switch (op) { // If user enter + case '+': cout << num1 + num2; break; // If user enter - case '-': cout << num1 - num2; break; // If user enter * case '*': cout << num1 * num2; break; // If user enter / case '/': cout << num1 / num2; break; // If the operator is other than +, -, * or /, // error message will display default: cout << "Error! operator is not correct"; break; } // switch statement ends return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
