AP Computer Science a Flashcards: Method Signatures

Study Method Signatures in AP Computer Science a with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.

AP Computer Science a

Method Signatures

0 mastered0 still learning

0% Complete

QUESTION
1/ 75

What does a method signature determine for the compiler?

Tap card or press Space to flip

ANSWER

Method calling conventions. Enables proper method resolution and type checking.

How well did you know it?

Card 1 / 75

What this deck covers

This deck focuses on Method Signatures, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.

How to use these flashcards

Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.

All flashcards

Flashcard 1: What does a method signature determine for the compiler?

Answer: Method calling conventions. Enables proper method resolution and type checking.

Flashcard 2: In 'float calculate(double x)', what is the return type?

Answer: float. The data type returned when method execution completes.

Flashcard 3: What determines the method to execute among overloaded methods?

Answer: Parameter list matching. Compiler matches arguments to parameter types and count.

Flashcard 4: How many parameters are in 'void process(int a, float b, String c)'?

Answer: Three parameters. Counts each comma-separated parameter in the list.

Flashcard 5: Identify the method signature: 'void compute(int a, double b)'.

Answer: compute(int, double). Return type and access modifier are excluded from signature.

Flashcard 6: In 'float calculate(double x)', what is the return type?

Answer: float. The data type returned when method execution completes.

Flashcard 7: Identify the components of a method signature.

Answer: Method name and parameter list. These uniquely identify how to call the method.

Flashcard 8: What distinguishes overloaded methods in Java?

Answer: Different parameter lists. Same name but different parameters allows multiple versions.

Flashcard 9: In 'double getValue()', what is the return type?

Answer: double. The data type this method produces when called.

Flashcard 10: Identify the method signature: 'void compute(int a, double b)'.

Answer: compute(int, double). Return type and access modifier are excluded from signature.

Flashcard 11: What part of a method is not included in its signature?

Answer: Return type. Only name and parameters define the signature for overloading.

Flashcard 12: What is the return type in the signature: 'boolean check(int x)'?

Answer: boolean. Indicates the method returns a boolean value.

Flashcard 13: How does Java distinguish between two overloaded methods?

Answer: By their parameter lists. Return type alone cannot differentiate overloaded methods.

Flashcard 14: In 'char getChar()', what is the method's return type?

Answer: char. The data type the method will return when executed.

Flashcard 15: What is the parameter list in 'void setValues(int a, float b)'?

Answer: int, float. The types of data the method accepts as input.

Flashcard 16: Find the error in 'void method(int x, int x)'.

Answer: Duplicate parameter names. Parameter names must be unique within the method scope.

Flashcard 17: Find the error in the signature: 'int calculate(double x, double x)'.

Answer: Parameter names must be unique. Each parameter needs a distinct identifier within the method.

Flashcard 18: Find the error in the signature: 'int calculate(double x, double x)'.

Answer: Parameter names must be unique. Each parameter needs a distinct identifier within the method.

Flashcard 19: How many parameters are in 'void process(int a, float b, String c)'?

Answer: Three parameters. Counts each comma-separated parameter in the list.

Flashcard 20: In 'double getValue()', what is the return type?

Answer: double. The data type this method produces when called.

Flashcard 21: What is the method name in 'boolean isValid(int a, int b)'?

Answer: isValid. The identifier that appears before the parameter list.

Flashcard 22: Identify the method name in the signature 'void draw()'.

Answer: draw. The identifier used to invoke this method.

Flashcard 23: Given the signature 'int add(int a, int b)', how many parameters are there?

Answer: Two parameters. Counts the comma-separated parameters in parentheses.

Flashcard 24: What is the purpose of a method signature in Java?

Answer: Defines method's name and parameter types. Allows compiler to identify methods and validate calls.

Flashcard 25: What determines the method to execute among overloaded methods?

Answer: Parameter list matching. Compiler matches arguments to parameter types and count.

Flashcard 26: Which part of the method signature indicates its name?

Answer: The method name itself. The identifier used to call the method.

Flashcard 27: In 'void transform(int x)', what is the parameter type?

Answer: int. The data type of the single parameter variable.

Flashcard 28: What is the effect of changing the parameter type in a signature?

Answer: Creates an overloaded method. New signature allows method overloading to occur.

Flashcard 29: Given the signature 'int add(int a, int b)', how many parameters are there?

Answer: Two parameters. Counts the comma-separated parameters in parentheses.

Flashcard 30: Given 'void log()', identify a valid overloaded method.

Answer: void log(String message). Adding parameters creates a different method signature.

Flashcard 31: Identify the components of a method signature.

Answer: Method name and parameter list. These uniquely identify how to call the method.

Flashcard 32: In the method signature 'void test()', what is the return type?

Answer: void. Indicates no value is returned by this method.

Flashcard 33: In 'void transform(int x)', what is the parameter type?

Answer: int. The data type of the single parameter variable.

Flashcard 34: What is the parameter type in 'void print(double value)'?

Answer: double. The data type of the single parameter accepted.

Flashcard 35: Find the error in 'void method(int x, int x)'.

Answer: Duplicate parameter names. Parameter names must be unique within the method scope.

