| Snaprecruit.com

| Snaprecruit.com

Interview question based on skill :

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. Ruby was designed and developed by who and in what year?

Correct Answer is : Yukihiro Matsumoto in 1993

2. $LOAD_PATH is used to

Correct Answer is : Make Ruby aware that included files must be searched in the current directory

3. Which of the following is not a feature of object-oriented programming language?

Correct Answer is : Morphism

4. The blueprint from which individual objects are created is

Correct Answer is : A class

5. Which of the following variables are not available across classes?

Correct Answer is : Global variables

6. Arrays can be used to store multiple values in one single variable.

Correct Answer is : TRUE

7. What will be output of the given code? my_array = [1, 2, 3, 4] print my_array

Correct Answer is : [1, 2, 3, 4].

8. Each element in an array has an index and the starting index is index 1.

Correct Answer is : FALSE

9. What will be the output of the following? array = [100, 200, 300, 400, 500] print array[4]

Correct Answer is : 500

10. What will be the output of the following? array = [100, 200, 300, 400, 500] print array[5]

Correct Answer is : Nil

11. What will be the output of the following? array = [100, 200, 300, 400, 500] print "array[5]"

Correct Answer is : array[5].

12. What will be the output of the following? array1 = [100, 200, 300, 400, 500] array2 = [1,2,3,4,5] if array1 == array2 print "They are equal" else print "Not equal" end

Correct Answer is : Not equal

13. What will be the output of the following? array1 = [0,0,0] array2 = [0,0,0] if array1 == array2 print "They are equal" else print "Not equal" end

Correct Answer is : They are equal

14. What will be the output of the following? array1 = [1,2,3] array2 = [0,0,0] if array1 >= array2 print "Greater or equal" else print "Not equal" end

Correct Answer is : Error

15. What will be the output of the following? array1 = [1,2,3] array2 = [0,0,0] if array1 == array2 print "Equal" else print "Not equal" end

Correct Answer is : Equal

16. Array of arrays are called multidimensional arrays.

Correct Answer is : TRUE

17. Array of arrays are called multidimensional arrays.

Correct Answer is : TRUE

18. What is the output of the given code? multi_d_array = [[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]] print multi_d_array

Correct Answer is : [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]].

19. What is the output of the given code? multi_d_array = [[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]] print multi_d_array

Correct Answer is : [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]].

20. What is the output of the given code? multi_d_array = [[1,2,3,4],[0,0,0,0]] multi_d_array.each { |x| puts "#{x}\n" }

Correct Answer is : [1, 2, 3, 4].