Multiple-choice Test: Sample questions

These are question samples for the multiple choice exam on Web technologies.

HTML Test questions

  1. Which of the above can be a correct HTML (or XHTML) document written accordingly to W3C specifications:
    1. <?xml version="1.0" encoding="utf-8"?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
      ...
      </html>
      
    2. ...

Spring test questions:

  1. Consider the following code in the controller:
    public class StandardController implements Controller {
        public ModelAndView handleRequest(HttpServletRequest request,
                            HttpServletResponse response) throws Exception {
            Map<String,Object> model = new HashMap<String,Object>();
            model.put("message","Hello");
            return new ModelAndView("view", "model", model);
        }
    }
    

    How the message can be output in a Velocity template view.vm?

    1. <h1>$model.get($message)</h1>
      
    2. <h1>$model.message</h1>
      
    3. <h1>$message</h1>
      
    4. <h1>$model.$message</h1>
      
    5. <h1>${model.message}</h1>
      
  2. Consider the following code in the controller:
    public class StandardController implements Controller {
        public ModelAndView handleRequest(HttpServletRequest request,
                            HttpServletResponse response) throws Exception {
            Map<String,Object> model = new HashMap<String,Object>();
            model.put("message","Hello");
            return new ModelAndView("view", model);
        }
    }
    

    How the message can be output in a Velocity template view.vm?

    1. <h1>$model.get($message)</h1>
      
    2. <h1>$model.message</h1>
      
    3. <h1>$message</h1>
      
    4. <h1>$model.$message</h1>
      
    5. <h1>${model.message}</h1>