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
The following variables have been declared and assigned values: integer a = 10, integer b =...
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).
Q10: Which of the following is not an error (either a syntax error or a logic error)? Neglecting to include an action in the body of a while statement that will eventually cause the condition to become false. Spelling a key word (such as while or if) with a capitalized first letter. Using a condition for a while statement that is initially false. An infinite loop. Q11: How many times is the body of the loop below executed? int counter;...
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. 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 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 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 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) +...
Given the following code, determine the amount of memory required to store all of the variables after the program has been executed (Hint: sum the variables) show your work. Then, tabulate your results in the form of the table below (a separate table ffor each part) then add to your report. Variable datatype Memory for datatype (bits) # of elements Memory (bits) a logical 8 1 8*1 = 8 . . . . . . . . . ....
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 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...