• 1. 
    Which of these is the correct code for creating a list of names?

  • nameList = John, Harry, Jesse, John, Harry, Harry
  • nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")
  • nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
  • nameList = [John, Harry, Jesse, John, Harry, Harry]
  • 2. 
    Which colour will be replaced with yellow?

  • red
  • green
  • blue
  • none, yellow will be added to the list
  • 3. 
    To repeat a fixed number of times use a

  • while loop
  • for loop
  • if loop
  • indentation
  • 4. 
    Data type for a whole number

  • String
  • Integer
  • Boolean
  • Float
  • 5. 
    A data type consisting of numbers, letters and symbols.

  • String
  • Integer
  • Float
  • Boolean
  • 6. 
    How do we make sure that IF statements are indented correctly?

  • Don't need to
  • Use the Tab key
  • Use the Shift Key
  • Use the Enter Key
  • 7. 
    Used to create exponents

  • **
  • """
  • %
  • #
  • 8. 
    The correct syntax of the len function for string x:

  • x.len()
  • len[x]
  • LEN[]
  • len(x)
  • 9. 
    Let x= "Python is a high level language", the output of print(x[2].upper()+x[3].lower()+x[-1]) is

  • THE
  • The
  • ThE
  • the
  • 10. 
    Let x= "Python", the output of print(x.upper()) is

  • python
  • PYTHON
  • _PYTHON
  • "PYTHON"
  • 11. 
    Stores a piece of data, and gives it a specific name

  • variable
  • whitespace
  • interpreter
  • modulo
  • 12. 
    Let x= "Python is a high level language", the output of print(x.replace(x[-3],"3")) is

  • Error
  • Python is 3 high level l3ngu3ge
  • Python is a high l3v3l languag3
  • Python is a high level language
  • 13. 
    To remove the spaces present at start and end of the string, you can use

  • split()
  • len()
  • strip()
  • remove()
  • 14. 
    102 = 100Which of the following is used in Python to calculate ten squared?

  • 10 ** 2
  • 10 * 2
  • 10 % 2
  • 10 ** 10
  • 15. 
    Let x= "Python is a high level language", the output of print(x[-4].upper()+x[8]+x[-1]) is

  • Use
  • Age
  • USE
  • Error
  • 16. 
    One of the following functions is not used with Python String

  • Split
  • Remove
  • print
  • Replace
  • 17. 
    Choose the correct code to print line of 10 stars using repetition operation:

  • print("**********")
  • print("*"*10)
  • print("*"^10)
  • print("*"+10)
  • 18. 
    Let x= "python is a high level language", the output of print(x[5].replace("n","*")) is

  • pytho* is a high level language
  • python is a high level language
  • *
  • Error
  • 19. 
    Let x= "Python", the output ofprint(x[0])print(x[-1])print(x[-2])

  • PNO
  • pOn
  • thy
  • Pno
  • 20. 
    Converts a number to a string

  • str()
  • int()
  • parseInt()
  • convert
  • 21. 
    The correct syntax for converting the string x to uppercase is :

  • X.upper()
  • upper(x)
  • x.UPPER[ ]
  • x.upper()
  • 22. 
    Used to structure code in Python

  • whitespace
  • comments
  • booleans
  • variables
  • 23. 
    Changing the value of a variable

  • reassign
  • comment
  • modulo
  • boolean
  • 24. 
    Which of these would work as a piece of code?

  • IF answer == "Yes":
  • if answer == "Yes"
  • if answer == "Yes":
  • if answer = "yes":
  • 25. 
    Choose the correct syntax of the replace function:

  • x.Replace(x)
  • x.replace(y)
  • x.replace(3,x)
  • x.replace("j","3")
  • 26. 
    Choose the correct syntax of the split function:

  • x.split[]
  • split(x)
  • x.split(",", 3)
  • X.SPLIT(",", 3)
Report Question
warning
access_time
  Time