{"id":16078970,"url":"https://github.com/remy727/ruby-array-operations-quiz","last_synced_at":"2025-09-10T19:31:17.945Z","repository":{"id":164926672,"uuid":"640326932","full_name":"remy727/ruby-array-operations-quiz","owner":"remy727","description":"Ruby Array Operations Quiz","archived":false,"fork":false,"pushed_at":"2023-05-13T19:22:03.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T23:51:03.798Z","etag":null,"topics":["array","quiz","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remy727.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-13T18:03:31.000Z","updated_at":"2023-05-13T20:03:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"fe5ed9bf-3f34-4d97-812e-62b08ab91b7a","html_url":"https://github.com/remy727/ruby-array-operations-quiz","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/remy727/ruby-array-operations-quiz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remy727%2Fruby-array-operations-quiz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remy727%2Fruby-array-operations-quiz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remy727%2Fruby-array-operations-quiz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remy727%2Fruby-array-operations-quiz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remy727","download_url":"https://codeload.github.com/remy727/ruby-array-operations-quiz/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remy727%2Fruby-array-operations-quiz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274511056,"owners_count":25299151,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["array","quiz","ruby"],"created_at":"2024-10-09T10:23:30.636Z","updated_at":"2025-09-10T19:31:17.826Z","avatar_url":"https://github.com/remy727.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Ruby Array Operations Quiz\n\n#### Question 1 of 10\n\nGiven the array definition below, which of the following statements does NOT return \"b\":\n\n```ruby\narr = [\"a\", \"b\", \"c\", \"d\", \"e\"]\n```\n\nSelect one of the following:\n- [ ] `arr.at(1)`\n- [ ] `arr[1]`\n- [x] `arr.fetch(\"b\")`\n- [ ] `arr.find{|i| i==\"b\"}`\n\n#### Question 2 of 10\n\nGiven the array definition below, which of the following statements raises an exception:\n\n```ruby\narr = [\"a\", \"b\", \"c\", \"d\", \"e\"]\n```\n\nSelect one of the following:\n- [x] `arr.find{|i| i==\"b\"}.map(\u0026:upcase)`\n- [ ] `arr.take(2).last(1).map(\u0026:upcase)`\n- [ ] `arr.select{|i| i==\"b\"}.map(\u0026:upcase)`\n- [ ] `arr.sample(3).map(\u0026:upcase)`\n\n#### Question 3 of 10\n\nWhat is the output from the following:\n\n```ruby\narr = [\"a\", \"b\", \"c\", \"d\", \"e\"]\narr.map(\u0026:upcase).reject!{|i| i==\"B\"}\nputs arr\n```\n\nSelect one of the following:\n- [ ] `[\"A\", \"B\", \"C\", \"D\", \"E\"]`\n- [x] `[\"a\", \"b\", \"c\", \"d\", \"e\"]`\n- [ ] `[\"b\"]`\n- [ ] `[\"B\"]`\n\n#### Question 4 of 10\n\nWhich of the following techniques CANNOT be used to create an array composed of four \"a\" characters, i.e.\n\n```ruby\n[\"a\", \"a\", \"a\", \"a\"]\n```\n\nSelect one of the following:\n- [ ] `Array.new(4, \"a\")`\n- [x] `\"aaaa\".split`\n- [ ] `[\"a\"]*4`\n- [ ] `Array.new(4) {|i| \"a\"}`\n\n#### Question 5 of 10\n\nWhich of the following array comparisons(==) return a true value\n\nSelect one or more of the following:\n- [ ] `[\"a\", 5, \"6\"].map(\u0026:to_s)==[\"a\", 5.0, 6].map(\u0026:to_s)`\n- [ ] `[\"a\", 5, \"6\"]==[\"a\", 5, \"6\", nil]`\n- [x] `[\"a\", 5, \"6\"]==[\"a\", 5.0, \"6\"]`\n- [x] `[\"a\", nil, 5, \"6\"].compact==[\"a\", 5, \"6\", nil].compact`\n- [ ] `[\"a\", 5, \"6\"]==[\"a\", 5.0, 6]`\n\n#### Question 6 of 10\n\nWhich of the following will result in the string \"12345\"\n\nSelect one or more of the following:\n- [x] `\"54321\".reverse`\n- [x] `12345.to_s.split.sum(\"\")`\n- [ ] `(1...5).map(\u0026:to_s).join(\"\")`\n- [ ] `\"54321\".split.reverse.join`\n\n#### Question 7 of 10\n\nGiven the array\n\n```ruby\nnums = [8, 13, 27, 61, 50].shuffle\n```\n\nWhich of the following methods can we rely on to extract the even elements, 8 and 50?\n\nSelect one or more of the following:\n- [x] `nums.filter{|n| n.even?}`\n- [ ] `[nums[0], nums[-1]]`\n- [ ] `nums.find{|n| n.even?}`\n- [x] `nums.select{|n| n.even?}`\n\n#### Question 8 of 10\n\nWhat is the expected output from the following code:\n\n```ruby\narr = [\"a\", \"b\", \"c\", \"d\", \"e\"]\nputs [\"a\", \"e\", \"f\"] | [\"b\"] \u0026 arr\n```\n\nSelect one of the following:\n- [ ] `[\"a\", \"e\", \"b\"]`\n- [ ] `[\"a\", \"b\", \"c\", \"d\", \"e\"]`\n- [ ] `[\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"]`\n- [x] `[\"a\", \"e\", \"f\", \"b\"]`\n\n#### Question 9 of 10\n\nWhat is the output after the following sequence of array operations:\n\n```ruby\nfoo = [\"a\", \"b\", \"c\"]\nfoo \u003c\u003c \"x\"\nfoo.shift\nfoo.append([\"d\", \"e\", \"f\"])\nfoo.unshift(\"y\")\nfoo.pop\nputs foo\n```\n\nSelect one of the following:\n- [ ] `[\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"]`\n- [ ] `[\"a\", \"b\", \"c\", [\"d\", \"e\", \"f\"]]`\n- [ ] `[\"y\", \"b\", \"c\", \"x\", \"d\", \"e\"]`\n- [x] `[\"y\", \"b\", \"c\", \"x\"]`\n\n#### Question 10 of 10\n\nWhat is the output from the following:\n\n```ruby\nnames = [\"Aodhan\", \"Domhnall\", \"Caoimhe\", \"Blaithin\"]\nscores = [68, 23, 88, 71]\nputs names.zip(scores).sort_by{|el| el[1]}.last[0]\n```\n\nSelect one of the following:\n- [ ] `Aodhan`\n- [ ] `Domhnall`\n- [x] `Caoimhe`\n- [ ] `Blaithin`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremy727%2Fruby-array-operations-quiz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremy727%2Fruby-array-operations-quiz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremy727%2Fruby-array-operations-quiz/lists"}