OCJP Online Test Series 4 | OCJP Quiz | SCJP Quiz | Java Online Test
Finish Quiz
0 of 20 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
Information
OCJP Online Test Series 4 | OCJP Quiz | SCJP Quiz | Java Online Test. Lets Play with our free JAVA Online Test and Clear your Concepts Easily. Free Java OOPs Quiz, Online Java, online Test Quiz 4. Java OCJP/SCJP Quiz 4 Question and Answers 2024. Java online Test Quiz 4. Java OOPs Quiz 4 Free Mock Test 2024. Java OCJP/SCJP Quiz 4 Question and Answers in PDF. The Java online mock test paper is free for all students. Spring Online is very useful for exam preparation and getting for Rank. Java OCJP/SCJP Quiz 4 Question and Answers in English. Java OOPs Mock test for topic via OOPs Mode. Here we are providing Java OCJP/SCJP Quiz in English Now Test your self for “OCJP/SCJP Online Quiz in English” Exam by using below quiz…
This paper has 20 questions.
Time allowed is 25 minutes.
The Java OOPs Mock Test is Very helpful for all students. Now Scroll down below n click on “Start Quiz” or “Start Test” and Test yourself.
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 20 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- Answered
- Review
-
Question 1 of 20
1. Question
Which one statement is true?
Correct
Incorrect
-
Question 2 of 20
2. Question
public class Threads5 {
public static void main (String[] args) {
new Thread(new Runnable() {
public void run() {
System.out.print(“bar”);
}}).start();
}
}What is the result?
Correct
Incorrect
-
Question 3 of 20
3. Question
Given that t1 is a reference to a live thread, which is true?
Correct
Incorrect
-
Question 4 of 20
4. Question
Given:
void waitForSignal() {
Object obj = new Object();
synchronized (Thread.currentThread()) {
obj.wait();
obj.notify();
}
}Which statement is true?
Correct
Incorrect
-
Question 5 of 20
5. Question
class X {
X() { System.out.print(1); }
X(int x) {
this(); System.out.print(2);
}
}
public class Y extends X {
Y() { super(6); System.out.print(3); }
Y(int y) {
this(); System.out.println(4);
}
public static void main(String[] a) { new Y(5); }
}What is the result?
Correct
Incorrect
-
Question 6 of 20
6. Question
package com.sun.scjp;
public class Geodetics {
public static final double DIAMETER = 12756.32; // kilometers
}
Which one correctly access the DIAMETER member of the Geodetics class?Correct
Incorrect
-
Question 7 of 20
7. Question
import java.util.*;
public class Explorer1 {
public static void main(String[] args) {
TreeSet s = new TreeSet();
TreeSet subs = new TreeSet();
for(int i = 606; i < 613; i++)
if(i%2 == 0) s.add(i);
subs = (TreeSet)s.subSet(608, true, 611, true);
s.add(609);
System.out.println(s + ” ” + subs);
}
}What is the result?
Correct
Incorrect
-
Question 8 of 20
8. Question
Given:
Runnable r = new Runnable() {
public void run() {
System.out.print(“Cat”);
}
};
Thread t = new Thread(r) {
public void run() {
System.out.print(“Dog”);
}
};
t.start();What is the result?
Correct
Incorrect
-
Question 9 of 20
9. Question
HashMap props = new HashMap();
props.put(“key45”, “some value”);
props.put(“key12”, “some other value”);
props.put(“key39”, “yet another value”);
Set s = props.keySet();
// insert code here
What, inserted at line 39, will sort the keys in the props HashMap?Correct
Incorrect
-
Question 10 of 20
10. Question
Given:
String #name = “Jane Doe”;
int $age = 24;
Double _height = 123.5;
double ~temp = 37.5;Which one statement is true?
Correct
Incorrect
-
Question 11 of 20
11. Question
abstract public class Employee {
protected abstract double getSalesAmount();
public double getCommision() {
return getSalesAmount() * 0.15;
}
}
class Sales extends Employee {
// insert method here
}
Which one method, inserted independently at line 17, correctly complete the Sales class?Correct
Incorrect
-
Question 12 of 20
12. Question
public class TestOne implements Runnable {
public static void main (String[] args) throws Exception {
Thread t = new Thread(new TestOne());
t.start();
System.out.print(“Started”);
t.join();
System.out.print(“Complete”);
}
public void run() {
for (int i = 0; i < 4; i++) {
System.out.print(i);
}
}
}What can be a result?
Correct
Incorrect
-
Question 13 of 20
13. Question
class One {
void foo() { }
}
class Two extends One {
//insert method here
}
Which one method, inserted individually at line 14, will correctly complete class Two?Correct
Incorrect
-
Question 14 of 20
14. Question
import java.util.*;
public class Quest {
public static void main(String[] args) {
String[] colors = {“blue”, “red”, “green”, “yellow”, “orange”};
Arrays.sort(colors);
int s2 = Arrays.binarySearch(colors, “orange”);
int s3 = Arrays.binarySearch(colors, “violet”);
System.out.println(s2 + ” ” + s3);
}
}What is the result?
Correct
Incorrect
-
Question 15 of 20
15. Question
public class A {
public void doit() {
}
public String doit() {
return “a”;
}
public double doit(int x) {
return 1.0;
}
}What is the result?
Correct
Incorrect
-
Question 16 of 20
16. Question
class Test{
static void test() {
try {
String x = null;
System.out.print(x.toString() + ” “);
}
finally { System.out.print(“finally “); }
}
public static void main(String[] args) {
try { test(); }
catch (Exception ex) { System.out.print(“exception “); }
}
}What is the result?
Correct
Incorrect
-
Question 17 of 20
17. Question
Given:
interface Animal { void makeNoise(); }
class Horse implements Animal {
Long weight = 1200L;
public void makeNoise() { System.out.println(“whinny”); }
}
public class Icelandic extends Horse {
public void makeNoise() { System.out.println(“vinny”); }
public static void main(String[] args) {
Icelandic i1 = new Icelandic();
Icelandic i2 = new Icelandic();
Icelandic i3 = new Icelandic();
i3 = i1; i1 = i2; i2 = null; i3 = i1;
}
}
When line 15 is reached, how many objects are eligible for the garbage collector?Correct
Incorrect
-
Question 18 of 20
18. Question
public class Pass2 {
public void main(String [] args) {
int x = 6;
Pass2 p = new Pass2();
p.doStuff(x);
System.out.print(” main x = ” + x);
}void doStuff(int x) {
System.out.print(” doStuff x = ” + x++);
}
}And the command-line invocations:
javac Pass2.java
java Pass2 5What is the result?
Correct
Incorrect
-
Question 19 of 20
19. Question
class TestException extends Exception { }
class A {
public String sayHello(String name) throws TestException {
if(name == null) throw new TestException();
return “Hello ” + name;
}
}
public class TestA {
public static void main(String[] args) {
new A().sayHello(“Aiko”);
}
}
Which statement is true?Correct
Incorrect
-
Question 20 of 20
20. Question
public class Donkey {
public static void main(String[] args) {
boolean assertsOn = false;
assert (assertsOn) : assertsOn = true;
if(assertsOn) {
System.out.println(“assert is on”);
}
}
}What is result?
Correct
Incorrect