- AInheritance
- BPolymorphism
- CEncapsulation
- DAbstraction
Time Taken:
Correct Answer:
Wrong Answer:
Percentage: %
Explanation:
Double.parseDouble() converts the string values "26.0" and "74.0" into double values.26.0 and 74.0 results in 100.0.
Explanation:
arr[-1+2] simplifies to arr[1].
The element at index 1 in the array is 202.
Explanation:
In Call by Value, the values of the actual parameters are copied to the formal parameters. Any changes made to the formal parameters do not affect the actual parameters.
Explanation:
"LANGUAGE".replace('A', '0');
Replaces all occurrences of 'A' with '0' in the string.
Result: "L0NGU0GE".
"PROGRAM".compareTo("Program");
Compares the strings lexicographically.
Java uses ASCII values, and the difference in case ('P' in uppercase vs. 'p' in lowercase) gives -32.
Explanation:
words[0] = "Java" → words[0].length() = 4.
words[2] = "fun" → words[2].length() = 3.
Total:
4
+
3
=
7
4+3=7.
Explanation:
The charAt(int index) method in the String class is used to extract a character at a specific position (index) in the string.
Java is case-sensitive, so the correct method name is charAt().
Assertion (A): True. Constructors are invoked automatically when an object is created to initialize the object.
Reason (R): False. Constructors are specifically designed to initialize the instance variables of a class.
Explanation:
Inheritance allows a child class to acquire properties and methods from a parent class, eliminating the need to duplicate code. This promotes code reusability and simplifies maintenance.