EXAM 2 Flashcards

1
Q

What are the 4 benefits of using methods

A

Reusability, Breaking down complexity, Redeable to user, allows a user to focus on what a method does not HOW it does it

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

example of sentinel loop

A

while loop

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

example of count controlled loop

A

for loop

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

list all necessary import statements

A

import java.io.*
import java.util.*

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

program header

A

public class name{
public static void main(String[] args){

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

what to say for throws

A

throwsFileNotFoundException

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

what does a break statement do

A

exits the loop entirely

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

what does a continue statement do

A

skips to the next iteration of the loop

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

format of a switch statement

A

switch (int n){
case 5:
case 10:
case 20:
default:
}

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

what is recursion

A

A method calling the method itself within

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

Base recursive case

A

the condition to stop recursion

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

Recursive case

A

a method calling itself

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