12th Class Computers Science Sample Paper Python Revision Tour-Sample Paper-2

  • question_answer
    What will be the output of the given statement?  
     

    A) CBSE               

    B) ESBC

    C) Generate Error    

    D) None of the above

    Correct Answer: B

    Solution :

    [b] As string slicing starts from end "-1" and also use backward indexing, so, it will reverse the given string and the answer you will get is "ESBC"
    i If i%2==0 Print name[i].upper() else Print name[i].lower()
    0 True S False  
    1 False   True t
    2 True U False  
    3 False   True d
    4 True Y False  
    5 False   True  
    6 True T False  
    7 False   True r
    8 True l False  
    9 False   True g
    10 True G False  
    11 False   True e
    12 True R False  
    So, final output is StUdY TrIgGeR
     


You need to login to perform this action.
You will be redirected in 3 sec spinner