Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Methods

Total questions: 11

Worksheet time: 15mins

Name
Class
Date
1.

This is the method header (first line) of a non-return value method named Message that takes two parameters: age and name

a)

Message (age, name)

b)

void Message (age, name)

c)

int Message (int age, String name)

d)

void Message (int age, String name)

2.

This is the method header (first line) of a return value method named BMI that takes two parameters: weight and height

a)

void BMI (double weight, height)

b)

void BMI (double weight, double height)

c)

double BMI (double weight, double height)

d)

double BMI (weight, height)

3.

This is the method header (first line) of a non-return value method named Store that accepted three argument (name, code and price)

a)

void Store (Cname, tagcode, iprice)

b)

double Store (String Cname, char tagcode, double iprice)

c)

void Store (String Cname, char tagcode, double iprice)

d)

void Store (double iprice, String Cname, char tagcode)

4.

public class Volume


Create object that will use to call a method in the class.

a)

Scanner mtd = new Volume (System.in);

b)

Volume mtd = new Volume ( );

c)

New Volume mtd = Volume ( );

d)

Volume mtd = Volume ( );

5.

public class SST


Create object that will use to call a method in the class.

a)

Scanner Obj= new SST ( );

b)

New SST Obj= SST( );

c)

SST Obj = New SST ( );

d)

SST.Obj = New SST ( );

6.

Call the method in the class by sending 3.00 as argument. Given:-

Class Name : Rate

Obj to call method: mtd

Method name: Calculate

a)

Calculate.Rate.mtd(3.00);

b)

mtd=Calculate(3.00);

c)

mtd.Calculate(double 3.00);

d)

mtd.Calculate(3.00);

7.

Call the method in the class by sending 'K' as argument. Given:-

Class Name : Sample

Obj to call method: obj

Method name: Rare

a)

obj=Sample('K');

b)

obj.Rare('K');

c)

Sample.obj.Rare('K');

d)

obj.Sample('K');

8.
a)

0.2447

b)

0.00147

c)

4.086

d)

0.100

9.
a)

3

b)

4.2

c)

4

d)

0.466

10.
a)

Line 8

b)

Line 11

c)

Line 7

d)

Line 15

11.
a)

double TAX (double paycheck)

b)

double annualsalary;

c)

TAX mtd = new TAX ( );

d)

System.out.println("The tax amount to pay is : " + mtd.TAG(annualsalary) );