What statistical measure can be used to detect outliers in a dataset using NumPy?
Variance
Standard deviation
Median absolute deviation
Mode
Outlier detection often relies on measuring how far values deviate from a “typical” center. While variance and standard deviation can be used in simple z-score based methods, they arenot robust: a few extreme outliers can inflate the mean and standard deviation, masking the very outliers you want to find. A widely taught robust alternative is themedian absolute deviation (MAD), which is based on the median rather than the mean and therefore resists distortion by extreme values.
MAD is computed by first taking the median of the data, then computing the absolute deviation of each point from that median, and finally taking the median of those deviations. Because medians are stable under extreme values, MAD provides a strong baseline for identifying unusually distant points. Many textbooks and data analysis references present MAD as a robust scale estimator for outlier detection, often combined with a threshold rule such as flagging points whose deviation exceeds a constant multiple of MAD (with a scaling factor sometimes used to make it comparable to standard deviation under normality assumptions).
In NumPy, you can implement MAD using np.median() and np.abs(). Mode is generally not useful for continuous numeric outlier detection, and variance/standard deviation are more sensitive to outliers than MAD. Thus, among the given options, the best statistical measure for detecting outliers robustly is the median absolute deviation.
Which brand of Type 1 hypervisor is commonly used to create virtual machines?
VMware ESXi
Parallels Desktop
VirtualBox
VMware Workstation
AType 1 hypervisor, also called abare-metal hypervisor, runs directly on the host machine’s hardware rather than on top of a general-purpose operating system. This design is widely described in virtualization textbooks because it improves performance and isolation: the hypervisor controls CPU scheduling, memory management, and I/O virtualization with minimal overhead from an intermediate OS layer. Type 1 hypervisors are therefore common in servers and data centers.
Among the options,VMware ESXiis the well-known Type 1 hypervisor product. It is installed directly onto physical server hardware and provides the virtualization layer used to run multiple virtual machines. In contrast, Parallels Desktop, VirtualBox, and VMware Workstation are typically categorized asType 2 hypervisors, meaning they run as applications on top of a host operating system like Windows, macOS, or Linux. Type 2 hypervisors are excellent for desktops, development, testing, and learning, but they generally rely on the host OS for device drivers and resource management, which can add overhead.
This distinction matters in practice: data centers favor Type 1 hypervisors for efficiency, centralized management, and robust isolation between workloads. Desktop users often choose Type 2 hypervisors for convenience and easier installation. Therefore, the commonly used Type 1 hypervisor brand listed here is VMware ESXi.
Which protocol provides encryption while email messages are in transit?
FTP
HTTP
TLS
IMAP
“Encryption in transit” means protecting data while it moves across a network so that eavesdroppers cannot read or modify it. For email systems, this protection is most commonly provided byTLS (Transport Layer Security). TLS is a cryptographic protocol that can wrap application protocols (including mail protocols) to provide confidentiality, integrity, and server (and sometimes client) authentication. In practice, TLS is used to secure connections such as SMTP submission (often with STARTTLS or implicit TLS), IMAP over TLS, and POP3 over TLS. Textbooks present TLS as the standard successor to SSL and the foundation of secure communication on the modern Internet.
The other options are not correct in this context. FTP is a file transfer protocol and is traditionally unencrypted unless paired with additional security mechanisms (e.g., FTPS, which uses TLS, or SFTP, which uses SSH). HTTP is a web protocol; it becomes encrypted only when used as HTTPS, which again relies on TLS underneath. IMAP is an email retrieval protocol, butIMAP itself is not the encryption protocol—IMAP can be run over TLS (IMAPS) to become secure.
Therefore, the protocol that provides encryption while email messages (or email protocol traffic) are in transit is TLS.
Which Python command can be used to display the results of calculations?
print()
compute()
result()
solve()
In Python, the standard way to display output to the console is the built-in function print(). When a program performs calculations—such as arithmetic expressions, function results, or computed statistics—print() can be used to show those results to the user. For example, print(2 + 3) displays 5, and print(total / count) displays the computed average. Textbooks introduce print() early because it supports interactive learning, debugging, and communicating program behavior.
print() can display one or multiple items separated by commas, automatically converting them to string form. It also supports formatting via f-strings (e.g., print(f"Sum = {s}")) and optional parameters like sep and end to control output formatting. This makes it versatile for reporting calculated values, intermediate steps in algorithms, and final program outputs.
The other options are not standard Python built-ins for output. compute(), result(), and solve() are not universally defined commands in Python; they might exist as user-defined functions or in specific libraries, but they are not the general command taught in textbooks for displaying results. Python follows a clear separation: expressions compute values; print() displays them.
Therefore, the correct answer is print(), as it is the primary mechanism for producing human-readable output from calculations in typical Python programs and coursework.
What is a key advantage of using NumPy when handling large datasets?
Built-in machine learning algorithms
Automatic data cleaning
Efficient storage and computation
Interactive visualizations
NumPy’s key advantage for large datasets isefficient storage and fast computation. Unlike Python lists, which store references to objects and can have per-element overhead, NumPy arrays store data in a compact, homogeneous format (single dtype) in contiguous or strided memory. This reduces memory usage and improves cache locality, which is crucial for performance on large arrays. Additionally, NumPy operations are vectorized: many computations run in optimized compiled code rather than interpreted Python loops. This enables large speedups for arithmetic, linear algebra, statistics, and transformations over entire arrays.
Option A is incorrect because NumPy itself does not provide full machine learning algorithms; those are typically found in libraries like scikit-learn, though they build on NumPy. Option B is incorrect because NumPy does not automatically clean data; data cleaning is usually done with pandas or custom logic. Option D is incorrect because interactive visualizations are typically handled by libraries like matplotlib, seaborn, or plotly, not by NumPy.
Textbooks in scientific computing highlight that NumPy forms the computational foundation of the Python data ecosystem. Its array model supports broadcasting, slicing, and efficient aggregations, all of which are essential when working with millions of numeric values. By combining compact memory layout with compiled numerical kernels, NumPy enables scalable analysis and simulation workloads that would be slow or memory-heavy using pure Python lists.
What is the output of print(employees[3]) when employees = ["Anika", "Omar", "Li", "Alex"]?
"Omar"
"Alex"
"Anika"
"Li"
Python lists are ordered sequences indexed starting from 0. This zero-based indexing is standard in many programming languages and is a core concept in data structures. For the list `employees = ["Anika", "Omar", "Li", "Alex"]`, the mapping of indices to elements is: index 0 → "Anika", index 1 → "Omar", index 2 → "Li", index 3 → "Alex". Therefore, the expression `employees[3]` selects the element at index 3, which is `"Alex"`, and `print(employees[3])` outputs `Alex` (strings print without quotes in normal output).
Option A would be correct for `employees[1]`, option D would be correct for `employees[2]`, and option C would be correct for `employees[0]`. This kind of question tests understanding of list indexing, which is essential for iteration, slicing, and algorithm implementation.
# Textbooks also note the difference between indexing and slicing: indexing returns a single element, while slicing returns a sublist. Here, because square brackets contain a single integer index, it is indexing. If you attempted an index that is out of range, Python would raise an `IndexError`, which reinforces careful reasoning about list length and positions. Understanding these fundamentals is critical for correctly manipulating datasets, where row/column positions and offsets frequently matter.
Which sorting algorithm works by finding the smallest or largest element in an unsorted part of a list and moving it to the sorted part of the list?
Radix sort
Heap sort
Quicksort
Selection sort
Selection sort is defined by a simple repeated strategy: divide the list into a sorted region and an unsorted region, then repeatedly select the smallest (or largest) element from the unsorted region and move it to the end of the sorted region. In the common “smallest-first” version, the algorithm scans the unsorted portion to find the minimum element, then swaps it into the next position in the sorted portion. After the first pass, the smallest element is fixed at index 0; after the second pass, the second-smallest is fixed at index 1; and so on until the entire list is sorted.
This exactly matches the description in the question, making selection sort the correct answer. Textbooks often use selection sort to teach algorithmic thinking because it is easy to understand and implement, though not efficient for large datasets. Its time complexity is O(n²) in the average and worst case because it performs roughly n scans of progressively smaller unsorted sections, with each scan taking linear time. Its space usage is O(1) additional space because it sorts in place using swaps.
The other options do not match the described mechanism. Quicksort partitions around a pivot, heap sort uses a heap data structure to repeatedly extract the maximum/minimum, and radix sort processes digits/keys by place value rather than selecting minima by scanning. Selection sort’s defining action is the repeated “select the min/max and place it.”
What is the component of the operating system that manages core system resources but allows no user access?
The kernel
The File Explorer
User interface layer
Device driver manager
Thekernelis the central component of an operating system responsible for managing core system resources. It controls CPU scheduling, memory management, process creation and termination, device I/O coordination, and system calls—the controlled interface through which user programs request services. In operating systems textbooks, the kernel is described as running in a privileged mode (often called kernel mode or supervisor mode), which restricts direct user access for security and stability. User programs typically run in user mode and cannot directly manipulate hardware or critical OS structures; instead, they must request operations via system calls, which the kernel validates and executes.
This separation prevents accidental or malicious actions from crashing the entire system or compromising other processes. For example, a user application cannot directly write to arbitrary memory addresses or reprogram devices; the kernel mediates access and enforces protection boundaries. This model is foundational to modern OS design and underpins features like virtual memory, access control, and multitasking.
File Explorer and the user interface layer are user-facing components that provide interaction and file browsing; they are not the privileged core resource manager. “Device driver manager” is not typically the name of a single OS component; while drivers and driver subsystems exist, they operate under kernel control and are part of the kernel or closely integrated with it.
Therefore, the OS component that manages core resources while disallowing direct user access is the kernel.
What is the expected output of numpy_array[1]?
An error message in the array
The second element of the array
A display of the entire array
The first element of the array
In Python and NumPy, indexing iszero-based, meaning the first element of a 1D sequence is at index 0, the second element is at index 1, and so on. A NumPy array behaves like a sequence for basic indexing, so numpy_array[1] returns the element stored at position 1 in the array. This is a fundamental concept taught in introductory programming and scientific computing: indexing selects a single element, while slicing selects a range.
For example, if numpy_array = np.array([5, 8, 13]), then numpy_array[0] is 5, numpy_array[1] is 8, and numpy_array[2] is 13. The expression numpy_array[1] therefore evaluates to thesecond element(8 in this example). This does not display the entire array (that would happen with print(numpy_array)), and it does not produce an error unless the array is too short. An error such as IndexError occurs only if index 1 is out of bounds, for example when the array has length 1 and you try to access numpy_array[1].
Textbooks emphasize careful reasoning about indices because off-by-one errors are common. In data analysis, correct indexing is crucial for extracting the right observations, features, or time steps from numerical datasets.
What is another term for the inputs into a function?
Variables
Procedures
Outputs
Arguments
In programming, a function takes inputs, performs computation, and may return an output. The standard term for a function’s inputs isarguments(also commonly discussed alongside the closely related termparameters). Textbooks typically distinguish the two:parametersare the names listed in the function definition, whileargumentsare the actual values supplied when the function is called. For example, in def f(x, y):, x and y are parameters. In the call f(3, 5), 3 and 5 are arguments. Many introductory materials use “arguments” informally to refer to the inputs overall, which matches the wording of this question.
Options A, B, and C do not fit the textbook definition. “Variables” is too broad; inputs can be literals, expressions, or variables, but the conceptual role is “arguments.” “Procedures” are callable units of code (often used in some languages to mean functions without return values), not the inputs. “Outputs” refers to returned results, not what you pass in.
Understanding arguments is important because it connects to call semantics, scope, and correctness. Different languages support positional arguments, keyword arguments, default values, and variadic arguments (e.g., *args, **kwargs in Python). This flexibility shapes API design and influences how programmers structure reusable code.
What are Python functions that belong to specific Python objects?
Modules
Methods
Scripts
Libraries
In object-oriented programming, amethodis a function that is associated with an object (or its class) and is called using the dot operator. In Python, everything is an object, and many operations are provided through methods. For example, "hello".upper() calls the upper method of a str object, and [1, 2, 3].append(4) calls the append method of a list object. Textbooks emphasize that methods operate on an object’s internal state and typically receive the object itself as an implicit first argument (commonly named self in class definitions). This is what distinguishes methods from standalone functions.
Modules, scripts, and libraries are different organizational concepts. Amoduleis a file containing Python code, including function and class definitions. Ascriptis a Python program intended to be run directly. Alibraryis a collection of modules that provides reusable functionality. None of these terms specifically mean “functions that belong to objects.”
Understanding methods matters because it connects to encapsulation and abstraction: objects provide behaviors (methods) that manipulate their data in well-defined ways. This design enables clearer APIs and supports polymorphism, where different object types can expose methods with the same name but different implementations. In Python, method calls are central to working with built-in types (strings, lists, dictionaries) and with user-defined classes, making “methods” the correct term for functions that belong to specific objects.
What is the only content that will display if the List folder contents permission is not enabled for a particular folder in Windows 11?
The folder’s author
The folder’s creation date
Files with Write permission
Files with Read permission
In Windows file security (NTFS permissions), “List folder contents” controls whether a user cansee the names of files and subfoldersinside a folder. If a user does not have permission to list a folder, Windows prevents directory enumeration: the user cannot browse the folder and view what is inside. (2BrightSparks) This is a key concept in access control: it separates “being able to traverse to a location” from “being able to see what is stored there.”
When “List folder contents” is not enabled, the user typically cannot view the list of files regardless of whether individual files might have separate permissions. In standard user-facing behavior, what remains visible in the folder’s properties and metadata is limited; among the choices given, the only item that is reliably a folder-level metadata attribute (and not a listing of contents) is the folder’screation date. The “author” is not a universal, reliably displayed NTFS folder property, and options C and D talk about files (contents), which cannot be listed without the list permission. (2BrightSparks)
This reflects a broader textbook principle: operating systems enforce access control both on objects (files/folders) and on operations (read data, write data, list directory). Removing the list operation blocks visibility of contents, even if other permissions exist elsewhere.
What happens if one element of a NumPy array is changed to a string?
All elements in the array are coerced to strings.
The operation is not allowed and raises an error.
All elements in the array are coerced to integers.
The array becomes a list of the original integers.
A central rule in NumPy is that an ndarray has a single, fixed data type called itsdtype. That dtype is chosen when the array is created (for example, int64, float64, etc.), and it normally does not change just because you assign a new value into one element. When you attempt an assignment, NumPy tries tocastthe assigned value into the array’s existing dtype. If the cast is possible, the assignment succeeds; if the cast is impossible, NumPy raises an error.
So, if you have a numeric array such as arr = np.array([1, 2, 3]), its dtype is an integer type. Trying arr[0] = "hello" cannot be converted into an integer, so NumPy raises a ValueError (a casting/conversion error). This is exactly the behavior textbooks highlight when contrasting NumPy arrays with Python lists: lists can hold mixed types freely, but NumPy arrays trade that flexibility for speed and memory efficiency via uniform typing.
Option A is a common misconception. While NumPy may “upcast” values to a more general dtype at array creation time when mixed types are provided (e.g., numbers and strings in the same constructor), a pre-existing numeric array will not automatically convert itself into a string array during a single-element assignment. Options C and D do not reflect NumPy’s assignment rules.
How does the data type of a variable get set in Python?
It is explicitly declared by the programmer.
It is chosen randomly.
It is always set to string by default.
It is determined by the value assigned to it.
Python usesdynamic typing, a core concept emphasized in programming language textbooks. In dynamically typed languages, a variable name does not permanently “own” a type. Instead, theobjectcreated by an expression has a type, and the variable becomes a reference to that object. Therefore, the type associated with a variable at any moment is determined by the value assigned to it. For example, after x = 7, x refers to an integer object. After x = "seven", the same name now refers to a string object. The type changes because the binding changes, not because the variable’s type declaration was edited.
Option A describesstatic typingsystems (common in languages like Java, C, or C++), where programmers declare types and compilers enforce them. Python does not require such declarations for ordinary variables. Option B is incorrect because type assignment is deterministic, not random. Option C is incorrect because Python does not default variables to strings; it assigns whatever type results from the right-hand-side expression.
This model is closely tied to Python’s runtime behavior: type checks occur during execution, and functions can accept values of different types as long as the operations used are valid (often discussed as “duck typing”). This flexibility supports rapid development, but also motivates careful testing and, in larger systems, optional type hints for documentation and tool support.
What is the alternative way to access the third element of the first row in np_2d?
np_2d[1, 3]
np_2d[2, 0]
np_2d[3, 1]
np_2d[0, 2]
NumPy arrays use zero-based indexing, meaning counting starts at 0 rather than 1. In a 2D NumPy array, indexing is typically written in the form array[row_index, column_index]. The first index selects the row, and the second index selects the column. Therefore, the “first row” corresponds to row index 0. Within that row, the “third element” corresponds to column index 2, because the columns are indexed 0, 1, 2, 3, and so on.
So, np_2d[0, 2] directly selects the element at row 0 and column 2, which is the third element in the first row. This is considered an “alternative” to approaches like two-step indexing (np_2d[0][2]), and it is the standard idiom taught for multi-dimensional NumPy arrays.
The other choices point to different locations. np_2d[1, 3] is the fourth element of the second row, not the third element of the first row. np_2d[2, 0] and np_2d[3, 1] attempt to access the third or fourth row, which would often be out of bounds in a small 2-row example and would raise an IndexError. Correct indexing is a cornerstone of array programming because it determines which observation, feature, or matrix entry your computations will use.
Which Python function is used to display the data type of a given variable?
type()
GetVar()
Show()
Data()
Python is a dynamically typed language, meaning variables do not require explicit type declarations; instead, objects carry type information at runtime. To inspect the type of an object, Python provides the built-in function type(). When you pass a variable or value into type(), it returns the object’s class, which represents its data type. For example, type(5) returns
Textbook discussions often pair type() with Python’s object model: everything in Python is an object, and each object is an instance of some class. type() reveals that class. In addition, type() can be used in more advanced ways, such as dynamic class creation, but its foundational educational use is type inspection.
The other options are not correct because GetVar(), Show(), and Data() are not standard Python built-ins for type checking. While developers can define functions with those names, they are not part of Python’s core language or standard library in the sense required by the question. For typical coursework and professional Python usage, the correct and universally accepted function is type().
Which Python function would be used to check the data type of a variable bmi?
check(bmi)
datatype(bmi)
typeof(bmi)
type(bmi)
Python provides the built-in function `type()` to determine the data type (more precisely, the class) of an object. Because Python is dynamically typed, variable names are references to objects, and the object itself carries its type information at runtime. Calling `type(bmi)` returns a type object such as `
Option C, `typeof(bmi)`, is common in JavaScript, not Python. Options A and B are not standard Python built-ins; they might exist in user code or other languages, but not in Python’s core language. In typical coursework and professional usage, `type()` is the correct function.
Textbooks also discuss how `type()` differs from `isinstance()`. While `type()` directly reports the object’s class, `isinstance(bmi, float)` is often preferred when you want to allow subclass relationships. For example, in object-oriented programming, a subclass instance should often be treated as an instance of its parent class, which `isinstance` supports. However, when the question asks specifically for the function used to “check the data type,” the expected answer is `type()`.
# Understanding type inspection helps with debugging, writing robust functions, and reasoning about operations that are valid for different data types.
How is a NumPy array named data with 6 elements reshaped into a 2x3 array?
np.reshape(data, (2, 3))
np_reshape(list, (2, 3))
data.set_shape(2, 3)
data_reshape[2, 3]
Reshaping is the operation of changing the “view” of an array so that the same elements are arranged with new dimensions. In NumPy, reshaping is possible when the total number of elements stays the same. A 2x3 array contains 6 elements, so a 1D array data of length 6 can be reshaped into shape (2, 3) without adding or removing values. Textbooks stress this invariant: the product of the dimensions must equal the original size.
NumPy provides two standard reshaping interfaces: the function np.reshape(data, (2, 3)) and the method data.reshape(2, 3) (or data.reshape((2, 3))). Option A is correct because it uses the official NumPy function with the proper arguments: the original array and the target shape. The shape is passed as a tuple describing rows and columns.
Option B is incorrect because np_reshape is not the correct NumPy function name, and it references an unrelated identifier list. Option C is incorrect because NumPy arrays do not provide a set_shape method like that. Option D is not valid NumPy syntax for reshaping.
Reshaping is fundamental in data analysis and machine learning: it converts flat vectors into matrices, prepares batches of samples, and aligns dimensions for matrix multiplication and broadcasting.
TESTED 26 Aug 2026
