This Core Java mock test assesses knowledge of Java's access modifiers, inheritance, array initializations, and method overriding. It is designed to enhance understanding of Java programming principles and prepare learners for advanced Java topics.
Public int method1(int a, int b) {return 0; }
Private int method1(int a, int b) { return 0; }
Public short method1(int a, int b) { return 0; }
Static protected int method1(int a, int b) { return 0; }
Rate this question:
True
False
Rate this question:
True
False
Rate this question:
Private void eat()
Public void eat()
Public void eat() throws Exeption
Public String eat()
Rate this question:
Runtime exception
Throws ClassCastExeption
Throws NullPointerException
No error, will compile.
Rate this question:
18 20
17 18
19 17
17 17
Rate this question:
Inheriting from two super classes
Inheriting from a class which is already in an inheritance hierarchy
Inheriting from more than one super class
Inheriting from a single class
Rate this question:
Protected int a;
Transient int b = 3;
Private synchronized int e;
Volatile int d;
Rate this question:
Java Myfile 222
Java Myfile 1 2 2 3 4
Java Myfile 1 3 2 2
Java Myfile 0 1 2 3
Rate this question:
Protected
Final
Abstract
Public
Rate this question:
Protected
Public
Private
Both public and protected
Rate this question:
Final
Private
Protected
Default
Rate this question:
Test( )
Public Test( )
Test(void)
Public Test(void)
Rate this question:
Runtime error
Throw an Stackoverflowerror exception
Compilation fails
Syntax error.
Rate this question:
A. Test(3) Test(2) Test(1)
Test(2) Test(1) Test(3)
Test(1) Test(2) Test(3)
Test(1) Test(3) Test(2)
Rate this question:
Prints: 0,0,0,null
Run-time error
Prints: 0,0,0.0,null
Compile-time error 12 Consider the following code snippet: interface i1 { int i = 0; } interface i2 { int i = 0; } class inter implements i1, i2 { public static void main(String[] a) { System.out.println(i); } } Which of the following options will be the output of the above code snippet? Answer: a. Runtime
Compilation Error
Compiles successfully and prints a value which is less than zero
Compiles successfully and prints a value which is equal to Integer.MIN_VALUE
Compiles successfully and prints a value which is equal to -Integer.MAX_VALUE
Compiles successfully and prints a value which is equal to Integer.MIN_VALUE + 1
Rate this question:
Form feed character
Tab character
The dollar character
Space character
The underscore character
Rate this question:
Compilation fails at TestDirector class
Prints: Director Manirathnam also produces films
Prints: Director Manirathnam directs films Director Manirathnam also produces films
Prints: Director Manirathnam directs films
Rate this question:
New Inner(); //At line 5
New Inner(); //At line 10
New ot.Inner(); //At line 10
New Outer.Inner(); //At line 10
Rate this question:
Final
Default (blank), that is, the method declaration would read void setWidth( int n )
Protected
Private
Public
Rate this question:
Return types
Parameters of functions
Datatypes of parameters
Properties
Rate this question:
Prints: A.m1, A.m2, A.m3, A.m4,
Compile-time error at 4.
Compile-time error at 3.
Compile-time error at 2.
Rate this question:
Abstract class Class2 implements Base {}
Abstract class Class2 extends Base { public boolean m1(){ return true; }}
Abstract class Class2 implements Base { public boolean m1(){ return (7 > 4); }}
Abstract class Class2 implements Base { protected boolean m1(){ return (5 > 7) }}
Rate this question:
Dostuff method is not overridden
Subclass bar overrides the dostuff() method
Dostuff method is not overloaded.
IOException an not be inserted in the overloading method.
Rate this question:
Any class in the test package
Any class that extends Target outside the test package
Any class
Only the Target class
Any class that extends Target within the test package
Rate this question:
True
False
Rate this question:
Association refers to a class reuses the properties and methods of another class
Association refers to an object composed of set of other objects
Association refers to binding of related data and behaviours into a single entity
Associations are bi-directional
In Associations, cardinality refers to the number of related objects
Rate this question:
A. transforms s1 into the union of s1 and s2
Transforms s1 into the intersection of s1 and s2.
Transforms s1 into the (asymmetric) set difference of s1 and s2
Copies elements from s2 to s1
Rate this question:
The first line in the constructor must be call to super()
This() always means call to another constructor in another class
Super() always means call to another constructor in another class
There is no difference in using this() and super().
Rate this question:
Overloaded methods must change the argument list
Overloaded methods can change the argument list
Overloaded methods can change the return type
Overloaded methods must change the return type
Overloaded methods can delare new or broader checked exceptions
Rate this question:
Class B should be declared public abstract
Class A should be declared public abstract
The print method in class B should refer the x as super.x
The member x in class A should be declared as protected
This() method call should be removed from the class A constructor
Rate this question:
Public void add(A a) { a.getValue(); }
Public void add(B b) { b.getValue(); }
Public void add(C c1, C c2) { c1.getValue(); }
Public void add(C c) { c.getValue(); }
Public void add(A a, B b) { a.getValue(); }
Rate this question:
A member declared as ‘public’ CAN be accessed from ‘Other packages’.
A member declared with ‘protected’ access modifier CAN be accessed by the members of the ‘subclass’.
A member declared with ‘protected’ access modifier CANNOT be accessed by the members of the ‘Other package’.
A member declared with ‘Default’ access modifier CANNOT be accessed by the members of the ‘subclass’.
Rate this question:
Quiz Review Timeline (Updated): Aug 6, 2024 +
Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.
Informatics Practice Quiz: Exam!
The Informatics Practice Quiz: Exam assesses knowledge in Java programming, focusing on swing controls, operators, loops, and switch-case statements. It is designed to test...
Questions:
10 |
Attempts:
453 |
Last updated:
Mar 19, 2023
|
Java Online Quiz 2
Java Online Quiz 2 assesses knowledge on Java programming basics including data types, variable declarations, and initialization. It is designed for learners to validate their...
Questions:
10 |
Attempts:
422 |
Last updated:
Mar 21, 2023
|
Java Programming Quiz
An interesting Java programming quiz is here for you if you use Java programming or are learning this language. The quiz is not going to be easy in any way. The questions designed...
Questions:
15 |
Attempts:
4778 |
Last updated:
Jul 03, 2023
|
Java Quiz-1
Java Quiz-1 assesses foundational Java programming skills through multiple-choice questions. Topics include constructor behaviors, method definitions, and class hierarchies. Ideal...
Questions:
100 |
Attempts:
5440 |
Last updated:
Sep 18, 2023
|
|
Java Quiz: Test Your GK! Trivia
This Java Quiz tests general knowledge in Java programming, covering topics like data types, access modifiers, OOP concepts, and applets. It assesses key skills for understanding...
Questions:
10 |
Attempts:
1007 |
Last updated:
Mar 22, 2023
|
Can You Answer These Java Programming Questions? Trivia Quiz
Can you answer these java programming questions? There are a lot of people who think that they can never fail any question they are asked when it comes to java programming, and to...
Questions:
10 |
Attempts:
541 |
Last updated:
Mar 22, 2023
|
Wait!
Here's an interesting quiz for you.