Java Programming 5
Questions Result & StatisticsQuiz-summary
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
Questions
Instruction:
- Total number of questions : 20
- Time allotted : 25 minutes.
- Each question carry 1 mark, no negative marks.
- Click the “Finish quiz” button given in bottom of this page to submit your answer.
- Test will be submitted automatically if the time expired.
- Don’t refresh the page.
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
Marks : 0 of 20 questions answered correctly | ||
Total number of questions | : | 20 |
Number of currect answered | : | 0 |
Your time | : |
|
Time has elapsed
You have reached 0 of 0 points, (0)
Categories
- Not categorized 0%
-
Thank you for submitting online test!
- 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
1 points.
What is the output of this program?
class string_demo {
public static void main(String args[])
{
String obj = “I” + “like” + “Java”;
System.out.println(obj);
}
}
CorrectAnswer : D
Explanation : Java defines an operator +, it is used to concatenate strings
IncorrectAnswer : D
Explanation : Java defines an operator +, it is used to concatenate strings
-
Question 2 of 20
2. Question
1 points.
What is the output of this program?
class string_class {
public static void main(String args[])
{
String obj = “I LIKE JAVA”;
System.out.println(obj.charAt(3));
}
}
CorrectAnswer : A
Explanation : charAt() is a method of class String which gives the character specified by the index. obj.charAt(3) gives 4th character i:e I.
IncorrectAnswer : A
Explanation : charAt() is a method of class String which gives the character specified by the index. obj.charAt(3) gives 4th character i:e I.
-
Question 3 of 20
3. Question
1 points.
What is the output of this program?
class string_class {
public static void main(String args[])
{
String obj = “I LIKE JAVA”;
System.out.println(obj.length());
}
}
CorrectAnswer : C
No answer description.
IncorrectAnswer : C
No answer description.
-
Question 4 of 20
4. Question
1 points.
What is the output of this program?
class string_class {
public static void main(String args[])
{
String obj = “hello”;
String obj1 = “world”;
String obj2 = obj;
obj2 = ” world”;
System.out.println(obj + ” ” + obj2);
}
}
CorrectAnswer : C
No answer description.
IncorrectAnswer : C
No answer description.
-
Question 5 of 20
5. Question
1 points.
What is the output of this program?
class string_class {
public static void main(String args[])
{
String obj = “hello”;
String obj1 = “world”;
String obj2 = “hello”;
System.out.println(obj.equals(obj1) + ” ” + obj.equals(obj2));
}
}
CorrectAnswer : D
Explanation: equals() is method of class String, it is used to check equality of two String objects, if they are equal, true is retuned else false.
IncorrectAnswer : D
Explanation: equals() is method of class String, it is used to check equality of two String objects, if they are equal, true is retuned else false.
-
Question 6 of 20
6. Question
1 pointsCorrectAnswer : D
Explanation : Constructors does not have any return type, not even void.
IncorrectAnswer : D
Explanation : Constructors does not have any return type, not even void.
-
Question 7 of 20
7. Question
1 pointsCorrectAnswer : D
Explanation : this keyword can be used inside any method to refer to the current object. this is always a reference to the object on which the method was invoked.
IncorrectAnswer : D
Explanation : this keyword can be used inside any method to refer to the current object. this is always a reference to the object on which the method was invoked.
-
Question 8 of 20
8. Question
1 pointsCorrectAnswer : D
Explanation : A constructor is a method that initializes an object immediately upon creation. It has the same name as that of class in which it resides.
IncorrectAnswer : D
Explanation : A constructor is a method that initializes an object immediately upon creation. It has the same name as that of class in which it resides.
-
Question 9 of 20
9. Question
1 points.
Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?
CorrectAnswer : D
Explanation : Java handles deallocation of memory automatically by using Garbage Collector, we do not need to explicitly delete an element.
IncorrectAnswer : D
Explanation : Java handles deallocation of memory automatically by using Garbage Collector, we do not need to explicitly delete an element.
-
Question 10 of 20
10. Question
1 pointsCorrectAnswer : A
No answer description.
IncorrectAnswer : A
No answer description.
-
Question 11 of 20
11. Question
1 pointsCorrectAnswer : C
Explanation : finalize() method is called just prior to garbage collection. it is not called when object goes out of scope.
IncorrectAnswer : C
Explanation : finalize() method is called just prior to garbage collection. it is not called when object goes out of scope.
-
Question 12 of 20
12. Question
1 pointsCorrectAnswer : B
No answer description.
IncorrectAnswer : B
No answer description.
-
Question 13 of 20
13. Question
1 pointsCorrectAnswer: A
Explanation : A variable can be declared final, doing so prevents its content from being modified. Final variables must be initialized when it is declared.
IncorrectAnswer: A
Explanation : A variable can be declared final, doing so prevents its content from being modified. Final variables must be initialized when it is declared.
-
Question 14 of 20
14. Question
1 pointsCorrectAnswer : C
Explanation : static statements are run as soon as class containing then is loaded, prior to any object declaration.
IncorrectAnswer : C
Explanation : static statements are run as soon as class containing then is loaded, prior to any object declaration.
-
Question 15 of 20
15. Question
1 pointsCorrectAnswer : D
No answer description.
IncorrectAnswer : D
No answer description.
-
Question 16 of 20
16. Question
1 pointsCorrectAnswer : A
No answer description.
IncorrectAnswer : A
No answer description.
-
Question 17 of 20
17. Question
1 pointsCorrectAnswer : A
Explanation : main() method must be declared static, main() method is called by Java’s run time system before any object of any class exists.
IncorrectAnswer : A
Explanation : main() method must be declared static, main() method is called by Java’s run time system before any object of any class exists.
-
Question 18 of 20
18. Question
1 points.
Which of these is method of ObjectOutput interface used to write the object to input or output stream as required?
CorrectAnswer : D
Explanation : writeObject() is used to write an object into invoking stream, it can be input stream or output stream.
IncorrectAnswer : D
Explanation : writeObject() is used to write an object into invoking stream, it can be input stream or output stream.
-
Question 19 of 20
19. Question
1 pointsCorrectAnswer : A
Explanation : Serialization and deserialization occur automatically by java run time system, Garbage collection also occur automatically but is done by CPU or the operating system not by the java run time system.
IncorrectAnswer : A
Explanation : Serialization and deserialization occur automatically by java run time system, Garbage collection also occur automatically but is done by CPU or the operating system not by the java run time system.
-
Question 20 of 20
20. Question
1 points.
What is the output of this program?
class Output {
public static void main(String args[])
{
int arr[] = {1, 2, 3, 4, 5};
for ( int i = 0; i < arr.length – 2; ++i)
System.out.println(arr[i]);
}
}
CorrectAnswer : B
No answer description.
IncorrectAnswer : B
No answer description.