D2L Quizzes The answer is marked with * after the quiz closes. Quiz 1 ====== 1. When positioning section delimited by
tags, for which value of the CSS property position will the left and right properties have no effect? a. absolute b. fixed c. relative *d. static 2. What does the ERB statement <%= yield %> do? a. It displays the contents of a database table on a view. b. It displays the contents of a database table on a layout page. *c. It embeds a view in a layout page. d. It hides a view that should not be displayed. Quiz 2 ====== 1. Which validation is correct to insure that gpa is a number? a. validates gpa, numericality = true b. validates :gpa, :numericality = true *c. validates :gpa, numericality: true d. validates gpa, { numericality => true } 2. If Doctor is a Rails model, where would the line @doctors = Doctor.all most likely be placed? In a *a. controller b. layout page c. stylesheet d. view. Quiz 3 ====== 1. Which of the following Ruby method calls returns an object that contains the current time and date? a. CurrentDateTime.new b. DateTime.new c. DateTime.now *d. Time.now 2. Which of these creates all of the routes for a scaffold-based controller where the model is named Owner in the config/routes.rb file? a. resources Owner *b. resources :owners c. routes Owner d. routes :owners Quiz 4 ====== 1. When sending a web page back to the server, which of the following HTTP methods requires the data to be embedded in the URL? *a. GET b. POST c. PUT d. RETURN 2. Which of these model validation statements insures that the count is a positive integer with no leading zeros? a. validates :count, format: {:with: /d+/ } b. validates :count, format: {:with: /d*/ } c. validates :count, format: {:with: /[1-9]?/ } *d. validates :count, format: {:with: /[1-9]\d*/ } Quiz 5 ====== 1. What are the possible return values of the spaceship operator <=>? a. 0 and 1 *b. -1, 0, and 1 c. true and false d. true, false, and nil 2. Which method is used in a Rails model file to set up a many-to-many relationship? a. belongs_to_and_has_many *b. has_and_belongs_to_many b. many_to_many d. has_many_through Quiz 6 ====== 1. Which ActiveRecord method is used to sort the rows from a database table? a. collate *b. order c.reorder d. sort 2. Which Ruby method do you call in the config/routes.rb file to designate the view that is obtained with the URL http://localhost:3000/ a. default b. home c. index *d.root Quiz 7 ====== 1. What can you enter in a the CommandPrompt or Terminal Window to obtain all of the routes that are defined for a Rails project? a. rails paths b. rails routes c. rake paths d. rake routes 2. What is another name for a Cryptographic hash? a. array b. digest c. password d.session Quiz 8 ====== 1. Which jQuery statement sets the src attribute of the image with id="animal" to dog.jpg? a. $("animal").src("dog") b. $("#animal").attr("src", "dog") b. $("img").css("src", "dog.jpg") d. $(img#animal).css("src", "dog.jpg") 2. Which language is a simpler alternative to jQuery? a. CoffeeScript b. JavaScript c.Python d. Sinatra