Java MCQ Quiz Hub

Java Mcq Question Set 9

Choose a topic to test your knowledge and improve your Java skills

Which of these is wrapper for simple data type float?





✅ Correct Answer: 4

Which of the following is method of wrapper Float for converting the value of an object into byte?





✅ Correct Answer: 1

Which of these methods is used to check for infinitely large and small values?





✅ Correct Answer: 2

Which of the following package stores all the simple data types in java?





✅ Correct Answer: 3

Which of these is a wrapper for data type int?





✅ Correct Answer: 4

Which of the following methods is a method of wrapper Integer for obtaining hash code for the invoking object?





✅ Correct Answer: 2

Which of these is a super class of wrappers Long, Character & Integer?





✅ Correct Answer: 1

Which of these is wrapper for simple data type char?





✅ Correct Answer: 1

Which of the following is method of wrapper Integer for converting the value of an object into byte?





✅ Correct Answer: 4

Which of these methods is used to obtain value of invoking object as a long?





✅ Correct Answer: 2

Which of these class have only one field �TYPE�?





✅ Correct Answer: 2

Which of the following method of Process class can terminate a process?





✅ Correct Answer: 1

�Standard output variable �out� is defined in which class?





✅ Correct Answer: 3

Which of these class can encapsulate an entire executing program?





✅ Correct Answer: 1

Which of the following is method of System class is used to find how long a program takes to execute?





✅ Correct Answer: 2

Which of these class holds a collection of static methods and variables?





✅ Correct Answer: 1

Which of these keywords is used to define packages in Java?





✅ Correct Answer: 3

Which of these is a mechanism for naming and visibility control of a class and its content?





✅ Correct Answer: 3

Which of this access specifies can be used for a class so that its members can be accessed by a different class in the same package?





✅ Correct Answer: 4

Which of these access specifiers can be used for a class so that it's members can be accessed by a different class in the different package?





✅ Correct Answer: 1

Which of the following is correct way of importing an entire package pkg?





✅ Correct Answer: 4

Which of the following is incorrect statement about packages?





✅ Correct Answer: 1

Output : package pkg; class output { public static void main(String args[]) { StringBuffer s1 = new StringBuffer("Hello"); s1.setCharAt(1, x); System.out.println(s1); } }





✅ Correct Answer: 4

Which of these class is superclass of String and StringBuffer class?





✅ Correct Answer: 2

Which of these operators can be used to concatenate two or more String objects?





✅ Correct Answer: 1

Which of these method of class String is used to obtain length of String object?





✅ Correct Answer: 4

Which of these method of class String is used to extract a single character from a String object?





✅ Correct Answer: 2

Which of these constructors is used to create an empty String object?





✅ Correct Answer: 1

Which of these is an an correct statement?





✅ Correct Answer: 1

Which of these method of class String is used to compare two String objects for their equality?





✅ Correct Answer: 2

Which of these methods is used to compare a specific region inside a string with another specific region in another string?





✅ Correct Answer: 1

Which of these method of class String is used to check weather a given object starts with a particular string literal?





✅ Correct Answer: 4

What is the value returned by unction compareTo() if the invoking string is less than the string compared?





✅ Correct Answer: 1

Which of these data type value is returned by equals() method of String class?





✅ Correct Answer: 1

What will s2 contain after following lines of code? String s1 = one; String s2 = s1.concat(two)





✅ Correct Answer: 4

Which of these method of class String is used to remove leading and trailing whitespaces?





✅ Correct Answer: 3

What is the value returned by function compareTo() if the invoking string is less than the string compared?





✅ Correct Answer: 1

Which of the following statement is correct?





✅ Correct Answer: 4

Which of these class is used to create an object whose character sequence is mutable?





✅ Correct Answer: 1

Which of these method of class StringBuffer is used to concatenate the string representation to the end of invoking string?





✅ Correct Answer: 2

Which of these method of class StringBuffer is used to find the length of current character sequence?





✅ Correct Answer: 4

What is the string contained in s after following lines of code? StringBuffer s new StringBuffer(Hello); s.deleteCharAt(0);





✅ Correct Answer: 1

Which of the following statement is correct?





✅ Correct Answer: 2

Which of these method of class StringBuffer is used to extract a substring from a String object





✅ Correct Answer: 2

What will s2 contain after following lines of code? StringBuffer s1 = one; StringBuffer s2 = s1.append(two)





✅ Correct Answer: 4

Which of the following are incorrect form of StringBuffer class constructor?





✅ Correct Answer: 3

Which of these class can generate an array which can increase and decrease in size automatically?





✅ Correct Answer: 3

Which of these method can be used to increase the capacity of ArrayList object manually?





✅ Correct Answer: 1

Which of these method of ArrayList class is used to obtain present size of an object?





✅ Correct Answer: 2

Which of these methods can be used to obtain a static array from an ArrayList object?





✅ Correct Answer: 1