2021/3/20 Midterm 1: SP21 CSE 3901 - Proj: Web Apps (8538) https://osu.instructure.com/courses/98074/quizzes/485072 1/6 Midterm 1 Due Feb 22 at 7pm Points 55 Questions 6 Available after Feb 22 at 6:34pm Time Limit None Instructions Attempt History Attempt Time Score LATEST Attempt 1 55 minutes 40 out of 55 Correct answers are hidden. Score for this quiz: 40 out of 55 Submitted Feb 22 at 6:30pm This attempt took 55 minutes. This is an open-book, open-notes exam. However, you are not allowed to discuss this exam with anyone, including asking for help on the Internet. Before beginning this exam, log in to our Zoom meeting used for lectures. 1. Turn your video on, turn your audio off 2. Sent me a (private) chat message on Zoom: "start" 3. Start this quiz, completing and submitting it within 55 minutes 4. Afterwards, send me "done" (privately) in the Zoom chat (and leave the room) After completing the exam, do not discuss it with anyone in CSE 3901 who has not yet taken the exam. If you have any questions during the exam, send me a private chat message on Zoom. 6 / 6 ptsQuestion 1 The following IPv6 addresses each contain at least one error, making it an invalid address. For each address below, (i) describe the error and (ii) provide a minimally changed version that is a valid address. A) 2607:f8b0:4009:813:bc:32a7:200e B) 2117:bff8::00bc:a732:eeff 2021/3/20 Midterm 1: SP21 CSE 3901 - Proj: Web Apps (8538) https://osu.instructure.com/courses/98074/quizzes/485072 2/6 Your Answer: C) 26:f8b0::aa::200e a) only have 7 fields 2607:f8b0:4009:813:bc:32a7:200e:0000 b) 00bc is wrong should omit leading 0 2117:bff8::bc:a732:eeff c)Compress at most one such set of 0’s. C compress twice You need to tell how many consecutive 0 fields there are 26:f8b0:0000:0000:0000:aa:0000:200e 8 / 8 ptsQuestion 2 Your Answer: Consider the following snippet of Ruby code: # a == ?? b = a.split '+' c = b.map{ |v| v.length + 1 } # c == [2, 3, 4, 5] What value of a at the start of the code snippet would result in the value of c shown at the end? a = "2+22+222+2222" 4 / 4 ptsQuestion 3 Write the HTML source code for an ordered list consisting of the following names: Paul Sivilotti, Charlie Giles, and Bob Joseph. 2021/3/20 Midterm 1: SP21 CSE 3901 - Proj: Web Apps (8538) https://osu.instructure.com/courses/98074/quizzes/485072 3/6 Your Answer: You do not need to provide an entire HTML file. Just write the code snippet for the ordered list itself.
Question 3
- Paul
- Sivilotti
- Charlie Giles
- Bob Joseph
14 / 15 ptsQuestion 4 Your Answer: Consider a Ruby hash with keys :first, :last, and :score, representing a student. The values of :first and :last are both strings (for first and last name respectively), while the value of :score is an integer. For example: {first: "Paul", last: "Sivilotti", score: 35} Write a Ruby function named max_name that, given an array of such hashes, returns a string consisting of the full name (first and last) of the student with the largest score. For example: roster = [ {first: "Paul", last: "Sivilotti", score: 35}, {first: "Charlie", last: "Giles", score: 38}, {first: "Bob", last: "Joseph", score: 34}] max_name roster #=> "Charlie Giles" 2021/3/20 Midterm 1: SP21 CSE 3901 - Proj: Web Apps (8538) https://osu.instructure.com/courses/98074/quizzes/485072 4/6 def max_name(roster) a = roster.sort_by{|k|-k[score]} max = a[0] return max[first]+""+max[last] end Very close. Need to use symbols to access hash elements [:score] rather than [score] 4 / 10 ptsQuestion 5 Your Answer: Write a regular expression that corresponds to the language where 1. All elements have length 3, and 2. The only characters present are lower-case letters (a-z), and 3. There is at least 1 vowel (a, e, i, o, or u; Note: y is not included in this list) For example, the following strings are all in the language: cat, fee, eye, iii, qzi On the other hand, the following strings are not in the language: type (length is not 3) hi (length is not 3) Hat (only lower-case letters allowed) top3 (only lower-case letters allowed) ftp (no vowel) sty (no vowel, y is never considered a vowel) ^[a-z|aeiou]{3} 2021/3/20 Midterm 1: SP21 CSE 3901 - Proj: Web Apps (8538) https://osu.instructure.com/courses/98074/quizzes/485072 5/6 Good start. still finding 4 letter words and words without vowels 4 / 12 ptsQuestion 6 Your Answer: Assume that you have a new, empty repo in GitHub named mid1. Show the exact sequence of git commands that you would do in order to: 1. Clone the repo to your local machine 2. Create 2 new branches: "start" and "end" 3. Edit and commit in such a way that the history looks like the diagram below 4. Push the result back to GitHub 1. git clone mid1 2. git branch start 4. git commit 5.git commit 6. git fetch 7. git merge 2021/3/20 Midterm 1: SP21 CSE 3901 - Proj: Web Apps (8538) https://osu.instructure.com/courses/98074/quizzes/485072 6/6 8. git branch end 9. git push Not quite. Your sequence would not have created 2 paths between 'b' and 'e' Quiz Score: 40 out of 55
欢迎咨询51作业君