Java Programming MCQ (Multiple Choice Questions) - SchoolingAxis

Java Programming MCQ (Multiple Choice Questions)

 Que- Which of these is an incorrect array declaration?

a.int arr[] = new int[5]

b. int [] arr = new int[5]

c. int arr[] = new int[5]

d.int arr[] = int [5] new


Answer-int arr[] = int [5] new


Que- What will be the output of the following Java code?     int arr[] = new int [5];     System.out.print(arr);

a.0

b.value stored in arr[0]

c.0

d.Class name@ hashcode in hexadecimal form


Answer-Class name@ hashcode in hexadecimal form


Que-  Which of these is an incorrect Statement?

a.It is necessary to use new operator to initialize an array

b.Array can be initialized using comma separated expressions surrounded by curly braces

c. Array can be initialized when they are declared

d. None of the mentioned


Answer-It is necessary to use new operator to initialize an array


Que- Which of these is necessary to specify at time of array initialization?

a. Row

b. Column

c. Both Row and Column

d. None of the mentioned


Answer- Row


Que-  Which of these coding types is used for data type characters in Java?

a. ASCII

b. ISO-LATIN-1

c. UNICODE

d. None of the mentioned


Answer- UNICODE


Que-  Any integer value

a.TRUE

b.FALSE

c.Nothing Can be Said

d.None of the mentioned


Answer-TRUE


Que-  Where is an array stored in memory?

a. heap space

b. stack space

c. heap space and stack space

d. first generation memory


Answer- heap space


Que-  An array elements are always stored in ________ memory locations.

a. Sequential

b. Random

c. Sequential and Random

d. Binary search


Answer- Sequential


Que-  Which of the following can be operands of arithmetic operators?

a. Numeric

b. Boolean

c. Characters

d. Both Numeric & Characters


Answer- Both Numeric & Characters


Que-  Modulus operator, %, can be applied to which of these?

a. Integers

b. Floating – point numbers

c. Both Integers and floating – point numbers

d. None of the mentioned


Answer- Both Integers and floating – point numbers


Que-  With x = 0, which of the following are legal lines of Java code for changing the value of x to 1?    1. x++;    2. x = x + 1;    3. x += 1;    4. x =+ 1;

a. 1, 2 & 3

b. 1 & 4

c. 1, 2, 3 & 4

d. 3 & 2


Answer- 1, 2, 3 & 4


Que-  Decrement operator, ??, decreases the value of variable by what number?

a.1

b.2

c.3

d.4


Answer-1


Que-  Which of these statements are incorrect?

a. Assignment operators are more efficiently implemented by Java run-time system than their equivalent long forms

b. Assignment operators run faster than their equivalent long forms

c. Assignment operators can be used only with numeric and character data type

d. None of the mentioned


Answer- None of the mentioned


Que-  Which operator is used to invert all the digits in a binary representation of a number?

a. ~

b. <<<

c. >>>

d. ^


Answer- ~


Que-  On applying Left shift operator, <<, on integer bits are lost one they are shifted past which position bit?

a.1

b.32

c.33

d.31


Answer-31


Que-  Which right shift operator preserves the sign of the value?

a. <<

b. >>

c. <<=

d. >>=


Answer- >>


Que-  Which of these statements are incorrect?

a. The left shift operator, <<, shifts all of the bits in a value to the left specified number of times

b. The right shift operator, >>, shifts all of the bits in a value to the right specified number of times

c. The left shift operator can be used as an alternative to multiplying by 2

d. The right shift operator automatically fills the higher order bits with 0


Answer- The right shift operator automatically fills the higher order bits with 0


Que-  What is the output of relational operators?

a. Integer

b. Boolean

c. Characters

d. Double


Answer- Boolean


Que-  Which of these is returned by "greater than", "less than" and "equal to" operators?

a. Integers

b. Floating – point numbers

c. Boolean

d. None of the mentioned


Answer- Boolean

Previous Post Next Post