Java Miscellaneous Online Test Series 3 | Core Java 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
Java Miscellaneous Online Test Series 3 | Core Java Quiz | Java Online Test. Let’s play Java online tes
This paper has 20 questions.
Time allowed is 25 minutes.
The Java Miscellaneous 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
What is the difference between private and public functions ?
Correct
Incorrect
-
Question 2 of 20
2. Question
What will happen when you attempt to compile and run the following code? (Assume that the code is compiled and run with assertions enabled.)
public class AssertTest{
public void methodA(int i)
{
assert i >= 0 : methodB();
System.out.println(i);
}public void methodB()
{
System.out.println(“The value must not be negative”);
}public static void main(String args[])
{
AssertTest test = new AssertTest();
test.methodA(-10);
}
}Correct
Incorrect
-
Question 3 of 20
3. Question
The class AssertionError has “is – a” relationship with these classes:
Correct
Incorrect
-
Question 4 of 20
4. Question
What is essential in making sure that your loop is not infinite ?
Correct
Incorrect
-
Question 5 of 20
5. Question
What results from attempting to compile and run the following code?
public class Ternary
{
public static void main(String args[])
{
int a = 5;
System.out.println(“Value is – ” + ((aCorrect
Incorrect
-
Question 6 of 20
6. Question
In a ‘for’ loop, what section of the loop is not included in the parentheses after “for” ?
Correct
Incorrect
-
Question 7 of 20
7. Question
What is the result when you compile and run the following code? public class ThrowsDemo { static void throwMethod() { System.out.println(“Inside throwMethod.”); throw new IllegalAccessException(“demo”); } public static void main(String args[]) { try { throwMethod(); } catch (IllegalAccessException e) { System.out.println(“Caught ” + e); } } }
Correct
Incorrect
-
Question 8 of 20
8. Question
What will happen when you attempt to compile and run the following code?
int Output = 10;
boolean b1 = false;
if((b1 == true) && ((Output += 10) == 20))
{
System.out.println(“We are equal ” + Output);
}
else
{
System.out.println(“Not equal! ” + Output);
}Correct
Incorrect
-
Question 9 of 20
9. Question
Following code will result in: int a = 9/0;
Correct
Incorrect
-
Question 10 of 20
10. Question
Following code will result in: float a = 9/0;
Correct
Incorrect
-
Question 11 of 20
11. Question
What will happen when you attempt to compile and run the following code snippet?
String str = “Java”;
StringBuffer buffer = new StringBuffer(str);
if(str.equals(buffer))
{
System.out.println(“Both are equal”);
}
else
{
System.out.println(“Both are not equal”);
}Correct
Incorrect
-
Question 12 of 20
12. Question
What is the result when you compile and run the following code?
public class Test
{
public void method()
{
for(int i = 0; iCorrect
Incorrect
-
Question 13 of 20
13. Question
What is the size of a Char?
Correct
Incorrect
-
Question 14 of 20
14. Question
Following code will result in: int a1 = 5; double a2 = (float)a1;
Correct
Incorrect
-
Question 15 of 20
15. Question
Following code will result in:
class A {
int b = 1;
public static void main(String [] args) {
System.out.println(“b is ” + b);
}
}Correct
Incorrect
-
Question 16 of 20
16. Question
A class can be transient
Correct
Incorrect
-
Question 17 of 20
17. Question
A class cannot be declared:
Correct
Incorrect
-
Question 18 of 20
18. Question
What is displayed when the following code is compiled and executed?
String s1 = new String(“Test”);
String s2 = new String(“Test”);if (s1==s2)
System.out.println(“Same”);if (s1.equals(s2))
System.out.println(“Equals”);Correct
Incorrect
-
Question 19 of 20
19. Question
What will be the output on compiling/running the following code?
public class MyThread implements Runnable
{
String myString = “Yes “;
public void run()
{
this.myString = “No “;
}
public static void main(String[] args)
{
MyThread t = new MyThread();
new Thread(t).start();
for (int i=0; iCorrect
Incorrect
-
Question 20 of 20
20. Question
What will happen when you attempt to compile and run the following code snippet?
Boolean b = new Boolean(“TRUE”);
if(b.booleanValue())
{
System.out.println(“Yes : ” + b);
}
else
{
System.out.println(“No : ” + b);
}Correct
Incorrect