Home
Sign in
Close menu
Home
Sign in
Lesson list
Introduction to Ruby and Object Oriented Programming
Close
Chapter 1: Getting Started with Web Development
1. Goals of the Intro Course
2. Guidelines for Learning
Chapter 2: Ruby Fundamentals
1. Introduction to Ruby
2. Setting up your environment
3. Super basic command line crash course
4. Your First Ruby Program
5. Math is easy
6. Strings
7. Variables
8. Arrays
9. Hashes
10. Looping and Iterating
11. Defining our own methods
12. Conditionals and Logical Operators
Chapter 3: Object oriented programming
1. Introduction to Object Oriented Programming
2. Classes
3. Instance Variables
4. attr_reader and attr_writer
5. Instance Methods, Class Methods, and Encapsulation
6. Inheritance
Chapter 4: Ruby challenges
1. FooBar Challenge
2. Test-First Ruby: Hello
3. Challenge: Temperature Conversion
4. Challenge: Ordinal
5. Challenge: Building a Deck of Cards
Introduction to Ruby and Object Oriented Programming > Ruby Fundamentals
Quiz - 8. Arrays
Q1.
Check the ways in which we define array.
array[1] = 'test'
array.first = 'test'
array = Array.new
array = []
Q2.
How can we find the length of an array?
array.size
array.length
array.volume
array.count
Q3.
Following are the ways we can fetch data from array
array[0]
array[2+3]
array[2+3]
array.last
Q4.
Check the correct statements
array.include?(var) checks if the var is present in the array.
array.join('-') concatinates array values with a '-' and gives a string.
array.index(var) provides the position of var starting from 1.
array.push(var) and array << var, both are equivalent.
array.sample gives index of array in random order.
Q5.
Array can be a combination of
integers and strings.
arrays and objects
combination of any valid data type in ruby.
only same type of data.
Submit