0% found this document useful (0 votes)
16 views5 pages

Worksheet 3

Uploaded by

sakethnair004
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)
16 views5 pages

Worksheet 3

Uploaded by

sakethnair004
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/ 5

GOPALAN INTERNATIONAL SCHOOL

SUB:COMPUTER APP
GRADE :10

PRACTICE WORKSHEET-3
CHAPTER : Math Library methods and Input in Java

Q1. WRITE THE OUTPUT OF THE FOLLOWING


1. Math.round(10.5)
2. Math.rint(10.5)
3. Math.floor(Math.ceil(11.2))
4. Math.abs( Math.min(-10.2 , -10.5))
5. Math.pow(Math.max(4,2), Math.sqrt(4)))

Q2. WRITE A SINGLE LINE JAVA STATEMENT FOR THE FOLLOWING :

a3 -y 5

Q3. GIVE THE RETURN TYPE OF THE FOLLOWING FUNCTIONS:


1. Math.round()
2.Math.floor()
3.Math.ceil()
3.Math.max()

Q4 (i)What is the difference between the Scanner class functions next() and nextLine()?
(II)What are the values stored in variables r1 and r2:
(i) double r1 = Math.abs(Math.min(-2.83,-5.83));
(ii) double r2 = Math.sqrt(Math.floor(16.3));

(III) What does the following mean?


Employee stuff = new Employee( );
(IV) Write Java statement to create an object mp4 of class digital.

Q5. Consider the following code and answer the questions that follow:
class academic
{
int x,y;
void access()
{
int a,b;
academic student=new
academic();
System.out.println(“Object
Created”);
}
}
a. What is the object name of the class?
b. Name the instance variables used in the class.
c. Write the name of local variables used in the program.
d. Give the type of function being used and its name.

Q6. Find the errors in the program given below and rewrite the corrected form:
My class
{
int a; int b;
void display()
{
System.out.printIn(a+“ ”+b);
}
static void display2()
{
System.out.println(a+“ ”+b);
}
public static void main(String args[ ])
{
{
My class ob1=new My
class( ); display1().ob1;
display2().ob2;
}
}
}

You might also like