What is the result of attempting to cast an object to a class that it does not inherit from?
What is the result of attempting to cast an object to a class that it does not inherit from?
Which of the following is a feature of Java’s garbage collection?
Which of the following is a feature of Java’s garbage collection?
What does the final
keyword signify when used with a class?
What does the final
keyword signify when used with a class?
How can you achieve polymorphism in JaVA
How can you achieve polymorphism in JaVA
Which of the following keywords allows a class to inherit from an interface?
Which of the following keywords allows a class to inherit from an interface?
What is the purpose of the instanceof
operator in JaVA
What is the purpose of the instanceof
operator in JaVA
Which of the following statements is true about multiple inheritance in JAVA
Which of the following statements is true about multiple inheritance in JAVA
What is the visibility of private attributes in Java?
What is the visibility of private attributes in Java?
In Java, what is the visibility of a protected attribute?
In Java, what is the visibility of a protected attribute?
Which of the following is true about the Object class in Java?
Which of the following is true about the Object class in Java?
Why is it important to override the hashCode()
method when overriding equals()
?
Why is it important to override the hashCode()
method when overriding equals()
?
In Java, what is the result of attempting to instantiate an abstract class?
In Java, what is the result of attempting to instantiate an abstract class?
Which method can be used to create a deep copy of an object?
Which method can be used to create a deep copy of an object?
When a class inherits from an interface, which of the following must be implemented?
When a class inherits from an interface, which of the following must be implemented?
Which method in Java is called when an object is deserialized?
Which method in Java is called when an object is deserialized?
What is the default visibility of a class member declared without any access modifier?
What is the default visibility of a class member declared without any access modifier?
What is the purpose of the clone()
method?
What is the purpose of the clone()
method?
. Which of the following keywords is used to declare an inner class?
. Which of the following keywords is used to declare an inner class?
Which of the following statements about multiple inheritance of interfaces is true?
Which of the following statements about multiple inheritance of interfaces is true?
How do you prevent a method from being overridden in a subclass?
A) Declare it as final
B) Declare it as private
C) Declare it as static
D) Declare it as abstract
How do you prevent a method from being overridden in a subclass?
A) Declare it as final
B) Declare it as private
C) Declare it as static
D) Declare it as abstract
What is the purpose of the Serializable
interface in Java?
What is the purpose of the Serializable
interface in Java?
In Java, how can a subclass access the private members of its superclass?
In Java, how can a subclass access the private members of its superclass?
Which of the following correctly describes a Java interface?
Which of the following correctly describes a Java interface?
What happens if a method in a subclass has the same name and parameters as a method in its superclass?
What happens if a method in a subclass has the same name and parameters as a method in its superclass?
What is the result of using the equals()
method in Java?
What is the result of using the equals()
method in Java?
Which of the following is NOT a feature of an inner class?
Which of the following is NOT a feature of an inner class?
Which keyword is used to exit a loop prematurely in Java?
Which keyword is used to exit a loop prematurely in Java?
What is the difference between 'while' and 'do-while' loops in Java?
What is the difference between 'while' and 'do-while' loops in Java?
In a 'switch-case' statement, what is the role of the 'break' keyword?
In a 'switch-case' statement, what is the role of the 'break' keyword?
What will be the output of the following code snippet:
if(false){
System.out.println("True");
}
else{
System.out.println("False");
What will be the output of the following code snippet:
if(false){
System.out.println("True");
}
else{
System.out.println("False");
Which control structure is used to execute a block of code multiple times?
Which control structure is used to execute a block of code multiple times?
Spot the mistake in this code snippet:
int i = 0;
while(i < 10) {
i++;
}
System.out.println(i);
Spot the mistake in this code snippet:
int i = 0;
while(i < 10) {
i++;
}
System.out.println(i);
Identify the error in this code:
int[] nums = new int[2]; nums[0] = 1; nums[1] = 2; nums[2] = 3;
Identify the error in this code:
int[] nums = new int[2]; nums[0] = 1; nums[1] = 2; nums[2] = 3;
Determine the output:
SET num = 8
IF num MOD 2 = 0
THEN PRINT "Even"
ELSE
PRINT "Odd"
Determine the output:
SET num = 8
IF num MOD 2 = 0
THEN PRINT "Even"
ELSE
PRINT "Odd"
Evaluate this pseudocode:
SET a = 3 SET b = 4 PRINT a * b
Evaluate this pseudocode:
SET a = 3 SET b = 4 PRINT a * b
What is the output of this pseudocode?
SET x = 10
IF x > 5
THEN PRINT "Greater"
ELSE PRINT "Lesser"
What is the output of this pseudocode?
SET x = 10
IF x > 5
THEN PRINT "Greater"
ELSE PRINT "Lesser"
What will the following loop print?
for(int i = 0;
i < 3;
i++){
System.out.println(i);
}
What will the following loop print?
for(int i = 0;
i < 3;
i++){
System.out.println(i);
}
What is the output of this code?
int x = 1;
while(x < 4){
System.out.println(x); x++;
}
What is the output of this code?
int x = 1;
while(x < 4){
System.out.println(x); x++;
}
What will this pseudocode output?
SET count = 5 DO PRINT count COUNTDOWN count
What will this pseudocode output?
SET count = 5 DO PRINT count COUNTDOWN count
What is the purpose of the super
keyword?
What is the purpose of the super
keyword?
In Java, which statement about inheritance is true?
In Java, which statement about inheritance is true?
Which of the following keywords is used to define an abstract class?
Which of the following keywords is used to define an abstract class?
What is the main purpose of an abstract class in Java?
What is the main purpose of an abstract class in Java?
What is the benefit of using generics with collections in Java?
What is the benefit of using generics with collections in Java?
In a generic class, what does the wildcard `` represent?
In a generic class, what does the wildcard `` represent?
What is the main purpose of generics in Java?
What is the main purpose of generics in Java?
Identify the error in this code:
for(int i=0;
i<=5;
i++) {
System.out.println(i);
}
System.out.println(i)
Identify the error in this code:
for(int i=0;
i<=5;
i++) {
System.out.println(i);
}
System.out.println(i)
Analyze this pseudocode:
SET num = 0 WHILE num <= 5 IF num MOD 2 = 0 THEN PRINT num END IF INCREMENT num
Analyze this pseudocode:
SET num = 0 WHILE num <= 5 IF num MOD 2 = 0 THEN PRINT num END IF INCREMENT num
What does the following Java code print?
int x = 5;
int y = x++;
System.out.println(y);
What does the following Java code print?
int x = 5;
int y = x++;
System.out.println(y);