Question

The following variables have been declared and assigned values: integer a = 10, integer b =...

The following variables have been declared and assigned values: integer a = 10, integer b = 2, float c =4.0, float d=3.0. State the value of the variable after each statement is executed.

Part a: c = a / b + d / b – (b – a)                                    c =__________________                  

Part b: a = (b > a)                                                         a =__________________

Part c: d = d + b                                                            d =__________________

Part d: a = b / d + a + b / c                                            a =__________________

Part e: a /= c                                                                  a =__________________

Evaluate the expressions below to either true or false.

Part a: (( c >= b ) && ( a > b ))                                 _________

Part b: ( b != c )                                                        _________

Part c: ( a < b || b < c || c < d)                                    _________

I wrote down the answers. these are for a upcoming test. just want to double check my answers, thank you

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

1)
c = 14.5
a = false
d = 5
a = 11.1667
a = 2

2)
true
true
true
Add a comment
Know the answer?
Add Answer to:
The following variables have been declared and assigned values: integer a = 10, integer b =...
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
  • The integer variables first and last have been declared and assigned values (with last >= firs...

    The integer variables first and last have been declared and assigned values (with last >= first). Allocate an integer array that can hold the squares of the numbers between first and last (inclusively), assign the resulting pointer to the variable squares (which you must declare), and initialize the array to the squares of the numbers from first to last (in that order).

  • Specify whether each of the following errors is a syntax error, a runtime error or a...

    Specify whether each of the following errors is a syntax error, a runtime error or a logic error: a. using single quotes where command needs double quotes _____ b. dollar and cents amount on a bill is not formatted correctly _____ c. divide a number by zero _____ (8) Evaluate the following expressions: a. fabs (-25.2) b. pow(4.0, 3.0) c. squareroot (400) d. fabs (8.2) e. squareroot (-400) f. floor(-6.7) g. floor(6.7) h. ceil(-4.1) (4) Indicate which of the following...

  • QUESTION 1 In Java, all variables declared using a class are ____. a. reference variables b....

    QUESTION 1 In Java, all variables declared using a class are ____. a. reference variables b. constants c. primitive variables d. operators 1 points    QUESTION 2 An expression such as str.length(); is an example of a(n) ____. a. system call b. method call c. object call d. class 1 points    QUESTION 3 Consider the following statements. double x; String y; y = String.format( "%.2f", x); If x = 285.679, what is the value of y? a. "285.00" b....

  • We are running programs on a machine where values of type int have a 32-bit two’s-complement...

    We are running programs on a machine where values of type int have a 32-bit two’s-complement representation. Values of type float use the 32-bit IEEE format, and values of type double use the 64-bit IEEE format. We generate arbitrary integer values x, y, and z, and convert them to values of type double as follows: /* Create some arbitrary values */ int x = random(); int y = random(); int z = random(); /* Convert to double */ double dx...

  • QUESTION 1 Given two double variables named x and y, which of the following statements could...

    QUESTION 1 Given two double variables named x and y, which of the following statements could you use to initialize both variables to a value of 0.0? a. x | y = 0.0; b. x = y = 0.0; c. x, y = 0.0; d. none of the above 1 points    QUESTION 2 When you use a range-based for loop with a vector, you a. can avoid out of bounds access b. must still use a counter variable c....

  • QUESTION 2 Boolean or "truth-valued" expressions are how we express conditions that control choices and repetition...

    QUESTION 2 Boolean or "truth-valued" expressions are how we express conditions that control choices and repetition in computer languages. Consider the following Python Boolean expression, where variables alpha, beta, and gamma are of type Boolean: alpha and (beta or gamma) In any algebraic notation there are usually several different ways of writing the same expression. For instance, in integer arithmetic the value of expression '4 x (5 + 2)' is numerically equivalent to that of expression '(4 x 5) +...

  • Exercise 1: Create a class Resource. The class should have: a) Two private variables status and w...

    C++C++ Exercise 1: Create a class Resource. The class should have: a) Two private variables status and writeTo representing integer value either 0 or 1. b) One default constructor that initializes the status and writeTo to zero. c) One single parameterized constructor to initialize the writeTo variable. d) Two constant accessor functions per class that return the values of status e) Two mutator functions per class that set the values of status and writeTo One output (member) function that outputs...

  • I’m trying to check my answers to see if I have the correct answers. Can you...

    I’m trying to check my answers to see if I have the correct answers. Can you help me with the following questions? Thank you. 19. Yeah, I know he "won" the tournament, but I still don't think he is very good. "Won" is an example of a) a weaseler b) ridicule c) a down player d) syntactic ambiguity e) semantic ambiguity 20. Taking this course will possibly help you to pass the test. The word "possibly" is an example of...

  • Hello i have code for parameter estimation in C language. The problem is that the code is developed for floating point numbers and i want it for integer values The code is #include "stdio.h" #...

    Hello i have code for parameter estimation in C language. The problem is that the code is developed for floating point numbers and i want it for integer values The code is #include "stdio.h" #include "conio.h" #include "math.h" #define N 30 double g(double b, double s[], double sn, double sk); double gdash(double b, double s[], double sn); main() { int i; double sk=0; double s_avg,g1,g2,a; double s[N]={30.02,31.46,53.93,55.29,58.72,71.92,77.07,80.9,101.9,114.87,115.34, 121.57,124.96,134.07,136.25,151.78,177.5,180.29,182.21,186.34,256.81, 273.88,277.87,453.93,535.0,537.27,552.9,673.68,704.49,738.68}; double b[N]; clrscr(); sk=0, s_avg=0.0; printf("\n Input observations :\n"); for(i=0;i<N;i++) sk=sk+s[i];...

  • So I am creating a 10 question quiz in Microsoft Visual Studio 2017 (C#) and I...

    So I am creating a 10 question quiz in Microsoft Visual Studio 2017 (C#) and I need help editing my code. I want my quiz to clear the screen after each question. It should do one question at a time and then give a retry of each question that was wrong. The right answer should appear if the retry is wrong. After the 1 retry of each question, a grade should appear. Please note and explain the changes you make...

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
ADVERTISEMENT