Histogram Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a ‘Histogram’?

A

A visual representation of data is called a histogram.

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

What is a method?

A

A method is a reusable section of code written to perform a specific task in a program.

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

Why do we use methods?

A
  1. Easy to fix bugs

2. We use separation of concerns

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

How do you define a method?

A

You use the def syntax along with end

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

What is the structure of a method?

A

def method_name
the_method_body
end

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

What is calling a method/function?

A

We call a method or a function when we want to use it.

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

What is a NameError?

A

You get a NameError when your program can’t find the method.

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

What is an argument?

A

The argument is the piece of code you actually put between the method’s parentheses when you call it

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

What is a parameter?

A

parameter is the name you put between the method’s parentheses when you define it.

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

What are splat arguments?

A

Splat arguments are arguments preceded by a *, which tells the program that the method can receive one or more arguments.

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

What is return?

A

When we want to get back a a value from the method instead of printing it to the console.

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

What are blocks?

A

Blocks are nameless methods.

Blocks can be defined with either the keywords do and end or with curly braces ( { } ).

They are only called once

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

Why do we use code blocks?

A

Because we want to use abstraction, which is basically making the code simpler.

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

What is a combined comparison operator?

A

The combined comparison operator is used to compare two ruby objects

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