Flashcard 36: What does the parameter list in a method signature specify?

Answer: Types and number of parameters. Determines what arguments can be passed to the method.

Flashcard 37: State the rule for method overloading.

Answer: Methods must differ in parameter types or number. Enables multiple methods with same name but different usage.

Flashcard 38: What is the parameter type in 'String format(String pattern)'?

Answer: String. The data type of the method's single parameter.

Flashcard 39: In 'char getChar()', what is the method's return type?

Answer: char. The data type the method will return when executed.

Flashcard 40: What distinguishes overloaded methods in Java?

Answer: Different parameter lists. Same name but different parameters allows multiple versions.

Flashcard 41: What is the parameter type in 'String format(String pattern)'?

Answer: String. The data type of the method's single parameter.

Flashcard 42: Identify the method signature: 'public int compute(float num)'.

Answer: compute(float). Access modifiers and return type are not part of signature.

Flashcard 43: What does the method signature 'String toString()' imply?

Answer: Returns a String. Method will return a String object when called.

Flashcard 44: What does a void return type indicate in a method signature?

Answer: Method returns no value. Indicates the method produces no output value.

Flashcard 45: What is the return type in the signature: 'boolean check(int x)'?

Answer: boolean. Indicates the method returns a boolean value.

Flashcard 46: What does a void return type indicate in a method signature?

Answer: Method returns no value. Indicates the method produces no output value.

Flashcard 47: How does Java distinguish between two overloaded methods?

Answer: By their parameter lists. Return type alone cannot differentiate overloaded methods.

Flashcard 48: Identify the error: 'double sum(int a, int a)'.

Answer: Duplicate parameter names. Parameters must have unique names within the method.

Flashcard 49: Which method signature is a valid overload of 'void execute()'?

Answer: void execute(int). Different parameter list makes this a valid overload.

Flashcard 50: What is the parameter list in 'void setValues(int a, float b)'?

Answer: int, float. The types of data the method accepts as input.

Flashcard 51: Which method signature is a valid overload of 'void execute()'?

Answer: void execute(int). Different parameter list makes this a valid overload.

Flashcard 52: What is the effect of changing the parameter type in a signature?

Answer: Creates an overloaded method. New signature allows method overloading to occur.

Flashcard 53: Identify the error: 'double sum(int a, int a)'.

Answer: Duplicate parameter names. Parameters must have unique names within the method.

Flashcard 54: Given 'void log()', identify a valid overloaded method.

Answer: void log(String message). Adding parameters creates a different method signature.

Flashcard 55: What is the method name in 'boolean isValid(int a, int b)'?

Answer: isValid. The identifier that appears before the parameter list.

Flashcard 56: What is the purpose of a method signature in Java?

Answer: Defines method's name and parameter types. Allows compiler to identify methods and validate calls.

Flashcard 57: State the rule for method overloading.

Answer: Methods must differ in parameter types or number. Enables multiple methods with same name but different usage.

Flashcard 58: Identify the method name in the signature 'void draw()'.

Answer: draw. The identifier used to invoke this method.

Flashcard 59: What distinguishes 'void run()' from 'int run()'?

Answer: Return type. Return type differs but signature components are identical.

Flashcard 60: What part of a method is not included in its signature?

Answer: Return type. Only name and parameters define the signature for overloading.

Flashcard 61: In the method signature 'void test()', what is the return type?

Answer: void. Indicates no value is returned by this method.

Flashcard 62: Which component of a method signature affects overloading?

Answer: Parameter list. Return type cannot distinguish overloaded methods in Java.

Flashcard 63: What does the method signature 'String toString()' imply?

Answer: Returns a String. Method will return a String object when called.

Flashcard 64: What does 'int compare(String a, String b)' return?

Answer: int. The data type produced when method execution finishes.

Flashcard 65: What distinguishes 'void run()' from 'int run()'?

Answer: Return type. Return type differs but signature components are identical.

Flashcard 66: What does 'int compare(String a, String b)' return?

Answer: int. The data type produced when method execution finishes.

Flashcard 67: What is the parameter type in 'void print(double value)'?

Answer: double. The data type of the single parameter accepted.

Flashcard 68: Which component of a method signature affects overloading?

Answer: Parameter list. Return type cannot distinguish overloaded methods in Java.

Flashcard 69: What does the parameter list in a method signature specify?

Answer: Types and number of parameters. Determines what arguments can be passed to the method.

Flashcard 70: State the rule for a valid Java method signature.

Answer: Unique name and valid parameter list. Ensures method can be properly called and identified.

Flashcard 71: What is the return type in 'boolean checkStatus()'?

Answer: boolean. The data type returned when method executes successfully.

Flashcard 72: What does a method signature determine for the compiler?

Answer: Method calling conventions. Enables proper method resolution and type checking.

Flashcard 73: What is the return type in 'boolean checkStatus()'?

Answer: boolean. The data type returned when method executes successfully.

Flashcard 74: State the rule for a valid Java method signature.

Answer: Unique name and valid parameter list. Ensures method can be properly called and identified.

Flashcard 75: Which part of the method signature indicates its name?

Answer: The method name itself. The identifier used to call the method.