Python MCQ-1



  1. In Python, print () by default adds which of the following as an end line argument?
    1. \t
    2. \n
    3. \s
    4. \r

  2. Which of the following is not true about variable names?
    1. The length of the variable name is fixed
    2. Can contain upper case or lowercase letters and digits 0-9
    3. Variable names cannot begin with a digit
    4. Variable names are case sensitive

  3. What does IDE stand for?
    1. Internet Data Evaluation
    2. Integrated Drive Electronics
    3. Integrated Development Enterprises
    4. Integrated Development Environment

  4. In Spyder, the command to clear the console is
    1. %reset
    2. %delete
    3. %del
    4. %clear

  5. Which of the following code cannot be used to initialize multiple variables with a common value?
    1. a, b, c = 55
    2. a, b, c = 55, 55, 55
    3. a = b = c = 55
    4. a = 55; b = a; c = b

  6. What will be the output after executing the following codes?

    x=45
    y=7
    x%=y
    print(x)

    1. 6
    2. 42
    3. 3
    4. 52

  7. Which of the following is true with respect to the below codes?

    a=4**3
    b=pow(4,3)

    1. a == b
    2. a ≠ b
    3. a < b
    4. a > b

  8. What will be the output after executing the following codes?

    x=8
    if x>8:
        print(20)
    else:
        print(10)

    1. 20
    2. ValueError
    3. 10
    4. SyntaxError

  9. Which of the following conversion results in an error?
    1. int('10.8')
    2. float(10)
    3. int(10)
    4. float(10.8)

  10. Which of the following command is used to print the output 01-Jan-2020 ?
    1. print('01','Jan', sep=' ', end='-2020')
    2. print('01','Jan', sep='-', end='-2020')
    3. print('01','Jan', sep='-', end='2020')
    4. print('01','Jan','2020', sep='-', end='-2020\n')

  11. For which type of error does the interpreter runs the program and does not report an error?
    1. Semantic error
    2. Syntax error
    3. Runtime error
    4. Key error

  12. What will be the output after executing the following codes?

    x=27
    y=4
    print(x//y)

    1. SyntaxError
    2. 6.75
    3. 3
    4. 6

  13. Identify which of the following is not a valid variable name?
    1. X005 =10
    2. A.2 = 10
    3. N_s = 10
    4. r10 = 10

  14. What does the following statements do?
      import sys
      print(sys.version)
    1. Displays the current Python version
    2. Displays the operating system version
    3. Displays the location of the Python interpreter
    4. All of the above

  15. The operators 'is' & 'is not' are?
    1. Comparison Operators
    2. Identity Operators
    3. Membership Operators
    4. Relational Operators

  16. How many operands are there in the following arithmetic expression?
            6 * 35 + 8 - (25 / 5)
    1. 4
    2. 3
    3. 5
    4. 8

  17. What would be the datatype of variable 'c' after executing the following code?

    a=5
    b=6
    c=print(a/b)

    1. float
    2. Nonetype
    3. int
    4. object

  18. Which is not a valid assignment operator?
    1. **=
    2. +=
    3. //=
    4. %%=

  19. Which is not a valid bitwise operator?
    1. &
    2. ~
    3. ^
    4. <=

  20. The datatype of the variable a = (1i) is
    1. str
    2. complex
    3. SyntaxError
    4. tuple


No comments:

Post a Comment