
Flashcard on OOPs Concepts
Flashcard
•
Computers
•
University
•
Practice Problem
•
Hard
Wayground Content
FREE Resource
Student preview

28 questions
Show all answers
1.
FLASHCARD QUESTION
Front
What will be the output of the following code?
interface A {
void method();
}
abstract class B implements A {
public void method() {
System.out.println("Class B");
}
}
class C extends B {
}
public class Main {
public static void main(String[] args) {
C obj = new C();
obj.method();
}
}
Back
Class B
2.
FLASHCARD QUESTION
Front
What will be the output of the following code?
abstract class Animal { abstract void makeSound(); static void sleep() { System.out.println("Sleeping..."); } } class Dog extends Animal { void makeSound() { System.out.println("Bark"); } } public class Main { public static void main(String[] args) { Dog d = new Dog(); d.makeSound(); Animal.sleep(); } }
Back
Bark Sleeping...
3.
FLASHCARD QUESTION
Front
What will happen when the following code is executed?
interface A {
static void display() {
System.out.println("Interface A");
}
}
class B implements A {}
public class Main {
public static void main(String[] args) {
B obj = new B();
obj.display();
}
}
Options: A) Interface A, B) Compilation error, C) Runtime error, D) None of the above
Back
Compilation error
4.
FLASHCARD QUESTION
Front
What will be the output of the following code?
abstract class A { A() { System.out.println("Abstract class A constructor"); } } class B extends A { B() { System.out.println("Subclass B constructor"); } } public class Main { public static void main(String[] args) { B obj = new B(); } }
Back
Abstract class A constructor
Subclass B constructor
5.
FLASHCARD QUESTION
Front
Which of the following statements about abstract classes is FALSE?
Options: A) An abstract class can have final methods, B) An abstract class can implement an interface
, C) An abstract class cannot have a constructor
, D) An abstract class can have static methods
Back
An abstract class cannot have a constructor
6.
FLASHCARD QUESTION
Front
What is the correct way to define multiple interface implementations?
Options: A) class A extends B, C {}, B) class A implements B, C {}
, C) class A implements B extends C {}
, D) class A implements B & C {}
Back
class A implements B, C {}
7.
FLASHCARD QUESTION
Front
If a class implements multiple interfaces with methods having the same signature, what happens?
Back
The class must provide a single implementation for the method.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
20 questions
Vocab Flashcard REVIEW #1
Flashcard
•
12th Grade
25 questions
Marketing Ethics
Flashcard
•
12th Grade
26 questions
Biomolecules
Flashcard
•
12th Grade
21 questions
Machine Learning (Part 1)
Flashcard
•
12th Grade
20 questions
سوالات تستی تجارت الکترونیک
Flashcard
•
12th Grade
20 questions
Lập Trình Hướng Đối Tượng (Object-Oriented Programming)
Flashcard
•
12th Grade
22 questions
Employment and Compensation Terms
Flashcard
•
University
20 questions
Business EC-016
Flashcard
•
KG - Professional Dev...
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade