Update) Python for IT Automation | Questions & Answers|
Grade A| 100% Correct (Verified Answers)
Q. What are the traits of Imperative/procedural programming?
ANSWER
Focuses on describing a sequence of steps to perform a task
Q. What are the traits of Object-Oriented Programming (OOP)?
ANSWER
Organize code around objects, which encapsulate data and behavior.
Q. What are the traits of Functional Programming?
ANSWER
emphasizes the use of functions and immutable data for computation.
Q. What are the traits of Declarative Programming?
ANSWER
describes what the program should accomplish without specifying how to achieve it.
Q. What are the traits of Event-Driven Programming?
ANSWER
Reacts to events and user actions, triggering corresponding functions.
Q. What are the traits of Logic Programming?
ANSWER
defines a set of logical conditions and lets the system deduce solutions.
1
,Q. What does Python syntax refer to?
ANSWER
The set of rules that dictate the combinations of symbols and keywords that form valid Python programs
Q. What is the purpose of indentation in Python?
ANSWER
To define blocks of code
Q. Why might a programmer use comments for 'Preventing Execution'?
ANSWER
To temporarily disable lines or blocks of code
Q. What is the primary use of whitespace in Python?
ANSWER
To define the structure and hierarchy of the code
Q. What does Python use to define the scope of control flow statements and structures like functions and
classes?
ANSWER
Indentation
Q. What is the purpose of the input() function in Python?
ANSWER
To capture user input and store it as a string
Q. What does the format() method do in Python?
ANSWER
It enhances output formatting by embedding variables in strings. (although 'f' strings are easier to read)
2
,Q. What is the purpose of the Code Editor in a Python IDE?
ANSWER
To provide a text editor designed for Python, offering features like syntax highlighting, code completion, and
indentation.
Q. What does this built in Python function do?: print()
ANSWER
outputs text or variables to the console
Q. What does this built in Python function do?: input()
ANSWER
reads user input from the console
Q. What does this built in Python function do?: len()
ANSWER
determines the length of a sequence (string, list, tuple)
Q. What does this built in Python function do?: type()
ANSWER
returns the type of an object
Q. What does this built in Python function do?: int(), float(), str()
ANSWER
converts values to integers, floats, or strings; respectively
Q. What does this built in Python function do?: max(), min()
ANSWER
returns the maximum or minimum value from a sequence
3
, Q. What does this built in Python function do?: sum()
ANSWER
calculates the sum of elements in a sequence
Q. What does this built in Python function do?: abs()
ANSWER
returns the absolute value of a number
Q. What does this built in Python function do?: range()
ANSWER
generates a sequence of numbers
Q. What does this built in Python function do?: sorted()
ANSWER
returns a sorted list from an iterable
Q. What does this built in Python function do?: any(), all()
ANSWER
checks if any or all elements in an iterable are true
Q. What does this built in Python function do?: map(), filter()
ANSWER
applies a function to elements or filters elements based on a function
Q. What does this built in Python function do?: open(), read(), write()
ANSWER
handles file I/O operations
4