java exam 0 votes, 0 avg 21 123456789101112131415 Java Questions 1 / 15 1. Which of these is not a correct statement? A. Every class containing abstract method must be declared abstract B. Abstract class defines only the structure of the class not its implementation C. Abstract class can be initiated by new operator D. Abstract class can be inherited 2 / 15 2. Which of these keywords cannot be used for a class which has been declared final? A. abstract B. extends C. abstract and extends D. none of the mentioned 3 / 15 3. What is the syntax for java main method? A. public void main(String[] args) B. public static void main() C. public static void main(String[] args) D. none of the above 4 / 15 4. What is garbage collection in the context of Java? A. The JVM checks the output of any Java program and deletes anything that doesn’t make sense B. Any package imported in a program and not used is automatically deleted. C. When all references to an object are gone the memory used by the object is not reclaimed. D. When all references to an object are gone, the memory used by the object is automatically reclaimed. 5 / 15 5. Which two classes use the Shape class correctly? A. public class Circle implements Shape { private int radius; } B. public abstract class Circle extends Shape { private int radius; } C. public class Circle extends Shape { private int radius; public void draw(); } D. public abstract class Circle implements Shape { private int radius; public void draw(); } E. public class Circle extends Shape { private int radius; public void draw() { /* code here */ } } F. public abstract class Circle implements Shape { private int radius; public void draw() { /* code here */ } } A. B,E B. A,C C. C,E D. T,H 6 / 15 6. Which of these is returned by “greater than”, “less than” and “equal to” operators? A. Integers B. Floating – point numbers C. Boolean D. None of the mentioned 7 / 15 7. Which of the following are not java modifiers? A. public B. private C. friendly D. transient 8 / 15 8. The following Syntax is used for? class Subclass-name extends Superclass-name { //methods and fields } A. Polymorphism B. Encapsulation C. Inheritance D. none of the above 9 / 15 9. What is Truncation in Java? A. Floating-point value assigned to an integer type B. Integer value assigned to floating type C. Floating-point value assigned to a Floating type D. Integer value assigned to an integer type 10 / 15 10. Which of these method of Object class can clone an object? A. Objectcopy() B. copy() C. Object clone() D. clone() 11 / 15 11. In Iterator, hasMoreElements() method of Enumeration has been changed to: A. hasNextElement() B. isNext() C. hasNext() D. name remains same 12 / 15 12. Which of these method of class String is used to remove leading and trailing whitespaces? A. startsWith() B. trim() C. Trim() D. doTrim() 13 / 15 13. Identify the output of the following program. String str = “Hellow”; System.out.println(str.indexOf(‘t)); A. 1 B. null C. -1 D. o 14 / 15 14. What will be the output of the following Java program? class Output { public static void main(String args[]) { double x = 2.0; double y = 3.0; double z = Math.pow( x, y ); System.out.print(z); } } A. 9.O B. 8.O C. 4.O D. 2.O 15 / 15 15. From the following statements which is a disadvantage of an java array? A. An array can hold primitive types data B. An array has its size that is known as array length C. An array knows only its type that it contains. Array type is checked at the compile-time D. An array holds only one type of data Your score is The average score is 25% LinkedIn Facebook Twitter VKontakte 0% Restart quiz