Question

Given the following code segment, int x = 20; int y = 7; what is the...

Given the following code segment,

int x = 20;
int y = 7;

what is the data type of the value of the expression (x % y) ? (3 points)

Question 1 options:

1)

int

2)

double

3)

numeric

4)

Error: possible loss of precision

5)

Unable to be determined

Question 2 (3 points)

Given the following code segment,

double x = 42.3;
double y = 11.7;

what is the data type of the value of the expression (x % y) ? (3 points)

Question 2 options:

1)

int

2)

double

3)

numeric

4)

Error: possible loss of precision

5)

Unable to be determined

Question 3 (3 points)

Given the following code segment,

int x = 55;
int y = 20;
int z = x / y;

what is the value assigned to z ? (3 points)

Question 3 options:

1)

0

2)

2

3)

2.75

4)

5.0

5)

None; a possible loss of precision error occurs

Question 4 (3 points)

Given the following code segment,

int m = 23;
int n = 5;
int p = m % n;

what is the value assigned to p ? (3 points)

Question 4 options:

1)

0

2)

3

3)

4

4)

5

5)

None; a possible loss of precision error occurs

Question 5 (3 points)

Given the following code segment,

int d = 14 − 22 / 5 % 4 + 3

what is the value assigned to the variable d ? (3 points)

Question 5 options:

1)

2

2)

5

3)

10

4)

17

5)

Error: possible loss of precision
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)  int
2)  double
3)  2
4)  3
5)  17
Add a comment
Know the answer?
Add Answer to:
Given the following code segment, int x = 20; int y = 7; what is the...
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
  • 20) What is the output of the following segment of C code: int avg(int n, int*...

    20) What is the output of the following segment of C code: int avg(int n, int* a); int main () {             int array[4]={1,0,6,9};             printf("%d", avg(4, array)+ 1);             system("pause");             return 0; } int avg(int n, int* a) { int i, sum=0; for (i=0;i<n;i++) { sum+=a[i]; } return sum/n; } a) 16 b) 5 c) 4 d) 8 21) What is the output of the following segment of C code: int x = 2; int y = 3;...

  • 31. The following code segment is syntactically correct:              int number{20};          cout << number <<...

    31. The following code segment is syntactically correct:              int number{20};          cout << number << setbase(16) << " " << number                               << setbase(10) << " " << number                                 << showpos << " " << number << endl;                 T__   F__       32. The following statement wants to determine if ‘count’ is outside the     range of 0 through 100:             if (count < 0 && count > 100)                                             T__   F__ 33. There is...

  • QUESTION 1 What will be displayed as a result of executing the following code? int   x...

    QUESTION 1 What will be displayed as a result of executing the following code? int   x = 5, y = 20; x += 32; y /= 4; cout <<"x = " << x <<"y = " << y; A. x = 32, y = 4 B. x = 9, y = 52 C. x = 37, y = 5 D. x = 160, y = 80 8 points    QUESTION 2 What will be the displayed when the following code...

  • Please answer the questions below about the following code segment in C: int x, y, z...

    Please answer the questions below about the following code segment in C: int x, y, z int *ix, *iy, *iz; char *c "Hello"; x10; ?- 20; z=30; iz = &z; x = z + *IZ; 200 t 30?130 2200; 1. What is the value of "ix? 2, What is the value of *iy? 3. What is the value of *iz? 4. What is the value of c[0]? 5. What is the value of c[strlen(c) - 1]?

  • 1. What is the output of the following code segment? int array[] = { 8, 6,...

    1. What is the output of the following code segment? int array[] = { 8, 6, 9, 7, 6, 4, 4, 5, 8, 10 }; System.out.println( "Index Value" ); for ( int i = 0; i < array.length; i++ ) System.out.printf( "%d %d\n", i, array[ i ] ); 2. What is the output of the following code segment? char sentence[] = {'H', 'o', 'w', ' ', 'a', 'r', 'e', ' ', 'y', 'o', 'u' }; String output = "The sentence...

  • 4. Given the following code, int x = 5, n; do{ n = 0; for (int...

    4. Given the following code, int x = 5, n; do{ n = 0; for (int i = 0; i < x; i++) { n = n + x; System.out.println(n); } while (x > 1); a) What will be the value of x after the code segment is executed? Initial value of x 5 b) What is the output of the code segment? c) Explain how the flow of control moves in the given code segment. When explaining, show how...

  • QUESTION 62 Consider the following code: void Pancake(int x, int& y, int z); void Waffle(int& x,...

    QUESTION 62 Consider the following code: void Pancake(int x, int& y, int z); void Waffle(int& x, int& y); int Doughnut(int y, int z); int main( ) {             int a = 1;             int b = 2;             int c = 3;             int d = 4;             Pancake(a, b, c);             Waffle(b, c);             Pancake(d, c, b);             d = Doughnut(b, a);             return 0; } void Pancake(int x, int& y, int z) {             y += 3;            ...

  • Write the output of the following segment of code and explain your results. int x=7, y=4,...

    Write the output of the following segment of code and explain your results. int x=7, y=4, z; float z1, z2, z3; z1=x/y; z2=(float)(x/y); z3=(float)x/y; z=x/y; System.out.printf("z=%d z1=%5.2f z2=%5.2f z3=%5.2f \n}, z, z1, z2, z3);

  • What is the value of  result after the following code executes?   int a = 60; int b...

    What is the value of  result after the following code executes?   int a = 60; int b = 15; int result = 20; if (a = b) result *= 3; 30 20 60 10 code will not execute The numeric data types in C++ can be broken into two general categories which are integers and floating-point numbers singles and doubles real and unreal numbers numbers and characters numbers and literals Which line in the following program will cause a compiler error?...

  • Python: 1) What output is generated by the following code segment? table = [["T", "U", "V"],...

    Python: 1) What output is generated by the following code segment? table = [["T", "U", "V"], ["W", "X", "Y"]] print(table[0]) Group of answer choices a- T b- ["T", "W"] c- ["T", "U", "V"] d- [["T", "U", "V"], ["W", "X", "Y"]] 2) Consider the following code segment: values = [4, 12, 0, 1, 5] print(values[1]) What is displayed when it runs? Group of answer choices a- 0 b- 1 c- 4 d- 12 3) Consider the following code segment: x =...

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