
In C++ 4. (2 points) What will be the value of *q after the following statements:...
Question 4 (2 points)
Consider the C statements below. Assume x has been assigned a
value.
int mask = 0xFF000000;
y = x ^ mask;
Which one of the following best describes the value computed for
variable y?
Question 4 options:
y contains the most significant byte of x complemented, with the
rest of the bits unchanged
y contains the most significant byte of x unchanged, with the
rest of the bits 0
y contains the most significant byte of...
7. What is the value of this expression: 2.5 2/4 A. 2.5 B 3.0 C. 1 D. 1.125 In the following 4 questions, assume we have the code segment below: int numberl 5 number2 10; double number3 3.0, number4 2.5 8. What is the value of the variable x1 after this statement is executed? double x1-numberl /number2: A. 0.5 B. 1 C. 0 D. 2 What is the value of the variable x2 after this statement is executed? double x2...
6) What is the final value of variable num after executing the following statements? void Exam(int & N) A)13 ( T++ ¢ut << < 1 ) B)12 void main() (int num-10; C) 11 for (int i - 0; i < 3; i.) Exam (num). D) 10
4. Consider the following C program: (2 points) int fun( int *j){ + 11; return 9; } void main(){ int k 2; k + fun( &k); k What is the value of k after the assignment statement in main, assuming operands are evaluated left to right. operands are evaluated right to left. Please, also explain how you got the values in detail.
What will be the value of discountRate after the following statements are executed? double discountRate = 0.0 int purchase = 100; if (purchase > 1000) discountRate = 0.05; else if (purchase > 750) discountRate = 0.03; else if (purchase > 500) discountRate = 0.01;
What will be the value of x after the following code is executed? int x = 5; while (x <50) { x += 5; } a) 50 b) 45 c) Infiniteloop d) 55 Given the following code segment: Scanner in = new Scanner (System.in); boolean done = false; while (!done) { int input = in.next(); if(input.equalsIgnoreCase("q")) done = false; } What will cause the loop to terminate? a) When the user enters -1 b) The loop will never terminate c)...
After the following declarations and statements are executed: int i, j, k ; boolean c; float x, y, z; int[ ] num = {4, 1, 2, 3, 8}; i = 3; j = 5; x = 4.3; y = 58.209; c = !(i > j) ; what is the value of c
What is the value of x[2] after execution of this code fragment? int x[4] = {3, 6, 9, 5}; x[2] -= x[1] % x[3]; 1 2 3 8
What will be the value of w after the following section of code executes: int w = 4, 9 = 3; if (a < 5) if (w == 7) W = 3; else W = 3; else if (w > 3) W = 2; else W = 1; Select one 2.3 0 b.o 0.2 d. 1
Complete the following function to return a value equal to Using C program x^3+x^2+x (4 points) int myFunc(int x) { }