Question

Assume you have already declared and initialized a variable named number as seen here: number =...

Assume you have already declared and initialized a variable named number as seen here:

number = 1

This list contains 10 potential assignment statements that will give the variable named number a value of 4. Select all the LEGAL ways to do this.

Assume that these other variables also exist and have been initialized as seen here:

value = 4

count = 2

Group of answer choices

number = count + number * 2

4 = number

number == count * 2

number = count + count

number + number + number + number

number = 4

number = 2 * 2

number = count * 3 - value

number = value - count + 4

number = value

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

All the LEGAL ways to give the variable named number a value of 4 are:

1. number = count + number * 2

(as number = 2 + 1 * 2 = 2 + 2 = 4)

2. number = count + count

(as number = 2 + 2 = 4)

3. number = 4

4. number = 2 * 2

(as number = 4)

5. number = value

(as number = 4)

Please give thumbsup, if you like it. Thanks.

Add a comment
Know the answer?
Add Answer to:
Assume you have already declared and initialized a variable named number as seen here: number =...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • assume that input is an int array. the array is already declared and initialized wnd every...

    assume that input is an int array. the array is already declared and initialized wnd every element is assigned to an integer number. in addition assume that the array contains at least 1 element. write a code that contains one while loop abd no other loops to find both maximum and minimum numbers from input. then outout the maximum minus the minumum to the console window. (using java eclipse coding)

  • CODE MUST BE IN C 1. Given an int variable n that has been initialized to...

    CODE MUST BE IN C 1. Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have alreadybeen declared, use a while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total. Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total. Use no variables other than n, k, and...

  • anslate Assume that number is an int variable that has already been initialized. Write a statement...

    anslate Assume that number is an int variable that has already been initialized. Write a statement that prints out the value of number in a field of 10 positions (right-justified within that field). Hint: Assume #include <iomanip> is included in the program. В І ЦА HTML Editor I 5 7 7 7 7 x x = = 1:12pt Paragraf O words 18 ctv A

  • 1.Given an int variable n that has been initialized to a positive value and, in addition,...

    1.Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a for loop to compute the sum of the cubes of the first n whole numbers, and store this value in total. Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total. Use no variables other than n, k, and total.(c++) 2.Given an int variable...

  • In C# (sharp) Assuming a string variable named movie Title has already been declared, which one...

    In C# (sharp) Assuming a string variable named movie Title has already been declared, which one of the following statements combines the strings "Hidden" and "Figures" and then assigns the resulting string to the variable? 1. movieTitle="Hidden" + "Figures"; 2. "Hidden" +"Figures" - moveTitle; 3. movie Title("Hidden" +"Figures"); 4. movie title="Hidden" & "Figures": Look at the following code: int distance; // Declare distance as an int double half://Declare half as a double distance = 35; // Assign 35 to distance...

  • Assignment • No variables declared after you start writing code, must be declared at the top....

    Assignment • No variables declared after you start writing code, must be declared at the top. • Reuse all the variables from the first half in the second half, do not make up new variable names. • You code must be properly formatted. • You must use the code provided and variables names provided and not add any more variables to your code. • No for(int I = 0; … no declaring variables except at top of code. • You...

  • The goal of this assignment is to write a multithreaded program (Task3.c) that explores synchronization challenge 1. Assume that we have a shared variable CurrentiD. This is initialized to 1 at t...

    The goal of this assignment is to write a multithreaded program (Task3.c) that explores synchronization challenge 1. Assume that we have a shared variable CurrentiD. This is initialized to 1 at the beginning. 2. Now create 5 threads in your program and assign ID 1,2,3,4,5 to them respectively. You can pass the ID as a parameter when you create the threads. Each of the threads will try to access the variable "CurrentiD" Whenever a thread acquires the variable, it checks...

  • python Canvas 10 pts Question 26 Assume a variable score that has already been initialized, write...

    python Canvas 10 pts Question 26 Assume a variable score that has already been initialized, write one if/elif/else statement that will: • Output the message "Test was not taken if the score variable is equal to 0. • Output the error message "Error: Score is not valid" if the value stored in the score variable is outside the range of 0-100 (i.e., not in between 0 and 100; less than 0 or greater than 100). . If the value stored...

  • A list indicating persons who have signed a petition are arranged with one name on each...

    A list indicating persons who have signed a petition are arranged with one name on each line. Given a Scanner reference variable named inputLine that has been associated with the input source with these names, complete the code that counts the number of names. Assume all needed variables are declared. count = 0; while() { count++; }

  • Design a class named NumDays, to store a value that represents a number of hours and...

    Design a class named NumDays, to store a value that represents a number of hours and convert it to a number of days. For example, 24 hours would be converted to 1 day, 36 hours would be converted to 1.5 days, and 54 hours would be converted to 2.25 days. This class has two private member variables with data type double: one is named as hours; another is named as days. This class has a constructor that accepts a value...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT