0% found this document useful (0 votes)
3 views1 page

Functions Questions - Sigma 5.0

The document contains a series of programming questions focused on Java methods and functions. It includes tasks such as computing averages, checking for even numbers, determining if a number is a palindrome, utilizing Math class methods, and summing the digits of an integer. Additionally, it encourages the use of online resources for further learning and coding practice.

Uploaded by

jishuraj25122002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Functions Questions - Sigma 5.0

The document contains a series of programming questions focused on Java methods and functions. It includes tasks such as computing averages, checking for even numbers, determining if a number is a palindrome, utilizing Math class methods, and summing the digits of an integer. Additionally, it encourages the use of online resources for further learning and coding practice.

Uploaded by

jishuraj25122002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

FUNCTIONS QUESTIONS

Question 1 : Write a Java method to compute the average of three numbers..

Question
Write 2 : named isEven that accepts an int argument. The method should return true if
a method
the argument is even, or false otherwise. Also write a program to test
your method.

Question 3 : Write a Java program to check if a number is a palindrome in Java? ( 121 is


a palindrome, 321 is not) A number is called a palindrome if the number is equal to the reverse
of a number e.g., 121 is
a palindrome because the reverse of 121 is 121 itself. On the other hand, 321 is not a
palindrome because the reverse of 321 is 123, which is not equal to 321.

Question 4 : READ & CODE EXERCISE


Search about(Google) & use the following methods of the Math class in Java:
a. Math.min( )
b. Math.max( )
c. Math.sqrt( )
d. Math.pow( )
e. Math.avg( )
f. Math.abs( )

Free reading resource (https://www.javatpoint.com/java-math)


Please feel free to look for more resources/websites on your own.

Question 5 :
Write a Java method to compute the sum of the digits in an integer.

(Hint : Approach this question in the following way :


a. Take a variable sum = 0
b. Find the last digit of the number
c. Add it to the sum
d. Repeat a & b until the number becomes 0 )

You might also like