Method Signatures - AP Computer Science A
Card 1 of 30
What is the parameter type in 'void print(double value)'?
What is the parameter type in 'void print(double value)'?
Tap to reveal answer
double. The data type of the single parameter accepted.
double. The data type of the single parameter accepted.
← Didn't Know|Knew It →
Which part of the method signature indicates its name?
Which part of the method signature indicates its name?
Tap to reveal answer
The method name itself. The identifier used to call the method.
The method name itself. The identifier used to call the method.
← Didn't Know|Knew It →
What does the parameter list in a method signature specify?
What does the parameter list in a method signature specify?
Tap to reveal answer
Types and number of parameters. Determines what arguments can be passed to the method.
Types and number of parameters. Determines what arguments can be passed to the method.
← Didn't Know|Knew It →
What distinguishes overloaded methods in Java?
What distinguishes overloaded methods in Java?
Tap to reveal answer
Different parameter lists. Same name but different parameters allows multiple versions.
Different parameter lists. Same name but different parameters allows multiple versions.
← Didn't Know|Knew It →
State the rule for method overloading.
State the rule for method overloading.
Tap to reveal answer
Methods must differ in parameter types or number. Enables multiple methods with same name but different usage.
Methods must differ in parameter types or number. Enables multiple methods with same name but different usage.
← Didn't Know|Knew It →
What is the return type in 'boolean checkStatus()'?
What is the return type in 'boolean checkStatus()'?
Tap to reveal answer
boolean. The data type returned when method executes successfully.
boolean. The data type returned when method executes successfully.
← Didn't Know|Knew It →
Identify the method name in the signature 'void draw()'.
Identify the method name in the signature 'void draw()'.
Tap to reveal answer
draw. The identifier used to invoke this method.
draw. The identifier used to invoke this method.
← Didn't Know|Knew It →
What is the parameter list in 'void setValues(int a, float b)'?
What is the parameter list in 'void setValues(int a, float b)'?
Tap to reveal answer
int, float. The types of data the method accepts as input.
int, float. The types of data the method accepts as input.
← Didn't Know|Knew It →
In 'double getValue()', what is the return type?
In 'double getValue()', what is the return type?
Tap to reveal answer
double. The data type this method produces when called.
double. The data type this method produces when called.
← Didn't Know|Knew It →
Given 'void log()', identify a valid overloaded method.
Given 'void log()', identify a valid overloaded method.
Tap to reveal answer
void log(String message). Adding parameters creates a different method signature.
void log(String message). Adding parameters creates a different method signature.
← Didn't Know|Knew It →
What is the effect of changing the parameter type in a signature?
What is the effect of changing the parameter type in a signature?
Tap to reveal answer
Creates an overloaded method. New signature allows method overloading to occur.
Creates an overloaded method. New signature allows method overloading to occur.
← Didn't Know|Knew It →
What does 'int compare(String a, String b)' return?
What does 'int compare(String a, String b)' return?
Tap to reveal answer
int. The data type produced when method execution finishes.
int. The data type produced when method execution finishes.
← Didn't Know|Knew It →
What is the parameter type in 'String format(String pattern)'?
What is the parameter type in 'String format(String pattern)'?
Tap to reveal answer
String. The data type of the method's single parameter.
String. The data type of the method's single parameter.
← Didn't Know|Knew It →
Find the error in 'void method(int x, int x)'.
Find the error in 'void method(int x, int x)'.
Tap to reveal answer
Duplicate parameter names. Parameter names must be unique within the method scope.
Duplicate parameter names. Parameter names must be unique within the method scope.
← Didn't Know|Knew It →
What is the method name in 'boolean isValid(int a, int b)'?
What is the method name in 'boolean isValid(int a, int b)'?
Tap to reveal answer
isValid. The identifier that appears before the parameter list.
isValid. The identifier that appears before the parameter list.
← Didn't Know|Knew It →
In 'float calculate(double x)', what is the return type?
In 'float calculate(double x)', what is the return type?
Tap to reveal answer
float. The data type returned when method execution completes.
float. The data type returned when method execution completes.
← Didn't Know|Knew It →
Which method signature is a valid overload of 'void execute()'?
Which method signature is a valid overload of 'void execute()'?
Tap to reveal answer
void execute(int). Different parameter list makes this a valid overload.
void execute(int). Different parameter list makes this a valid overload.
← Didn't Know|Knew It →
What distinguishes 'void run()' from 'int run()'?
What distinguishes 'void run()' from 'int run()'?
Tap to reveal answer
Return type. Return type differs but signature components are identical.
Return type. Return type differs but signature components are identical.
← Didn't Know|Knew It →
How many parameters are in 'void process(int a, float b, String c)'?
How many parameters are in 'void process(int a, float b, String c)'?
Tap to reveal answer
Three parameters. Counts each comma-separated parameter in the list.
Three parameters. Counts each comma-separated parameter in the list.
← Didn't Know|Knew It →
What part of a method is not included in its signature?
What part of a method is not included in its signature?
Tap to reveal answer
Return type. Only name and parameters define the signature for overloading.
Return type. Only name and parameters define the signature for overloading.
← Didn't Know|Knew It →
Identify the method signature: 'public int compute(float num)'.
Identify the method signature: 'public int compute(float num)'.
Tap to reveal answer
compute(float). Access modifiers and return type are not part of signature.
compute(float). Access modifiers and return type are not part of signature.
← Didn't Know|Knew It →
What does a method signature determine for the compiler?
What does a method signature determine for the compiler?
Tap to reveal answer
Method calling conventions. Enables proper method resolution and type checking.
Method calling conventions. Enables proper method resolution and type checking.
← Didn't Know|Knew It →
State the rule for a valid Java method signature.
State the rule for a valid Java method signature.
Tap to reveal answer
Unique name and valid parameter list. Ensures method can be properly called and identified.
Unique name and valid parameter list. Ensures method can be properly called and identified.
← Didn't Know|Knew It →
In 'char getChar()', what is the method's return type?
In 'char getChar()', what is the method's return type?
Tap to reveal answer
char. The data type the method will return when executed.
char. The data type the method will return when executed.
← Didn't Know|Knew It →
Identify the error: 'double sum(int a, int a)'.
Identify the error: 'double sum(int a, int a)'.
Tap to reveal answer
Duplicate parameter names. Parameters must have unique names within the method.
Duplicate parameter names. Parameters must have unique names within the method.
← Didn't Know|Knew It →
What does the method signature 'String toString()' imply?
What does the method signature 'String toString()' imply?
Tap to reveal answer
Returns a String. Method will return a String object when called.
Returns a String. Method will return a String object when called.
← Didn't Know|Knew It →
Given the signature 'int add(int a, int b)', how many parameters are there?
Given the signature 'int add(int a, int b)', how many parameters are there?
Tap to reveal answer
Two parameters. Counts the comma-separated parameters in parentheses.
Two parameters. Counts the comma-separated parameters in parentheses.
← Didn't Know|Knew It →
What does a void return type indicate in a method signature?
What does a void return type indicate in a method signature?
Tap to reveal answer
Method returns no value. Indicates the method produces no output value.
Method returns no value. Indicates the method produces no output value.
← Didn't Know|Knew It →
In the method signature 'void test()', what is the return type?
In the method signature 'void test()', what is the return type?
Tap to reveal answer
void. Indicates no value is returned by this method.
void. Indicates no value is returned by this method.
← Didn't Know|Knew It →
How does Java distinguish between two overloaded methods?
How does Java distinguish between two overloaded methods?
Tap to reveal answer
By their parameter lists. Return type alone cannot differentiate overloaded methods.
By their parameter lists. Return type alone cannot differentiate overloaded methods.
← Didn't Know|Knew It →