Reverse Array Elements
Given an array [3, 1, 4, 2], what is the result of reversing it?
- [2, 4, 1, 3]
- [2, 1, 4, 3]
- [4, 3, 1, 2]
- [3, 4, 1, 2]
- [2, 4, 3, 1]
String Split
What is the result of splitting the string 'hello world' by a space character?
- ['hello', 'world']
- ['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
- ['helloworld']
- ['hello world']
- ['hello', '', 'world']
Array Length
If arr = [7, 'a', 9, 2], what does arr.length return?
- 4
- 5
- 3
- 2
- arr.lenght
String Concatenation
Which of the following correctly concatenates 'Java' and 'Script' in most programming languages?
- 'Java' + 'Script'
- 'Java' u0026 'Script'
- 'Java'.join('Script')
- 'Java'.concatinate('Script')
- 'Java'.add('Script')
Finding Index
Given fruits = ['apple', 'banana', 'cherry'], what is the index of 'cherry'?
- 2
- 1
- 3
- 0
- -1
Array Push
If nums = [1, 2, 3] and we perform nums.push(4), what is the new array?
- [1, 2, 3, 4]
- [4, 1, 2, 3]
- [1, 2, 3]
- [1, 2, 3];4
- [1, 2, 3, 4, 5]
Substring Extraction
What does 'computer'.substring(3, 6) return?
- 'put'
- 'com'
- 'comp'
- 'puter'
- 'pute'
Removing Last Array Element
What is left in arr = ['red', 'green', 'blue'] after calling arr.pop()?
- ['red', 'green']
- ['red', 'blue']
- ['green', 'blue']
- ['red']
- ['green']
Case Conversion
If you apply the toUpperCase() method to the string 'array', what do you get?
- 'ARRAY'
- 'Array'
- 'array'
- 'Arrray'
- 'aRRAY'
Accessing Characters
How do you access the third character of the string 'Python'?
- 'Python'[2]
- 'Python'[1]
- 'Python'.charAt(3)
- 'Python'.at(2)
- 'Python'.get(3)