QCM : Python Data Handling and Analysis Fundamentals — 12 questions

Questions et réponses du QCM

1. What are data types in programming?

Methods for securing data in storage
Categories of data that determine what kind of value a variable can hold
Types of algorithms used to process data
Specific data structures used to store information

Categories of data that determine what kind of value a variable can hold

Explication

Data types are categories of data that determine what kind of value a variable can hold, such as int, float, str, or bool, which is explicitly stated in the context.

2. What is the escape sequence used in Python to insert a newline character in a string?

\n
\t
\b
\r

\n

Explication

The escape sequence `\n` is used in Python to insert a newline character within a string, as explicitly mentioned in the content. It causes the text following it to appear on a new line when the string is printed.

3. What is the primary role of variables and the input() function in a program?

The input() function displays messages to the user.
The input() function stores data into variables.
Variables are used to perform calculations directly.
Variables store data, and input() retrieves user input to be stored in variables.

Variables store data, and input() retrieves user input to be stored in variables.

Explication

Variables are used to store data during program execution, and the input() function is used to receive data from the user, which can then be stored in variables for further use.

4. When were assignment statements first established as a fundamental feature in programming languages?

In the 2000s
In the 1970s
In the 1980s
In the 1950s

In the 1950s

Explication

Assignment statements have been a core feature of programming languages since the early days of programming, around the 1950s, making them one of the foundational elements established early in the development of programming languages.

5. How do operators and expressions differ or are similar in programming?

Operators are the data types used in programming, while expressions are the functions that manipulate data.
Operators are symbols that perform actions on variables and values, while expressions are combinations of variables, values, and operators that evaluate to a value.
Operators are the complete calculations performed in a program, whereas expressions are only the symbols used to perform those calculations.
Operators are the final output of calculations, whereas expressions are the variables that store data.

Operators are symbols that perform actions on variables and values, while expressions are combinations of variables, values, and operators that evaluate to a value.

Explication

Operators are symbols that perform specific actions on variables and values, such as addition or multiplication. Expressions are combinations of variables, values, and operators that can be evaluated to produce a result. Therefore, operators are the building blocks used within expressions, making the first option correct and the others incorrect.

6. Who is credited with proposing the programming language that includes the concepts of type casting and operator precedence?

Bjarne Stroustrup
Dennis Ritchie
Guido van Rossum
James Gosling

Guido van Rossum

Explication

Guido van Rossum is credited with creating Python, a language that explicitly incorporates and formalizes concepts like type casting and operator precedence, making him the correct answer.

7. What is a likely consequence of using comments and proper formatting in programming?

Higher chances of syntax errors due to comments
Greater difficulty in understanding code logic
Increased code complexity and difficulty in debugging
Improved code readability and reduced likelihood of errors

Improved code readability and reduced likelihood of errors

Explication

Using comments and proper formatting enhances code readability and helps prevent errors, making the code easier to understand and maintain, which is the positive effect.

8. How do you apply running a Python script in practice from the command line?

Copy and paste the script code into an interactive Python shell.
Open the script in a text editor and save it.
Use the 'python filename.py' command in the terminal.
Run the script by double-clicking the file in the file explorer.

Use the 'python filename.py' command in the terminal.

Explication

The correct way to run a Python script from the command line is by using the 'python filename.py' command in the terminal or command prompt, which executes the script file directly. Opening in a text editor or double-clicking does not execute the script in the command line environment, and copying code into an interactive shell is manual and not the typical application of running scripts.

9. What is a key feature of built-in functions in Python?

They are only available in external libraries
They must be imported explicitly before use
They are user-defined functions created by programmers
They are always available without importing modules

They are always available without importing modules

Explication

Built-in functions in Python are always available by default and do not require importing external modules, making them readily accessible for common programming tasks.

10. What is a user module in Python?

A function that is defined within a script for specific tasks
A pre-compiled binary package used for deploying Python applications
A file created by the user containing Python code that can be imported into other scripts
A built-in library provided by Python for standard functionalities

A file created by the user containing Python code that can be imported into other scripts

Explication

A user module is a Python file created by the user that contains functions, classes, or variables, which can be imported into other scripts to promote code reuse and organization.

11. What is a fundamental characteristic of NumPy arrays that differentiates them from Python lists?

NumPy arrays are mutable, unlike lists
NumPy arrays can only contain elements of the same data type
NumPy arrays can contain elements of different data types within the same array
NumPy arrays are limited to one dimension

NumPy arrays can only contain elements of the same data type

Explication

NumPy arrays are homogeneous, meaning all elements must be of the same data type, which differentiates them from Python lists that can contain mixed data types.

12. What is the primary role or purpose of a pandas DataFrame in data analysis?

To perform numerical calculations on individual data points
To store and organize structured data in a tabular format for analysis and manipulation
To connect and query databases directly from Python
To visualize data through plotting and graphing functions

To store and organize structured data in a tabular format for analysis and manipulation

Explication

A pandas DataFrame is designed to store, organize, and manipulate structured data in a tabular format, making it central to data analysis tasks. It allows for easy data selection, filtering, and analysis, which is its primary role.

Révisez avec les flashcards

Mémorisez les réponses avec 24 flashcards sur Python Data Handling and Analysis Fundamentals.

Data Types — definition?

Categories of data that determine stored values.

Variables — role?

Store data values during program execution.

Type Casting — mechanism?

Converts data from one type to another.

Voir les flashcards →

Approfondir avec la fiche

Consultez la fiche de révision complète sur Python Data Handling and Analysis Fundamentals.

Voir la fiche →

Cours similaires

Crée tes propres QCM

Importe ton cours et l'IA génère des QCM avec corrections en 30 secondes.

Générateur de QCM