50 Java Language MCQs With Answers - GeeksforGeeks
50 Java Language MCQs With Answers - GeeksforGeeks
50 Java Language MCQs With Answers - GeeksforGeeks
Trending Now Data Structures Algorithms Foundational Courses Data Science Practice Problem Python Machine Learning JavaScript Java C C++ ReactJS NodeJS Web De
Data Structures
Question 1
Accessibility in UI/UX Design: How to S
A Complete Guide Complet
Algorithms
Output of following Java Program?
Run on IDE
Derived::show() called
Base::show() called
Discuss it
Question 2
Discuss it
Question 3
class Base {
final public void show() {
System.out.println("Base::show() called");
}
}
class Main {
public static void main(String[] args) {
Base b = new Derived();;
b.show();
}
}
Run on IDE
Base::show() called
Derived::show() called
Compiler Error
Runtime Error
Discuss it
Question 4
Java
class Base {
public static void show() {
System.out.println("Base::show() called");
}
}
class Main {
public static void main(String[] args) {
Base b = new Derived();
b.show();
}
}
Run on IDE
Base::show() called
Derived::show() called
Compiler Error
Discuss it
Question 5
Discuss it
Question 6
package main;
class T {
int t = 20;
}
class Main {
public static void main(String args[]) {
T t1 = new T();
System.out.println(t1.t);
}
}
Run on IDE
20
0
Compiler Error
Discuss it
Question 7
class T {
int t = 20;
T() {
t = 40;
}
}
class Main {
public static void main(String args[]) {
T t1 = new T();
System.out.println(t1.t);
}
}
Run on IDE
20
40
Compiler Error
Discuss it
Question 8
If we derive an abstract class and do not implement all the abstract methods, then
the derived class should also be marked as abstract using 'abstract' keyword
Abstract classes can have constructors
A class can be made abstract without any abstract method
A class can inherit from multiple abstract classes.
Java Abstract Class and Interface 50 Java Language MCQs with Answers
Discuss it
Question 9
Run on IDE
10 20 30 40 50
Compiler Error
10 20 30 40
Discuss it
Question 10
1, 3 and 4
1, 2 and 4
2, 3 and 4
1, 2, 3 and 4
Java Abstract Class and Interface 50 Java Language MCQs with Answers
Discuss it
Similar Reads
Python MCQ (Multiple Choice
Ruby Programming Language
Questions) with Answers
Company Explore Languages DSA Data Science & HTML & CSS
In Media GfG Weekly Contest PHP Basic DSA Problems Data Science For Tailwind CSS
O line Classes Beginner
Contact Us GoLang DSA Roadmap SASS
(Delhi/NCR) Machine Learning
Advertise with us SQL Top 100 DSA LESS
DSA in JAVA/C++ Tutorial
GFG Corporate R Language Interview Problems Web Design
Master System ML Maths
Solution Android Tutorial DSA Roadmap by
Design Sandeep Jain Data Visualisation
Placement Training
Master CP Tutorial
Program All Cheat Sheets
GeeksforGeeks Pandas Tutorial
Apply for Mentor
Videos NumPy Tutorial
NLP Tutorial
Deep Learning
Tutorial
Grokking Modern
System Design
NCERT School Subjects Commerce Management & UPSC Study SSC/ BANKING
Solutions Mathematics Accountancy Finance Material SSC CGL Syllabus
Class 11 Chemistry Indian Economics HR Managament Geography Notes SBI Clerk Syllabus
Class 9 Social Science Microeconimics Finance Science and IBPS Clerk Syllabus
Class 8 English Grammar Statistics for Economics Technology Notes SSC CGL Practice