We can't directly multiply elements of array, it will show an error Output: can't convert Array into Integer
Question 4. What is the output of the given code?string_array = ["a","e","i","o","u"]boolean_array = ["True","False"]puts string_array[3]puts boolean_array
[a","e","i","o","u"].
Error
c) o
True
False
None of the mentioned
Explanation:-
Answer: Option C. -> c) o
True
False
The array is a string array and the index is 3 so 'o' will be the output and then the boolean_array will get printed. Output: o True False
Question 5. What will be the output of the following?array = [100, 200, 300, 400, 500]print array[4]
400
500
Nil
None of the mentioned
Explanation:-
Answer: Option B. -> 500
Array's index start from 0 so array[4] will give 500. Output: 500
Question 6. What will be the output of the following?array = [100, 200, 300, 400, 500]print array[5]
400
500
Nil
None of the mentioned
Explanation:-
Answer: Option C. -> Nil
Array's index start from 0 so array[5] will give nothing. Output: Nil
Question 7. What is the output of the given code? string_array = ["a","e","i","o","u"]boolean_array = ["True","False"]puts string_array[3]puts boolean_array
[a","e","i","o","u"].
Error
o
True
False
None of the mentioned
Explanation:-
Answer: Option C. -> o
True
False
The array is a string array and the index is 3 so 'o' will be the output and then the boolean_array will get printed. Output: o True False
Question 8. What is the output of the given code?a=["hey", "ruby", "language"]b=["hey", "ruby", "language"]if a==b print "Equal"else print "Not equal"end
Equal
Error
Not equal
None of the mentioned
Explanation:-
Answer: Option A. -> Equal
Elements of both the array are same and in same sequence hence they are equal. Output: Equal
Question 9. What is the output of the given code?string_array = ["a","e","i","o","u"]boolean_array = ["True","False"]puts string_array[3]puts boolean_array[1]
[a","e","i","o","u"]
Error
o
False
None of the mentioned
Explanation:-
Answer: Option C. -> o
False
The array is a string array and the index is 3 so 'o' will be the output and then the boolean_array[1] = false will get printed. Output: o False
Question 10. What will be the output of the following?array1 = [100, 200, 300, 400, 500]array2 = [1,2,3,4,5]if array1 == array2print "They are equal"else print "Not equal"end
They are equal
Not equal
Nil
None of the mentioned
Explanation:-
Answer: Option B. -> Not equal
Two arrays are said to be equal if each and every element of both the arrays are equal. Output: Not equal