Question

Explain what the processor will do in this fragment? (What value will be stored in "m"?)...

Explain what the processor will do in this fragment? (What value will be stored in "m"?)

int i = 2;

int j = 5;

float k = 3.14;

float m = j / i * k;

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

Answer 6.28

we have 2 operations and both has same precedence so first it will execute / so it will give 5/2 is 2 because as both are integers it will ignore the fraction only integer will be result so now 2 * 3.14 which is 6.28

Note : If you like my answer please rate and help me it is very Imp for me

Add a comment
Know the answer?
Add Answer to:
Explain what the processor will do in this fragment? (What value will be stored in "m"?)...
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
  • What is the output of the following fragment? please explain. C language int i = 1;...

    What is the output of the following fragment? please explain. C language int i = 1; int j = 1; while (i < 5) { i++; j = j * 2; } printf(“%d”, j); (a) 4 (b) 8 (c) 16 (d) 32

  • I don’t understand can you help 5. Given the definition and code fragment: (2 points int...

    I don’t understand can you help 5. Given the definition and code fragment: (2 points int matrix[2]13]; int k = 0; for(int i =0; i < 2; i++) for (int j=0, j < 3 ) matrix[i]lj]-k++; The value of matrix[1][1] is

  • What is the Big-Oh order of the following code fragment? The fragment is parametrized on the...

    What is the Big-Oh order of the following code fragment? The fragment is parametrized on the variable N. Assume that you are measuring the number of times j is decremented. public static void sort(Comparable[] a) { int N-a.length; for (int i = 1; i < N;i++) { for (int j = i; j > && less(a[5], a[j-1]); j--) //measure j -- exch(a, j, j-1); O(nlogn) O O(n^2) Q(n) Does not exist.

  • Draw a picture of array A, Showing the values stored in it after execution of each...

    Draw a picture of array A, Showing the values stored in it after execution of each code segment below. Use the following data: 0 1 2 3 4 5 6 7 8 9. Please explain in detail the procedure so I can understand whats going on. import java.util.Scanner; public class ProblemFive {    public static void main(String[] args) {           int [][] A = new int[4][2];        int k;               Scanner keyboard = new...

  • 1(5 pts): For each code fragment below, give the complexity of the algorithm (O or Θ)....

    1(5 pts): For each code fragment below, give the complexity of the algorithm (O or Θ). Give the tightest possible upper bound as the input size variable increases. The input size variable in these questions is exclusively n. Complexity Code public static int recursiveFunction (int n)f f( n <= 0 ) return 0; return recursiveFunction (n - 1) 1; for(int i 0i <n; i+) j=0; for ( int j k=0; i; k < < j++) for (int j; m <...

  • Draw a picture of array A, showing the values stored in it after execution of each...

    Draw a picture of array A, showing the values stored in it after execution of each code segment below. Use the following data: 0 1 2 3 4 5 6 7 8 9 int A[4][2]: int k, m: for (int i = 0: i < = 3: i++) for (int j = 0: j < = 1: j++) A[i][j] = 0: for (int j = 1: j < = 10: j++) { cin > > k: switch (k) { case...

  • What are the Big-Oh and Omega orders of the following code fragment? What is Tilde approximation?...

    What are the Big-Oh and Omega orders of the following code fragment? What is Tilde approximation? The fragment is prameterized on the variable n. Assume that you are measuring the number of swap calls. for(int j=0;j<n-1;j++){      int z = j;      for (int i=j+1; i<n; i++){             if(a[i] < a[z]){                       z=i;} } if(z!= j){       swap(a[j], a[z]); //count these      } }

  • In the code fragment below, what are the legal data types for the variable "answer"? (Multiple...

    In the code fragment below, what are the legal data types for the variable "answer"? (Multiple answers : Choose all that apply ) byte b = 1; char c = 2; short s = 3; int i = 4 ; float f = 5f; answer = b * c * s * i * f; a. byte b. char c. short d. int e. float f. double g. long

  • What is the likely results of running the following code fragment? Why? int *ptr = (int...

    What is the likely results of running the following code fragment? Why? int *ptr = (int *) 0xfeedbeef ; *ptr = 0 ; Suppose a class uses a dynamically-allocated integer array, pointed to by an int* variable named data. The current capacity of the array is stored in the integer variable capacity. The following code fragment is meant to dyamically resize the array, doubling its capacity. What is the major memory error and how would you detect it? int *tmp...

  • For the following program fragment give a Big-O analysis of the running time. Briefly explain your...

    For the following program fragment give a Big-O analysis of the running time. Briefly explain your answer: int t = 0; for(int i=1; i <= n; i++) for(int j=1; j <= i*i; j++)   if(j % i == 0)    t++;    What I have so far, O(1) + O(n) + O(n2) + O(1) + O(1) Drop Low order terms: O(n) + O(n2) And I believe the final answer to be O(n3), but not sure if just drop the O(n) or...

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