The _______ operator returns True if the value on its left is less than the one on its right.

  • Greater than (>)
  • Greater than or equal to (>=)
  • Less than (<)
  • Less than or equal to (<=)
The 'Less than' operator returns True if the value on its left is less than the one on its right.

To execute a Python script, which of the following commands can be used?

  • execute script.py
  • python script.py
  • run script.py
  • start script.py
To execute a Python script, you can use the command python script.py. This command runs the Python interpreter and executes the script specified after python. It's the standard way to execute Python scripts from the command line or terminal.

What is the result of the operation True or False and True?

  • Error
  • FALSE
  • TRUE
  • True and False is not allowed.
The operation 'True or False and True' will result in an error because 'and' has higher precedence than 'or,' and 'and' is trying to combine a Boolean ('False') with a non-Boolean ('True').

What is the maximum length of an identifier (name of a variable, function, etc.) in Python?

  • 63 characters
  • 79 characters
  • 99 characters
  • No fixed limit
In Python, the maximum length of an identifier (variable name, function name, etc.) is 79 characters. However, it's good practice to keep identifiers concise and meaningful.

Unlike lists, tuples are _______ in Python, meaning they cannot be modified after they are created.

  • Dynamic
  • Immutable
  • Mutable
  • Static
Tuples in Python are immutable, which means their elements cannot be changed or modified after the tuple is created.

You're working on a project where a derived class Laptop inherits from two base classes: Computer and PortableDevice. Both base classes have a method named power_on(). If you call power_on() from a Laptop object without any specifications, which method will be invoked?

  • An error will occur due to ambiguity in method names in the multiple inheritance scenario
  • The power_on() method of the Computer class will be invoked
  • The power_on() method of the Laptop class will be invoked
  • The power_on() method of the PortableDevice class will be invoked
In the case of multiple inheritance, if two base classes have a method with the same name, the method of the first base class listed in the inheritance declaration is invoked. In this scenario, calling power_on() from a Laptop object without specifications will invoke the power_on() method of the Computer class.

Who is the creator of Python?

  • Dennis Ritchie
  • Guido van Rossum
  • James Gosling
  • Larry Wall
Python was created by Guido van Rossum in the late 1980s and was first released in 1991.

_______ is an environment where you can write and execute Python commands one-by-one.

  • Compiler
  • Debugger
  • IDE
  • REPL
A REPL (Read-Eval-Print Loop) is an interactive environment where you can input and execute Python commands interactively.

If d is a dictionary, the method d.______() will return a list of all the values in the dictionary.

  • extract_values
  • get_values
  • list_values
  • values
The values() method in Python returns a view object that displays a list of all the values in the dictionary. You can convert this view to a list if needed.

Which of the following can be used to import only a specific function or class from a module?

  • from module import function
  • import function from module
  • import module
  • import module.function
You can use 'from module import function' to import only a specific function or class from a module in Python.