Python - Test1 Answers

  1. Which symbol is used to comment a line of code in Python?
    ANS: #
  2. You have the following code segment:
    #print("Hello World")
    print("Hello")
    #print("World")
    What is the console output of this code?
    ANS: Hello
  3. Which file name extension do Python files end in?
    ANS: .py
  4. True or False: There is only one version of Python.
    ANS: False
  5. Which line of code has the proper syntax for the print statement?
    ANS: print( 'It\'s a smiley day' )
  6. True or False: You can combine a numeric value and a string by using the + symbol.
    ANS: False
  7. Which symbol is used to indicate that a command continues on the next line?
    ANS: \
  8. Which value type does input() return?
    ANS: string
  9. Which variable name have proper syntax?
    ANS: _myVar01
  10. Which of the following print statement is used to display multiple line text in python?
    ANS:
    print ('''Hi Everyone
    Welcome to Python Test.
    All the Best.''')
    print ("""Hi Everyone
    Welcome to Python Test.
    All the Best.""")
    print ("Hi Everyone\nWelcome to Python Test.\nAll the Best.")