Computer Applications
Method which reverses a given number is:
- Impure method
- Pure method
- Constructor
- Destructor
Answer
Pure method
Reason — A pure method in Java is a method that:
- Returns a value based only on its input arguments.
- Does not modify any external variables or system state.
- Does not change any class fields or input values.
In the context of reversing a number, a pure method accepts the number as input and returns its reversed form without altering any external state.
Related Questions
Which of the following data type cannot be used with switch case construct?
- int
- char
- String
- double
Which of the following are entry controlled loops?
(a) for
(b) while
(c) do..while
(d) switch
- only a
- a and b
- a and c
- c and d
If the name of the class is "Yellow", what can be the possible name for its constructors?
- yellow
- YELLOW
- Yell
- Yellow
Invoking a method by passing the objects of a class is termed as:
- Call by reference
- Call by value
- Call by method
- Call by constructor