Compsci 101, Fall 2012, September 5

By entering your name/net-id below you indicate you are in class on September 5 to answer these questions and that you have answered them. Your name should not appear unless you are in class when answering these questions.
Name_________________   net-id _______   Name_________________   net-id _______


Name_________________   net-id _______   Name_________________   net-id _______

  1. What is printed after the code below executes?
        contactMail = ‘RushAdams At fire.com’
           
        if contactMail.count(‘@’) == 1 :
             print ‘Valid e-mail’ 
        else:
             print ‘E-mail must contain 1 @ character’
    

    1. Valid e-mail

    2. E-mail must contain 1 @ character

    3. None

  2. What is the value of res after the code below executes?
        mark = ‘Rake up Door #2’
       
        res = “”
        res = mark[8] + mark[5]
        res = mark[2:4]
        res = mark[8] + mark[5] + res
        res = res + mark[12:14] + ‘1’
    
        #value here
    

    1. Duke #1

    2. DukeDuke #1

    3. DukeDuke #21

  3. What is the value of st after the code below executes?
       st = ""
        for x in "python":
           st = x + st
    
        #value here
    

    1. python

    2. nohtyp

    3. ptyohn