Java Concepts

Test your knowledge of Java programming concepts including collections, OOP principles, access modifiers, garbage collection, and Java language features.

15 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following interfaces is not a part of the collection interface?

  1. Set
  2. List
  3. Queue
  4. ArrayDeque
  5. Map
Question 2 Multiple Choice (Single Answer)

Which of the following is the superclass for all the classes in Java?

  1. Object
  2. Util
  3. Lang
  4. Swing
  5. None of these
Question 3 Multiple Choice (Single Answer)

Which of the following is not a feature of JAVA?

  1. Platform independent
  2. Multithreaded
  3. Explicit pointers
  4. Object oriented
  5. None of these
Question 4 Multiple Choice (Single Answer)

When a method is declared as public, it can be accessed from its

  1. class
  2. subclass
  3. package
  4. outside package
  5. all of the above
Question 5 Multiple Choice (Single Answer)

Which of the following collections does not allow duplicacy?

  1. Linkedlist
  2. Hashset
  3. Vector
  4. Queue
  5. ArrayList
Question 6 Multiple Choice (Single Answer)

Which of the following is not an object oriented programming language?

  1. Java
  2. C
  3. C++
  4. PHP5
  5. Cecil
Question 7 Multiple Choice (Single Answer)

Which of the following bit manipulations is equal to doubling the number i?

  1. i<<1
  2. i>>1
  3. i<<2
  4. i>>2
  5. none of these
Question 8 Multiple Choice (Single Answer)

Which of the following is a code snippet for calculating the hashcode value of a string employed by Java compiler?

  1. public int hashCode(String s) { int h = 0; char val[] = s.toCharArray(); for (int i = 0; i < value.length; i++) { h = 31 * h + val[i]; } } return h; }
  2. public int hashCode(String s) { int h = 0; char val[] = s.toCharArray(); for (int i = 0; i < value.length; i++) { h = 27 * h + val[i]; } } return h; }
  3. public int hashCode(String s) { int h = 0; char val[] = s.toCharArray(); for (int i = 0; i < value.length; i++) { h = 131 * h + val[i]; } } return h; }
  4. public int hashCode(String s) { int h = 0; char val[] = s.toCharArray(); for (int i = 0; i < value.length; i++) { h = 231 * h + val[i]; } } return h; }
  5. public int hashCode(String s) { int h = 0; char val[] = s.toCharArray(); for (int i = 0; i < value.length; i++) { h = 531 * h + val[i]; } } return h; }
Question 9 Multiple Choice (Single Answer)

The decreasing order of the following access specifiers is

  1. public > protected > package-private > private
  2. public > protected > private > package-private
  3. public > private > package-private > protected
  4. public > private > protected > package-private
  5. package-private > private > package-private > protected
Question 10 Multiple Choice (Single Answer)

Which of the following is used to explicitly call the garbage collector in Java?

  1. System.gc()
  2. System.garbage();
  3. System.gcollector()
  4. System.memoryfree();
  5. None of these
Question 11 Multiple Choice (Single Answer)

What is the chronological order in context to the year of development of the languages C, C++ and JAVA?

  1. C++, C, JAVA
  2. C, JAVA, C++
  3. C++, JAVA, C
  4. JAVA, C++, C
  5. C, C++, JAVA
Question 12 Multiple Choice (Single Answer)

JDBC, Servlets, JSP's are present in which edition of JAVA?

  1. JAVA SE(Standard Edition)
  2. JAVA ME(Micro edition)
  3. JAVA EE(Enterprise Edition)
  4. All of the above
  5. None of these
Question 13 Multiple Choice (Single Answer)

What is the default scope of a method in Java?

  1. Private
  2. Public
  3. Protected
  4. Package-private
  5. None of these
Question 14 Multiple Choice (Single Answer)

When a method is declared as private, it can be accessed from its

  1. class
  2. subclass
  3. package
  4. anywhere
  5. all of the above
Question 15 Multiple Choice (Single Answer)

Which of the following has method signatures but not their implementations?

  1. Interface
  2. Abstract data type
  3. Class
  4. API
  5. Library