Java Basics
Description: Question Based on Collections in Java | |
Number of Questions: 15 | |
Created by: Amit Pandey | |
Tags: Question Based on Collections in Java Java Basics |
Which of following methods is present in the Collection interface in Java?
How many constructors are there for LinkedHashSet?
Which of the following is not a subclass of RuntimeException?
What are the default values for initial capacity and load factor for HashSet?
Which of the following methods is present in List interface?
Which of the following methods is present in the vector class in Java?
Which of the following statements is true for methods in queue in Java Collections?
Which of the following statements is correct for the methods in queue in Java Collections?
Which of the following statements is correct for methods in the queue?
How many constructors are there of TreeSet class?
How many constructors are there of HashSet?
Which of the following methods is not present in the List interface?
Which of the following methods is not necessary to define for a class if it implements the windowListener interface?
Which of the following methods is not present in the Java Collections interface?
What will be the output of the above program?
Directions: Read the syntax given below and answer the question that follows.
public class If2 {
static boolean b1, b2;
public static void main(String [] args)
{
int x = 0;
if ( !b1 ) /* Line 7 */
{
if ( !b2 ) /* Line 9 */
{
b1 = true;
x++;
if ( 5 > 6 )
{
x++;
}
if ( !b1 ) x = x + 10;
else if ( b2 = true ) /* Line 19 */ x = x + 100;
else if ( b1 | b2 ) /* Line 21 */ x = x + 1000;
}
}
System.out.println(x);
}
}