Question 1 of 25
Hints left: 3
Q1
What happens if constructor of class A is made private?
Q2
How many copies of static and class variables are created when 10 objects are created of a class?
Q3
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); } }
Q4
Which Java keyword is used to define a subclass that inherits from another class?
Q5
In Java, what is the purpose of the `transient` keyword when applied to an instance variable?
Q6
Which Java operator is used to perform a bitwise XOR operation between two integers?
Q7
In Java, which exception is thrown when an object is accessed before it has been initialized?
Q8
Which of the following statements are incorrect?
Q9
Which Java class is used to represent an ordered collection of elements?
Q10
What is the output of the following code snippet in Java? `System.out.println(Math.pow(2, 3));`
Q11
What is the process of defining more than one method in a class differentiated by parameters?
Q12
What is the purpose of the `instanceof` operator in Java?
Q13
Which of these cannot be declared static?
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
Can a class be declared with a protected modifier.
Q16
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]); } }
Q17
What is true of final class?
Q18
What does the `super` keyword refer to in Java?
Q19
Which of these methods must be made static?
Q20
How can a protected modifier be accessed?
Q21
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]); } }
Q22
Which of the following modifier means a particular variable cannot be accessed within the package?
Q23
What is the purpose of the `synchronized` keyword in Java?
Q24
In Java, what does the `this` keyword refer to?
Q25
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] + " "); } }