15 questions
Describe method.
A component of a program in a big program.
A program to perform a specific task.
A component of a program written to perform a specific task.
A variable that use to read an input.
There two (2) types of method which are
return
Standard library
User defined
non-return
This is a general structure a method.
<Returnvalue type> <Method Name> (argument / s)
<Modifier> < type> <Method Name> (parameter / s)
public static void main (String[ ] args)
<Method Name> (parameter)
This is an example of a non-return method.
True
False
In which line is representing the meaning of Standard library method.
Line 2
Line 8
Line 13
Line 10
Identify the line with syntax error.
Line 8 and Line 15
Line 10 only
Line 6, Line 8, Line 10
Line 8, Line 11 and Line 15
Method make codes more readable and easier to debug.
True
False
The name of this method is ....
Oddsum
int Oddsum
int Oddsum (int number)
return totaloddsum
The different between static and non static method is ....
for non static method : user need to create object in a class to call a method.
A method is to perform only specific task.
There is no significant differences between static and non - static method.
Both are bounded with a class.
Data type for non return method is
int
double
void
public static
Fix the syntax error in Line 8.
Cylinder sc = new System.in( );
Scanner sc = new Scanner (System.in);
Cylinder Volume = new Volume( );
Cylinder call = new Cylinder( );
Fix all the syntax error. Your answer may more than 1.
Circle mtd = new Circle ( );
r=sc.nextInt( );
void Area (double r);
double r;
Identify the most suitable reason to clarify the syntax error that exists in this program.
Should use return type method rather than non-return method.
The argument is not in the right sequence to match with the parameter.
The method should use the same variable name with the main function in the class.
Change the method declare name into Greeting.
Identify and fix the syntax error.
Mismatched of the argument and parameter.
Fix with :- call.Display(name,age);
Wrong name of the class to declare the method call object.
Fix with :- Greeting call = new Greeting( );
Wrong type of return type method.
Fix with :- int Display (int number, String member);
Wrong method's name in calling the method.
Fix with :- call.Greeting(name,age);
This program is consist with syntax error. Identify the reason and fix the error with the most suitable answer.
Mismatched with data type of radius and height.
FIx with :- char radius, height;
Mismatched with data type of r and h in method.
FIx with :- int r, h;
Mismatched with variable name of radius and height.
FIx with :- double r, h;
Mismatched with data type of radius and height.
FIx with :- double radius, height;