Ads

Plz answer the following questions.....

The type long can be used to store values in the following range: a. -263 to 263 - 1 b. -231 to 231 - 1 c. -264 to 264 d. -232 to 232 - 1

Which of the following is not a hexadecimal number? (A) 999 (B) (hex)23 (C) 0x556 (D) 0x1F2

a. (A) b. (A) & (B) c. (C) d. (A), (B) & (C)

Select the invalid assignment statements from the following: (A) float x = 238.88; (B) double y = 0x443; a. (B) b. (B) & (D) c.(A) & (B) d.(A) & (C)

If not assigned a value, a variable of type char has the following default value: a. '\uffff' b. " " (space) c. '\u0001' d. '\u0000'

15 & 29 = ? a. 44 b. 14 c. 13 d. 12

27 | 8 = ? a. 8 b. 27 c. 19 d. 35

Identify the statements that are correct: (A) int a = 13, a>>2 = 3 (B) int b = -8, b>>1 = -4 (C) int a = 13, a>>>2 = 3 (D) int b = -8, b>>>1 = -4

a. (A), (B), (C) & (D) b. (A) & (B) c. (C) & (D) d. (A), (B) & (C)

Consider the following code: int x, y, z; y = 1; z = 5; x = 0 - (++y) + z++; After execution of this, what will be the values of x, y and z? a. x = 4, y = 1, z = 5 b. x = -7, y = 1, z = 5 c. x = 3, y = 2, z = 6 d. x = 4, y = 2, z = 6

What will be the result of the expression a % b when a and b are of type int and their values are a = 10 and b = 6? a. 4 b. 1.66 c. 1 d. None of these

What will be the result of the expression a % b when a and b are of type int and their values are a = -17 and b = -6? a. -5 b. -23 c. None of these d. 5

Ads

View Answers

May 30, 2011 at 3:48 PM

1) -263 to 263 - 1, The type long is a 64-bit two's complement that can be used for long integers.

2) (A) & (B), Hexadecimal numbers start with "0x" in the Java programming language.

1)

2) \u0000, The value of a variable of type char is 16 bits of data formatted as a Unicode character.

3) 13,When written in binary format, 15 is 1111, and 29 is 11101. 1111 & 11101 is 1101, which is 13 in decimal.

4) 27, When written in binary format, 27 is 11011, and 8 is 1000. 11011 | 1000 is 11011, which is 27.

5) (A), (B) & (C), The shift operation "y1 >>> y2" is identical to "y1 >> y2" for all positive values of y1. It shifts the bits in y1 to the right by y2 positions.

1) x = 3, y = 2, z = 6, Both y and z get incremented as a result of the last statement, but y gets incremented before and z after the assignment of the calculated value to x.

2) 4, The modulus operator (%) may be used with floating-point as well as integer types. It returns the remainder of a division operation. Therefore, 10 % 6 will return 4.

5) 5, The a % b calculates the remainder when a is divided by b.

Ads

Related Tutorials/Questions & Answers: