- Aternary
- Bunary
- Clogical
- Drelational
Time Taken:
Correct Answer:
Wrong Answer:
Percentage: %
logical
Reason — Logical operators operate only on boolean operands and are used to construct complex decision-making expressions. Logical AND && operator evaluates to true only if both of its operands are true.
nextLine()
Reason — nextLine() reads the input till the end of line so it can read a full sentence including spaces.
break
Reason — The absence of break statement leads to fall through situation in switch case statement.
1
Reason — A method can return only one value.
20 22
Reason — The values of strings P and Q are converted into integers using the Integer.parseInt() method and stored in int variables a and b, respectively.
When the statement System.out.println(a + " " + b) is executed, first the operation a + " " is performed. Here, int variable a is converted to a string and a space is concatenated to it resulting in "20 ".
After this, the operation "20 " + b is performed resulting in 20 22 which is printed as the output.
POS
Reason — The substring() method returns a substring beginning from the startindex and extending to the character at endIndex - 1. Since a string index begins at 0, the character at index 3 is 'P' and the character at index 5 (6-1 = 5) is 'S'. Thus, "POS" is extracted.
explicit
Reason — In explicit type conversion, the data gets converted to a type as specified by the programmer. Here, the float value 32.8 is being converted to int type by the programmer, explicitly.
Pure method
Reason — A method which does not modify the value of variables is termed as a pure method.
16 bits
Reason — A char data type occupies 2 bytes in the memory.
1 byte = 8 bits
2 bytes = 8 * 2 = 16 bits
Static method
Reason — Method which is a part of a class rather than an instance of the class is termed as Static method.