YEAR 1 CO2 WEEK 5 + 6 ARRAYS STRING MANIPULATION FUNCTIONS PROCEDURES Flashcards

1
Q

Define an array.

A

A collection variable or data structure which stores a collection of data items of the same data type under one identifier.

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

What are the different commands you can do with an array.

A

Array.length
Array.indexof();
Array.sort();
Array.resize

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

String Manipulation

A

String datatype is a collection of characters.
String strname = “RAD”
Char x = strname[4];
strname.length
Strname.toupper()
Strname.tolower()

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

State differences between function and procedure.

A

Both are named sections of code that take in parameters and perform a task.
Procedures do not return a value.
Functions return value to variable at location where function was called.

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

State difference between parameter and argument.

A

Parameters what are used inside subroutine and arguments the values passed into subroutine when called.

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

Difference between passing by value and passing by reference.

A

Passing a parameter by value a copy of data is used in subroutine and discarded when subroutine complete.
By reference memory address of data is used by subroutine. Any changes made to the data when subroutine executes is kept.

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