Learning Goal 1 (Lessons 1-4)

15 important questions on Learning Goal 1 (Lessons 1-4)

What should you avoid to prevent out of bounds errors with list indexes?

In many languages trying to access indexes of a list that don't exist will create an error. There are many strange behaviors that can result from referencing list indexes that are less than 0 or greater than the highest index in your list. If you want to avoid these kinds of errors then it is useful to know how long your list is, especially since we've seen that lists can grow and shrink during the course of our program.

What is data abstraction in programming?

Data abstraction is used to manage complexity in a program by giving a collection of data a name without referencing the specific details of the representation.

How do you reference the value of the 4th element in a list?

The example below prints the value of the 4th element in the list.
console.log(myArray[3]);
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart

How do you set the value of the first item in a list to 10?

Example: Set the first value of the list to 10.
myFirstArray[0] = 10;

How are lists created in JavaScript?

Lists are created using var.

How can you reference locations in lists in arithmetic expressions?

You can reference locations in lists in arithmetic expressions, just like you might a variable.

How can lists be initialized or set in JavaScript?

Lists can be initialized/set using =.

How are values in a list separated and enclosed?

Values in a list are separated with commas, and the entire list is enclosed in brackets [ ].

What is a string in coding?

A string is a list of characters that are stored inside quotation marks (ex. "hello").

How are strings similar to lists?

The characters in a string each have an index. Just like in lists, the first index will be 0.

What does string.length return?

string.length returns the length of a string.

How does string.substring(start,end) function?

string.substring(start,end) returns a portion of the string, beginning at the start index and ending with the letter before the end index.

What is the length of the string "This or that"?

The length of the string "This or that" is 12.

What does myString.substring(0,4) return?

myString.substring(0,4) returns "This".

What does myString.substring(5,7) return?

myString.substring(5,7) returns "or".

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo