Module 4 (Midterm) Flashcards

Learn about method calls and placement Identify the parts of a method Add parameters to methods Create methods that return values Learn about Classes and Objects Create a class Create instance methods in a class Declare objects and use their methods

1
Q

Object-oriented programming System(OOPs) is a programming paradigm based on the concept of “_______” that contain data and methods.

A

objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The primary purpose of object-oriented programming is to increase the _______ and _______ of programs.

A
  • flexibility
  • maintainability
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Object oriented programming brings together data and its behaviour(methods) in a single location(object) makes it easier to understand how a program works.

A

Object oriented programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A _________ is a program module, contains a series of statements that carries out a task.

-object
-variable
-method
-class

A

method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

executes automatically when you run a program. It can execute additional methods, and those methods can execute others.

-predefined method
-main() method
-method
-user-defined method

A

main() method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

To execute a method, _________ or _________from another method

A

Invoke or call from another method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The calling method (client method) makes a method call

-True
-False

A

T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The method header is also called a(n) ________

-declaration
-identifier
-access specifier
-definition

A

declaration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Every method must include the two parts:

A
  • Method header
  • Method body
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

_________ is found between a pair of curly braces. It Contains the statements that carry out the work.

A

Method body

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Method body is also called _________

-instance
-declaration
-implementation
-content

A

implementation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which is a method header:

  • public static void main(String[] args)
    -public class First
    -methodName()
    -public static void methodName()
A

public static void main(String[] args)

public static void methodName()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The method header contains (give 4):

A

Optional access specifiers
A return type
An identifier
Parentheses

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The method must be placed within the main() that will use it

-True
-False

A

False

-Place the entire method within the class that will use it
-Not within any other method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Access specifiers can be (Give 4):

A

public
private
protected
package

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Access Specifiers are also called _________

A

access modifiers

17
Q

______ access allows use by any other class

-public
-private
-protected
-package

A

public

18
Q

The main() method in an application must specify _______ access

-public
-private
-protected
-package

A

public

19
Q

The _______ modifier means that the methods do not require an object to be created

-access
-static
-void
-class

A

static

20
Q

________ describes the type of data the method sends back to the calling method

-keywords
-access specifier
-parameter
-return type

A

return type

21
Q

The main() method in an application must have a _______ return type

-reference
-void
-integer
-String

A

void

22
Q

If no data is returned to the method, the return value is _______

-zero
-void
- 1
-none

A

void

23
Q

Method name rules (Give 3):

A

Must be one word
No embedded spaces
Cannot be a Java keyword

24
Q

Every method header contains a set of _________ that follow the identifier

  • parentheses
  • curly braces
  • brackets
A

parentheses

25
Q

Data items you use in a call to a method

-Arguments
-Parameters
-Value
-Specifier

A

Arguments

26
Q

The only part of a method that the client sees or with which it interacts

A

Interface

27
Q

Encapsulation of method details within a class

A

Implementation hiding

28
Q

A method that contains a single parameter must have (5):

A

Optional access specifiers
Return type for the method
Method name
Parameter type
Local name for the parameter