adplus-dvertising
frame-decoration

Question

Which of the following is good coding practice to determine oddity?
i)

public boolen abc(int num)
{
 return num % 2 == 1;
}

ii)

public boolean xyz(int num)
{
 return (num & 1)!= 0;
 }

a.

i

b.

ii

c.

option (i) causes compilation error

d.

option (ii) causes compilation error

Answer: (b).ii

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which of the following is good coding practice to determine oddity?

Similar Questions

Discover Related MCQs

Q. Which one of the following causes memory leak?

Q. Which of the following is a best practice to measure time taken by a process for execution?

Q. Which of the below is true about java class structure?

Q. Which of the below is false about java coding?

Q. Which is better in terms of performance for iterating an array?

Q. What are generic methods?

Q. Which of these type parameters is used for a generic methods to return and accept any type of object?

Q. Which of these type parameters is used for a generic methods to return and accept a number?

Q. Which of the following allows us to call generic methods as a normal method?

Q. Which of these types cannot be used to initiate a generic type?

Q. Which of these instance cannot be created?

Q. Which of these data type cannot be type parameterized?

Q. Which of these is wildcard symbol?

Q. What is use of wildcards?

Q. Which of these keywords is used to upper bound a wildcard?

Q. Which of these is an correct way making a list that is upper bounded by class Number?

Q. Which of the following keywords are used for lower bounding a wild card?

Q. Which of the following is not an Enterprise Beans type?

Q. Which of the following is not true about Java beans?

Q. Which file separator should be used by MANIFEST file?