1. (3% each) Given the following declarations: int a-4 int b-6: float5.0 Evaluate the following Java...
Assume the following declarations: int b[] = {10, 20, 30}; int *x = b + 1; Choose all the expressions that are defined and evaluate to 10 A. *b B. b[1] C. *x D. x[-1] E. x[1] - b[1]
1). The result of Java expression 5*7>3*(5+2) && 3*5-4<6 is ____ a. 35>35&&9<6 b. true && false c. false d. False (2). You save text files containing Java language source code using the file extension___ a. .java b. .class c. .txt d. .src (3). Which of the following is not a primitive data type in the Java programming language? a. boolean b. byte c. int d. Point (4). Given the Java statement int[][] vari = new int[5][7]; the value...
Consider the following code segment. int[]arr={1, 2, 3, 4, 5, 6, 7, 8}; for(int k=3; k<arr.length-1; R++ arr[k]-arr[k+1]; What are the contents of arr as a result of executing the code segment? a. {1, 2, 3, 5, 6, 7, 8, 8) b. {2, 2, 4, 5, 6, 7, 8, 8} C. {2, 4, 6, 5, 6, 7, 8,8} d. {4, 2, 4, 4, 6, 7, 8, 8) e. {6, 6, 4, 5, 6, 7, 8, 8} int) arr={7, 2.5, 3.0,...
11. Evaluate each of the following expressions: a. 4*3/6-4+ Math.pow(7,2) b. (3+4)*7-3 c. 9*2/4+5%3+3 d. 55 55
please evaluate the following code. this is JAVA a. class Car { public int i = 3; public Car(int i) { this.i = i; } } ... Car x = new Car(7), y = new Car(5); x = y; y.i = 9; System.out.println(x.i); b. class Driver { public static void main(String[] args) { int[] x = {5, 2, 3, 6, 5}; int n = x.length; for (int j = n-2; j > 0; j--) x[j] = x[j-1]; for (int j...
Consider the following function definition and variable declarations: void square(int &n){n= n*n;} int arr[] = {1, 2, 3}; int number = 4; Which of the following function calls are acceptable? (can have multiple answer) a.square(1); b.square(2); c.square(arr[number]); d.square(number); What is the output of the following code segment? int arr[] = {1, 4, 1, 0}; for (int i=0; i < 4; ++i) cout<<arr[i]*2; a.1014 b.1 4 1 0 (space in between each number) c.1410 d.0140 e.None of the above Given...
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
CREDITUU NAME: (8) Given the following declarations: int *pt: int size; a) Write the one statement that will dynamically allocate an integer array of size size WHICH YOU WILL WRITE TO GET USER INPUT FROM THE CONSOLE using the declarations above. b) Write the one statement that would delete the dynamically allocated array.
1· (1 point each) Given the array defined below, evaluate each of the expressions and write their value in the space provided. If the expression will cause an error, write "ERROR" in the space instead. Note that each expression is independent. They do not build on each other, so each should be applied to the original array as shown here: int [ ] numbers = {7, 15, 13, 10): a. numbers[O] b. numbers[2] c. numbers[1 + 2] d. numbers[4] e....
Evaluate 20 % 8 - (2, 4, 6, or 8)? valuate 10 % 2 - (0, 2, 4, 5)? Given the line of code: x = 5 + 5 / 5; what value will be stored in x? - (2, 5, 6, or 10)? Given the following code: int a,b=10,c=3; a = b/c; what value will be stored in the variable a? - (0, 3, 3.333333, or 4)? Given the following code: Float a, b...