CBSE CS and IP

CBSE Class 11 & 12 Computer Science and Informatics Practices Python Materials, Video Lecture

Revision of basics of Python (1 Mark Questions)

  1. Find the option(s) which will give error:
    • raise="NO"
    • assert=50
    • my#Marks=50
    • 9_90=5

  2. Is Python case sensitive when dealing with identifiers?
    • yes
    • no
    • machine-dependent
    • none of the mentioned

  3. What will be the output of the following python command:
    >>> "*".join("Hello")
    i) "Hello*"  ii) "*Hello"  iii) Error  iv) None of these
    

  4. What is the output of : S = “COMPUTER SCIENCE” Print(S[-10:5:-2])
    • 'E' 
    • '' (Empty String)
    • 'CS RE'
    • 'C E'

  5. What is the output of :
    S = "INFORMATICS PRACTICES"
    print(S[-9:5:-2])
    i) 'PSIA'    ii)  '' (Empty String)  iii) 'MTC'  iv) '  CTM'
    

  6. What will be the output of the following python command:
    >>> bool(5*5/5-5) or bool('5-5')
    i)   True
    ii)  False
    iii) Error
    iv) None of These

  7. Find the output of the following :
    word="green vegetables"
    print(word.find('g',2))
    i)    0			
    ii)   8			
    iii) -1			
    iv)  Error
  8. Write the valid identifier in the following:
    i)   My.File
    ii)  My-File
    iii) 2um
    iv) pie

  9. Write the type of tokens from the following:
    i)  12.6
    ii) False

  10. What type of objects can be used as keys in dictionaries?
  11. What are two ways to remove something from a list? Write syntax only for both.
  12. Convert the following for loop into a while loop : 
    1
    2
    for k in range (10,20,5) :                            
        print(k)
    

1 comment: