What is the output of the following code? class Test { int x; Test(int x) { this.x = x; } void print() { System.out.println(x); } } Test t = new Test(5); t.print();

OOPs Quiz - Advanced

Quiz
•
Other
•
University
•
Easy
Crackify Crackify
Used 1+ times
FREE Resource
25 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
5
0
Error
null
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which keyword is used to call a superclass constructor?
this
super
extends
base
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code? class A { A() { System.out.println("A's Constructor"); } } class B extends A { B() { System.out.println("B's Constructor"); } } new B();
B's Constructor
A's Constructor
A's Constructor B's Constructor
Error
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following can be overloaded?
Constructors
Static methods
Main method
All of the above
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the role of a constructor in Java?
Initialize objects
Destroy objects
Create classes
Run threads
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of these is NOT true about abstract classes?
Can have abstract and non-abstract methods
Can be instantiated
Can have constructors
Can have static methods
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which keyword is used to prevent inheritance?
private
static
final
const
Create a free account and access millions of resources
Similar Resources on Wayground
22 questions
TOS Set No - 1

Quiz
•
University
26 questions
Flexibility Training

Quiz
•
University
20 questions
Assembly & Rigging M1

Quiz
•
University
20 questions
Heredity

Quiz
•
KG - University
25 questions
Horizon Scanning Quiz

Quiz
•
12th Grade - University
25 questions
Розробка клієнт-серверних застосувань

Quiz
•
University
20 questions
Round 1

Quiz
•
University
20 questions
TOS Set No - 4

Quiz
•
University
Popular Resources on Wayground
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