INTRODUCTION TO OOPS
INTRODUCTION TO JAVA AND SDE
LANGUAGE FUNDAMENTALS AND OPERATORS
0 1 2 3 4 5
Indefinite Loop
1 2 3 4 5
0 1 2 3 4
0 1 2 3 4 0 1 2 3 4
Rate this question:
Class: Real Chocos Private Limited Objects: Chocolate
Class: Chocolate Objects: Fruit Chocolates, Rum Chocolates, Milk Chocolates
Class: Chocolate Objects: Milk Chocolates
Class: Fruit Chocolates Objects: Rum Chocolates
Rate this question:
Throws ClassCastException at runtime
Prints: B
Compilation Error 'Cannot find the symbol'
Prints: A
Return this.name.hashCode() == a.name.hashCode();
Rate this question:
An exception is thrown at runtime
Planet!
The code runs with no output
Welcome!
Compilation fails
Rate this question:
Program compiles successfully and prints the passed arguments as comma separated values and finally prints the length of the arguments-list
Runtime Error: NoSuchMethodError
Variable arguments cannot be used with enhanced for-loop
Compilation Error: var-args cannot be used as arguments for main() method
Rate this question:
Compile-time error
Prints: 13
Run-time error
Prints: 4
None of the listed options
Rate this question:
JAR Files
Java Virtual Machine (JVM)
Java Development Kit (JDK)
Java Class Files
Java Source Files
Rate this question:
The class is fully encapsulated
The setCardInformation method breaks encapsulation
The code demonstrates polymorphism
The cardID and limit variables break polymorphism
The ownerName variable breaks encapsulation
Rate this question:
If(g==3) break rg; if(h==0) break dg;
If(h > 3) break dg; if(g > 0) break rg;
If(h==3) break rg; if(g==0) break dg;
If(h > 3) break dg; if(g > 0) break dg;
Rate this question:
Return this.name.equalsIgnoreCase(a.name);
Return this.name.equals(a.name);
Return super.equals(a);
Return this.name == a.name;
Rate this question:
False true
True true
True false
Runtime error
false false
Rate this question:
Compilation fails
Welcome Planet 5
Welcome 5
Welcome Planet
The code runs with no output
Rate this question:
Prints: 22, 20
Runtime Error: Cannot type cast int to byte
Prints: 22, 22
Compile Time Error: Loss of precision
Rate this question:
S5
S-1
T4
15
T4
Rate this question:
Compilation succeeds and the program prints "5"
Compilation fails because of an error on line 9
Compilation succeeds and the program prints "3"
Compilation fails because of errors on lines 10 and 11
Rate this question:
Line a prints the corresponding classname with Object's hashcode in Hexadecimal
Both Line a and Line b prints "Shatapdhi"
Both Line a and Line b will print the corresponding classname with Object's hashcode in Hexa Decimal
Output of Line a and Line b will be different
Output of Line a and Line b will be same
Rate this question:
In an inheritance hierarchy, a subclass can also act as a super class
Inheritance enables adding new features and functionality to an existing class without modifying the existing class
Inheritance enables adding new features and functionality to an existing class without modifying the existing class
Inheritance is a kind of Encapsulation
Inheritance does not allow sharing data and methods among multiple classes
Rate this question:
Lines 10, 11
No need to comment any line. Will compile and run
Lines 10, 11 and 12
Line 11
Rate this question:
Equals compares hash value and == compares character sequence
No difference;they are essentially the same
If equals() is true then == is also true
==compares object's memory address but equals character sequence
== works on numbers equals() works on characters
Rate this question:
Java.io.File
Java.io.Serializable
Java.io.FileFilter
Java.io.Console
Java.io.Externalizable
Rate this question:
A class that have static block, should have the main() method defined in it
A class can have more than one static block
Static blocks are executed only once
Static blocks are executed before main() method
A static block can call other methods in a class
Rate this question:
Labeled continue
Labeled goto
Labeled throw
Labeled catch
Labeled break
Rate this question:
Polymorphism
Association
Aggregation
Inheritance
Persistence
Rate this question:
'Before start method' and 'After stop method'
Compilation error
'Before start method' only
Runtime exception
Rate this question:
New Choco().go();
New Bar().go();
New Choco(). new Bar().go();
(new Bar() {}).go();
Go();
Rate this question:
10
11
No output
30
Rate this question:
321
No output
123
32
3
Rate this question:
Prints: 1, true
Prints 2, false
Prints: 1, false
Prints: 2, true
Rate this question:
Color treeColor = Color.GREEN;
Color purple = new Color( 0xff00ff);
Color skyColor = BLUE;
If( RED.getRGB() < BLUE.getRGB() ) {}
If( Color.RED.ordinal() < Color.BLUE.ordinal() ) {}
Rate this question:
Beta has-a Gamma and Gamma is-a Alpha.
Gamma has-a Beta and Gamma is-a Alpha
Alpha is-a Gamma and has-a Beta.
Gamma is-a Beta and has-a Alpha.
Alpha has-a Beta and Alpha is-a Gamma
Rate this question:
CharAt(13)
CharAt(15)
CharAt(12)
CharAt(16)
CharAt(14)
Rate this question:
Public class Test2 { static public void main(String[] in) { System.out.println("Test2"); } }
Public class Test4 { static int main(String args[]) { System.out.println("Test4"); } }
public class Test1 { public static void main() { System.out.println("Test1"); } }
Public class Test3 { public static void main(String args) { System.out.println("Test3"); } }
Public class Test5 { static void main(String[] data) { System.out.println("Test5"); } }
Rate this question:
The variable at line 4 should be declared as final
The variable at line 2 should be declared as final
The method at line 6 should be defined as final method
The inner class Circle 2 should be an abstract class
The object for the inner class Circle2 should be created in main() method
Rate this question:
Inheritance
Polymorphism
Persistence
Aggregation
Association
Rate this question:
Compile-time error
Runtime Error
NO
False
True
Rate this question:
ToString()
CompareTo(Object)
HashCode()
Equals(Object)
Run()
Rate this question:
Throws a Runtime error 'Illegal forward reference'
1000
Compiler complains about forward referencing of member variables first and second
Compiler complains about private memebers is not accessible from main() method
Rate this question:
Prints: 21 21
Prints: 20 21
Compilation Error: Non-static method methodB() cannot be referenced from static context methodA()
Prints: 20 20
Prints: 21 20
Rate this question:
All exceptions are thrown programmatically from the code or API
All exceptions are thrown by JVM
JVM cannot throw user-defined exceptions
JVM thrown exceptions can be thrown programmatically
All RuntimeException are thrown by JVM
Rate this question:
True
False
Rate this question:
If (x != y[0].toString()) {
If (x & y[0]) {
If (x.equals(y[0])) {
If (!x.equals(y[0])) {
Rate this question:
Noise
Bark
Meow
Compilation fails
An exception is thrown at runtime
Rate this question:
Grts = new float[1][4];
Invt = grts;
Hms = new float[2][5];
Invt = new float[4][2];
Grts = new float[1];
Rate this question:
A class can have more than one instance block
An instance block cannot initialise the class members
Instance blocks are executed only when the instances are created from main() method of that class
Instance blocks are executed before constructors
Instance blocks are executed for every created instance
Rate this question:
Quiz Review Timeline (Updated): Sep 5, 2023 +
Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.
Wait!
Here's an interesting quiz for you.