Question 1 of 25
Hints left: 3
Q1
How many copies of static and class variables are created when 10 objects are created of a class?
Q2
What is the purpose of the `instanceof` operator in Java?
Q3
In Java, which exception is thrown when an object is accessed before it has been initialized?
Q4
Which Java operator is used to perform a bitwise XOR operation between two integers?
Q5
What happens if constructor of class A is made private?
Q6
What will be the output of the following Java program? class equality { int x; int y; boolean isequal() { return(x == y); } } class Output { public static void main(String args[]) { equality obj = new equality(); obj.x = 5; obj.y = 5; System.out.println(obj.isequal); } }
Q7
How can a protected modifier be accessed?
Q8
What will be the output of the following Java snippet, if compiled and executed with command line "hello there"? public class abc { String[] xyz; public static void main(String argv[]) { xyz=argv; } public void runMethod() { System.out.println(argv[1]); } }
Q9
Which Java class is used to represent an ordered collection of elements?
Q10
Which of the following modifier means a particular variable cannot be accessed within the package?
Q11
What will be the output of the following Java code snippet running with "java demo I write java code"? public class demo { public static void main(String args[]) { System.out.println(args[0]+""+args[args.length-1]); } }
Q12
In Java, what is the purpose of the `transient` keyword when applied to an instance variable?
Q13
In Java, what does the `this` keyword refer to?
Q14
In Java, which exception is thrown when an attempt is made to access an array element with an index that is negative or greater than or equal to the array size?
Q15
What is true of final class?
Q16
Which of these methods must be made static?
Q17
What is the process of defining more than one method in a class differentiated by parameters?
Q18
What is the purpose of the `synchronized` keyword in Java?
Q19
Which Java keyword is used to define a subclass that inherits from another class?
Q20
What is the output of the following code snippet in Java? `System.out.println(Math.pow(2, 3));`
Q21
What will be the output of the following Java program? class Output { public static void main(String args[]) { int arr[] = {1, 2, 3, 4, 5}; for ( int i = 0; i < arr.length - 2; ++i) System.out.println(arr[i] + " "); } }
Q22
Which of the following statements are incorrect?
Q23
What does the `super` keyword refer to in Java?
Q24
Which of these cannot be declared static?
Q25
Can a class be declared with a protected modifier.