To Exam Info

IT231 -- Midterm Review Questions 2

 

  1. Which of the following is NOT required in an XHTML file?
    1. An XHTML validation header.
    2. Attribute values must be in double quotes.
    3. Tag names must be spelled in upper case.
    4. Tags must be nested.

  2. What is a CSS class?
    1. The set of images in /public/images.
    2. The set of input tags in the view.
    3. The set of HTML tags in the body section of the page.
    4. A user defined set of properties and values that can be used to set the style for HTML elements.

  3. Which of the following is NOT a server-side programming language?
      a. ASP.Net        b. JavaScript        c. PHP        d. Ruby on Rails
     
  4. What is a controller?
      a. A collection of Ruby script files.      b. A DOS command.
      c. An HTTP routing destination.          d. A Ruby class containing one method for each action.
     
  5. What does this command line statement do?
    1. Creates a complete HTML file from a view file.
    2. Implements the specifications generated by the previous migrate statement.
    3. Removes all improper scripts in a project.
    4. Updates the timestamps for all database rows.

  6. What does this Ruby statement do?
    1. Gives the index view (if one exists) priority over the current view.
    2. Places the proper view code within a layout.
    3. Stops the execution of the current controller.
    4. Switches to a different controller.

  7. Which of these is NOT an HTTP command?
      a. DELETE         b. GET             c. LIST         d. POST
     
  8. What is the default port for HTTP?
      a. 80        b. 1023         c. 3000          d. 5000
     
  9. What is a resource?
    1. A database table that is created by the controller.
    2. A piece of information that is accessed or otherwise processed by a Rails project.
    3. Images that are stored in the public folder.
    4. Text that is displayed on the views.

  10. If these Ruby statements are executed today (October 12, 2010), what is the output?
    a. 10 12 b. 12 10 c. 1012 d. 1210
     
  11. Which Ruby statement randomly assigns n to 10 or 20 with equal probability?
    a. n = 10 + rand(20)                  b. n = 10 + 10 * rand(2)
    c. n = 10 * (1 + rand(1))             d. n = 10 * (1 + rand(21))
     
  12. What is the meaning of = in Ruby?
    1. Assigns the value of an expression to a variable.
    2. Checks whether two objects are equal.
    3. Used to evaluate a method in the controller.
    4. Used to solve a mathematical equation.

  13. What are the possible return values from the <=> operator method:
    a. true or false         b. true, false, or nil           c. 0 or 1            d. -1, 0, or 1
     
  14. Write a Ruby script that inputs the course score and outputs the course grade.
    A == 90..100, B == 80..89, C == 70..79, D == 60..69, F == 0..59.
    Use an if..elsif..end statement. Ans:

     
  15. What is the output?
  16. What is the output
  17. What is the output?
  18. Modify the Chinese Zodiac Example (Example ??) to accept user input.
     
  19. Rewrite the Consultant BS Generator Example (Example 18) to display the output on a web page.
     
  20. Add this method to the Dice class (Example 14) and test it:
  21. Write lines of Ruby code to test this Person class:
    class Person
    
      def initialize(the_name, the_age)
        @name = the_name
        @age = the_age
      end
      
      def display
        print "Name: #{@name}  Age: #{@age}\n"	
      end
      
      def have_birthday
        @age = @age + 1
      end
    	
    end
    
  22. Draw the UML diagram of the Person class in Problem 23.