201 Flashcards
Say me PI & Exponent Constant from java.lang.Math class
double E
doble PI
Why we need utilities like this Math Class?
As java is subjective, there are times when we do not have the time to write the implementation & at the same time to save the DRY principle, it is good to use utilities & carry our work. But we should keep practising to write utilities.
Say the method for trigonometric functions from java.lang.Math class?
double sin(double a) double cos(double a) double tan(double a) double asin(double a) double acos(double a) double atan(double a)
What is the function for exp & log in java.lang.Math class?
double exp(double a) double log(double a)
What is the most general argument type and return type of Math class?
double
What is the function for sqrt & pow in Math class?
double sqrt(double a) double pow(double a, double b)
What is the function for ceil & floor
double ceil(double a ) double floor(double a)
Is there a function to generate a random int in MAth class?
Yes, double rint(double a)
How can we do a round of double and float?
int rount(float a ) double round(double a)
If float and double both belongs to Float type, then why we have two overloaded methods for float and double
TBF
What is java.lang.StrictMath class?
The StringtMAth class is more standaridsed, providing more functions compare to java.lang.Math class. In case if portability is a concern, we should use StrictMath class
What is overflow and underflow in Math
TBF
How to obtain the cuberoot in StrictMath?
static double cbrt(double a)
Does many methods in StrictMath are static?
Yes
How to return the hyperbolic cosine?
static double cosh(double a)
What does a switch statement takes in?
Char, String, Integer
Why are for each loops are used?
Fot each is good way where you need not to do validations for null or something. At the same time the for each works for Arrays, Collections, Enums, MAps & Properties
For Which Operator String class is overloaded
+ Operator
If you see data coming in as stream of characters what will you do?
It may be byte data , or stream or case of deairrializatuon
What is 409 Conflict http code?
The HTTP 409 Conflict response status code indicates a request conflict with current state of the server.
Conflicts are most likely to occur in response to a PUT request. For example, you may get a 409 response when uploading a file which is older than the one already on the server resulting in a version control conflict.
Status
409 Conflict