JAVA 15

COEP
Lets Crack Online Exam

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

Subject: JAVA 15

Part 15: List for questions and answers of JAVA

 

Q1. Why are generics used?

a) Generics make code more fast

b) Generics make code more optimised and readable

c) Generics add stability to your code by making more of your bugs detectable at compile time

d) Generics add stability to your code by making more of your bugs detectable at run time

 

Q2. Which inheritance is not supported in java?

a) Single inheritance

b) Hybrid inheritance

c) Multilevel inheritance

d) Java supports all of the above

 

Q3. Which of these type parameters is used for a generic class to return and accept a number?

a) K

b) N

c) T

d) V

 

Q4. Which of these is an correct way of defining generic class?

a) class name(T1, T2, …, Tn) { /* … */ }

b) class name { /* … */ }

c) class name[T1, T2, …, Tn] { /* … */ }

d) class name{T1, T2, …, Tn} { /* … */ }

 

Q5. Which of the following is incorrect statement regarding the use of generics and parameterized types in Java?

a) Generics provide type safety by shifting more type checking responsibilities to the compiler

b) Generics and parameterized types eliminate the need for down casts when using Java Collections

c) When designing your own collections class (say, a linked list), generics and parameterized types allow you to achieve

d) All of the mentioned 

 

Q6. Which of the following reference types cannot be generic?

a) Anonymous inner class

b) Interface

c) Inner class

d) All of the mentioned

 

Q7. Which of these types cannot be used to initiate a generic type?

a) Integer class

b) Float class

c) Primitive Types

d) Collections

 

Q8. Which of these instance cannot be created?

a) Integer instance

b) Generic class instance

c) Generic type instance

d) Collection instances

 

Q9. Which of these data type cannot be type parameterized?

a) Array

b) List

c) Map

d) Set

 

Q10. Which of these Exception handlers cannot be type parameterized?

a) catch

b) throw

c) throws

d) All of the mentioned

 

Q11. Which of the following cannot be Type parameterized?

a) Oveloaded Methods

b) Generic methods

c) Class methods

d) Overriding methods 

 

Q12. Which collection class allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized?.

a) java.util.HashSet

b) java.util.LinkedHashSet

c) java.util.List

d) java.util.ArrayList

 

Q13. Which is a mechanism in which one object acquires all the properties and behaviors of parent object?

a) Inheritance

b) Encapsulation

c) Polymorphism

d) None of the above

 

Q14. Which collection class allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized

a) java.util.HashSet

b) java.util.LinkedHashSet

c) java.util.List

d) java.util.ArrayList

 

Q15. Which of the following allows us to call generic methods as a normal method?

a) Type Interface

b) Interface

c) Inner class

d) All of the mentioned

 

Q16. pow () is associated with which class

a) Math class

b) Input stream class

c) Object class

d) None of above

 

Q17. x=x+1 is equivalent to

a) ++x

b) x++

c) x=x-1

d) None of these 

 

Q18. If method have same name as class name and method don’t have any return type then it is known as

a) Destructors

b) Object

c) Variable

d) Constructor

 

Q19. Methods that have same name, but different Parameter list and different definition known as

a) Overriding

b) Constructor

c) Overloading

d) none of these

 

Q20. If subclass (child class) has the same method as declared in the parent class, it is known as?

a) Method overriding

b) Method overloading

c) Constructor overloading

d) None of the above 

 

Part 15: List for questions and answers of JAVA

 

Q1. Answer: c

 

Q2. Answer: d

 

Q3. Answer: b

 

Q4. Answer: b

 

Q5. Answer: c

 

Q6. Answer: a

 

Q7. Answer: c

 

Q8. Answer: c

 

Q9. Answer: a

 

Q10. Answer: d

 

Q11. Answer: a

 

Q12. Answer: d

 

Q13. Answer: a

 

Q14. Answer: d

 

Q15. Answer: a

 

Q16. Answer: a

 

Q17. Answer: b

 

Q18. Answer: d

 

Q19. Answer: c

 

Q20. Answer: a