Programming and Problem Solving Through Python Language Theory Question

Introduction to Python - Set 3

  1. Python is a case sensitive language when dealing with identifiers.
    1. True
    2. False
    3. Sometimes
    4. Never
    Answer : A
    Explain : Yes, Python is a case-sensitive language, so identifiers are case-sensitive.
  2. Which of the following is not a keyword in python ?
    1. return
    2. in
    3. False
    4. false
    Answer : D
    Explain : In python, False is keyword, first letter is in Upper case.
  3. Which of the following is true for variable names ?
    1. unlimited length
    2. limited length
    3. ampersand can be used in its name
    4. None of above
    Answer : A
    Explain : Variable can declare of any lenght.
  4. Which of the following are valid escape sequences in Python ?
    1. \n
    2. \t
    3. \\
    4. All of the above
    Answer : D
    Explain : \n- End of line, \t- horizontal tab, \\- Blackslash.
  5. In which language is Python written ?
    1. C
    2. C++
    3. Java
    4. None of above
    Answer : A
    Explain : Python written in the C programming language. It means that the Python interpreter is written in C.
  6. Which keyword is used for function ?
    1. fun
    2. def
    3. define
    4. function
    Answer : B
    Explain : Here def is only keyword given and we also use def to define a function.
  7. What keyword is used in Python to raise exceptions?
    1. Raise
    2. goto
    3. try
    4. except
    Answer : A
    Explain : The raise keyword raises an error and stops the control flow of the program.
  8. Which one of the following is the correct extension of the Python file?
    1. .python
    2. .py
    3. .p
    4. None of above
    Answer : B
    Explain : Extension of python - .py.
  9. How many keywords present in the python programming language?
    1. 32
    2. 29
    3. 33
    4. 64
    Answer : C
    Explain : But presently python have 35 keywords in Python 3.
  10. Which of the following concepts is not a part of Python?
    1. Pointers
    2. Loops
    3. Dynamic typing
    4. All of the Above
    Answer : A
    Explain : Python use both loops and dynamic typing (which means that variable types are determined and checked at runtime rather than during compilation.)
  11. To start Python from the command prompt, use the command ______
    1. execute python
    2. go python
    3. python
    4. run python
    Answer :
    Explain : Just open a command-line or terminal and then type in python, your python start.
  12. Which of the following is not a data type in python?
    1. String
    2. numbers
    3. Slice
    4. List
    Answer : C
    Explain : Slice is not a data type.
  13. PVM is often called _________.
    1. Python Interpreter.
    2. Python compiler
    3. Python Volatile machine
    4. Portable virtual machine
    Answer : A
    Explain : PVM is a software that converts bytecode to machine code for a given OS. PVM is also known as Python Interpreter.
  14. Which is the special symbol used in python to add comments?
    1. $
    2. /
    3. /*………..*/
    4. #
    Answer : D
    Explain : For single line comment use # and for multi line use - ''.
  15. Python uses:
    1. compiler
    2. assembler
    3. interpreter
    4. Linker only
    Answer : C
    Explain : Python use interpreter.

Next Set

1 2 4