Question: Question 1 :Consider the following code snippet that is using the same variable name, number , in two different logical code blocks. int main() {

Question 1 :Consider the following code snippet that is using the same variable name, number, in two different logical code blocks.

int main() { // Define a variable named number. int number; cout << "Enter a number greater than 0: "; cin >> number; if (number > 0) { int number; // Another variable named number. cout << "Now enter another number: "; cin >> number; cout << "The second number you entered was " << number << endl; } cout << "Your first number was " << number << endl; return 0; }

Select the statements that apply.

Group of answer choices

the first and second number will always be the same value

the first and second number may not contain the same value

the first and second number may contain the same value

the first and second number cannot have the same value

Question 2 : Consider the code snippet below.

#include using namespace std; int main() { // Constants for minimum income and years const double MIN_INCOME = 35000.0; const int MIN_YEARS = 5; // Get the annual income. cout << "What is your annual income? "; double income; // Variable definition inner block cin >> income; if (income >= MIN_INCOME) { // Get the number of years at the current job. cout << "How many years have you worked at " << "your current job? "; int years; cin >> years; if (years > MIN_YEARS) cout << "You qualify. "; else { cout << "You must have been employed for " << "more than " << MIN_YEARS << " years to qualify. "; } } else { cout << "You must earn at least $" << MIN_INCOME << " to qualify. "; } return 0; }

Select the statements that apply to the variable definition noted in red.

Group of answer choices

variable definition in an inner block

variable definition in an outer block

named constant

global variable

Question 3 : After the following code executes, what is the value of myValue if the user enters 0?

cin >> myValue; if (myValue > 5) myValue = myValue + 5; else if (myValue > 2) myValue = myValue + 10; else myValue = myValue + 15;

Group of answer choices

0

5

15

25

10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!