JAVA 18

COEP
Lets Crack Online Exam

IT Interview Exam Questions: JAVA 18 (IT Campus Placement)

Subject: JAVA 18

Part 18: List for questions and answers of JAVA

 

Q1. Which of the following can be operands of arithmetic operators?

a) Numeric

b) Boolean

c) Characters

d) Both Boolean and Characters

 

Q2. The following two rules are defined by?

1.The parameters may differ in their type or number, or in both.

2.They may have the same or different return types

a) Method overloading

b) Method overriding

c) Constructor overloading

d) None of the above

 

Q3. Which method cannot be overridden?

a) Final Method

b) Final class

c) Final Variable

d) Both A and C

 

Q4. 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

 

Q5. Decrement operator, –, decreases value of variable by what number?

a) 1

b) 2

c) 3

d) 4

 

Q6. 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 

 

Q7. What is the output of this program?

    class increment {

        public static void main(String args[]) 

        {         

             int g = 3;

             System.out.print(++g * 8);

        } 

    }

a) 25

b) 24

c) 32

d) 33

 

Q8. Which of these is not a bit-wise operator?

a) &

b) &=

c) |=

d) “-

 

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

a) ~

b) /*

c) >>>

d) ^

 

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

a) 1

b) 32

c) 33

d) 31

 

Q11. Which right shift operator preserves the sign of the value?

a) =

b) >>

c) =

d) >>=

 

Q12. Which of these statements are incorrect?

a) The left shift operator,shifts all of the bite in a value to the left specified number of times

b) The right shift operator, >>, shifts all of the bite 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 

 

Q13. Which of these is returned by greater than, and equal to, ==, operator?

a) Integers

b) Floating – point numbers

c) Boolean

d) None of the mentioned

 

Q14. Which of the following operators can operate on a Boolean variable?

1.&&

2.==

3.?:

4.+=

a) 3 & 2

b) 1 & 4

c) 1, 2 & 4

d) 1, 2 & 3

 

Q15. Which of these have highest precedence?

a) ()

b) ++

c) *

d) >>

 

Q16. What is the order of precedence (highest to lowest) of following operators?

1.& 

2.^ 

3.?:

a) 1 -> 2 -> 3

b) 2 -> 1 -> 3

c) 3 -> 2 -> 1

d) 2 -> 3 -> 1

 

Q17. Which of these have highest precedence?

a) ()

b) ++

c) *

d) >>

 

Q18. What should be expression1 evaluate to in using ternary operator as in this line?

expression1 ?  expression2 : expression3

a) Integer

b) Floating – point numbers

c) Boolean

d) None of the mentioned 

 

Q19. What is the value stored in x in following lines of code?

int x, y, z; x = 0; y = 1; x = y = z = 8;

a) 0

b) 1

c) 9

d) 8

 

Q20. Which of these statements are incorrect?

a) Equal to operator has least precedence

b) Brackets () have highest precedence

c) Division operator, /, has higher precedence than multiplication operator

d) Addition operator, +, and subtraction operator have equal precedence 

 

Part 18: List for questions and answers of JAVA

 

Q1. Answer: d

 

Q2. Answer: a

 

Q3. Answer: a

 

Q4. Answer: c

 

Q5. Answer: a

 

Q6. Answer: d

 

Q7. Answer: c

 

Q8. Answer: d

 

Q9. Answer: a

 

Q10. Answer: d

 

Q11. Answer: b

 

Q12. Answer: d

 

Q13. Answer: c

 

Q14. Answer: d

 

Q15. Answer: a

 

Q16. Answer: a

 

Q17. Answer: a

 

Q18. Answer: c

 

Q19. Answer: d

 

Q20. Answer: c