Suppose A is an abstract class, B is a concrete subclass of A. Both A and B have a default constructor.
Which of the following options are correct?
1. A a = new A();
2. A a= new B();
3. B b = new A();
4. B b= new B();
Quiz for Module3
Quiz
•
Professional Development
•
Professional Development
•
Hard
kodida priya
Used 64+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Suppose A is an abstract class, B is a concrete subclass of A. Both A and B have a default constructor.
Which of the following options are correct?
1. A a = new A();
2. A a= new B();
3. B b = new A();
4. B b= new B();
1 and 2
2 and 4
3 and 4
1 and 3
2.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Predict the output:
a=10
a=20
Compilation Error at Line 3 : Constructor name should be same as that of class name.
Compilation Error at
Line 7 : Method cannot be both abstract and final,
Line 13 : Cannot override the final method.
3.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Predict the output:
welcome
10
20
Error in Line 2 : Modifier static not allowed here.
Error in Line 7: Modifier static not allowed here.
Compilation Error in both Line 2 and Line 7.
4.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Which one of the below options is correct as per the given piece of code?
SIMRAN
Compilation error : Final variable should be initialized before starting the execution.
Compilation error : Java does not allow final keyword before the constructor.
Compilation error : this keyword cannot be used with final variable.
5.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Predict the output:
Application Successful
Application Successful
Method C
Compilation Error at Line 7 : Cannot extend multiple interfaces.
Compilation Error at Line 10 : Add unimplemented methods.
6.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Identify the lines that can be replaced at /*Insert code here.*/ in the given code to display 100 successfully:
1. Testable.testValue;
2. Test.Testable.testValue;
3. Test.testValue;
4. new Test().testValue;
Option 1 and 2.
Option 2 and 3.
Option 1, 3 & 4.
All the four options.
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Predict the output:
NullPointerException
9
5
None of the above
20 questions
fun codeing
Quiz
•
11th Grade - Professi...
20 questions
1_Java Fundamentals_Array
Quiz
•
Professional Development
20 questions
Statistics- An Introduction
Quiz
•
Professional Development
15 questions
python dictionary and set
Quiz
•
Professional Development
15 questions
Tech Writing
Quiz
•
Professional Development
25 questions
Machinist Grinder 3rd Sem - Module 9 : Precision instruments
Quiz
•
Professional Development
25 questions
core java 2
Quiz
•
Professional Development
25 questions
core java basics
Quiz
•
Professional Development
25 questions
Equations of Circles
Quiz
•
10th - 11th Grade
30 questions
Week 5 Memory Builder 1 (Multiplication and Division Facts)
Quiz
•
9th Grade
33 questions
Unit 3 Summative - Summer School: Immune System
Quiz
•
10th Grade
10 questions
Writing and Identifying Ratios Practice
Quiz
•
5th - 6th Grade
36 questions
Prime and Composite Numbers
Quiz
•
5th Grade
14 questions
Exterior and Interior angles of Polygons
Quiz
•
8th Grade
37 questions
Camp Re-cap Week 1 (no regression)
Quiz
•
9th - 12th Grade
46 questions
Biology Semester 1 Review
Quiz
•
10th Grade