[Q16-Q37] Full Foundations-of-Computer-Science Practice Test and 72 Unique Questions, Get it Now!

Share

Full Foundations-of-Computer-Science Practice Test and 72 Unique Questions, Get it Now!

The Best Foundations-of-Computer-Science Exam Study Material Premium Files  and Preparation Tool

NEW QUESTION # 16
Which statement describes the relationship between trees and graphs?

  • A. Trees cannot have cycles.
  • B. Trees do not have levels.
  • C. Trees can have cycles.
  • D. Trees can have unconnected nodes.

Answer: A

Explanation:
In discrete mathematics and computer science, atreeis a special kind ofgraph. The standard graph-theory definition is that a tree is aconnected, acyclicundirected graph. "Acyclic" means it containsno cycles, i.e., you cannot start at a vertex, follow a sequence of edges, and return to the starting vertex without repeating edges in a way that forms a loop. (Wikipedia) This property is exactly what makes option D correct.
The other options contradict the definition. If a structure has cycles, it is not a tree (though it may still be a graph). If it has unconnected nodes, it is not connected; such a structure is more like aforest(a disjoint union of trees) rather than a single tree. (Wikipedia) The idea of "levels" belongs to a particular computer-science representation called arooted tree, where one node is chosen as the root and nodes can be assigned depths
/levels based on distance from the root. But levels are not required in the abstract definition of a tree as a graph; they arise from choosing a root and orientation for convenience in algorithms like BFS/DFS, heaps, and parse trees.
So, the relationship is: every tree is a graph with extra structure-specifically, no cycles and (typically) connectivity-and the "no cycles" rule is the key distinguishing feature. (Discrete Mathematics)


NEW QUESTION # 17
What is a correct call to the linear search defined as def linear_search(customersList, search_value): ?

  • A. find_linear(customersList)
  • B. search_linear(customersList, search_value)
  • C. print(linear_search(customersList, search_value))
  • D. linear_search()(customersList)

Answer: C

Explanation:
A function definition in Python specifies a function name and a list of parameters. Here, def linear_search (customersList, search_value): defines a function named linear_search that requirestwo argumentswhen called: a list (or sequence) of customer items and the value being searched for. A correct call must therefore supply both arguments in the same order: linear_search(customersList, search_value). Option B is correct because it calls the function properly and then prints the returned result.
Textbooks describe linear search as scanning the list from the beginning to the end, comparing each element to search_value until a match is found or the list ends. The function typically returns an index (e.g., position of the match) or a Boolean, or possibly -1/None if not found. Wrapping the call in print(...) is a standard way to display the returned value for testing or demonstration.
Option A is incorrect because it calls a different function name, not linear_search. Option C is incorrect because linear_search() would attempt to call the function with zero arguments, which would raise a TypeError, and then it tries to call the result as if it were another function. Option D uses a different function name (search_linear) and also contains a spelling mismatch compared to the given definition.


NEW QUESTION # 18
What happens if you try to create a NumPy array with different types?

  • A. The array will be split into multiple arrays, one for each type.
  • B. The array will be created, but calculations will not be possible.
  • C. The array will contain a single type, converting all elements to that type.
  • D. The array will be created with no issues.

Answer: C

Explanation:
When NumPy constructs an ndarray, it chooses a single data type called the dtype for the entire array. This is a defining feature of NumPy arrays: unlike Python lists, which can hold mixed object types freely, a NumPy array is designed for efficient numerical computation by storing values in a uniform, contiguous representation. Therefore, if you provide mixed types at creation time, NumPy will select a dtype that can represent all provided values and will convert elements as needed.
This process is commonly described as type promotion or coercion to a common type. For example, mixing integers and floats produces a float array because floats can represent integers without loss of generality.
Mixing numbers and strings often results in a string dtype (or, in some cases, an object dtype), because numbers can be converted to their string representations. Once the dtype is chosen, the array behaves consistently under vectorized operations appropriate for that dtype.
Option B correctly summarizes this textbook behavior: the array will contain a single type, converting all elements to that type. Option A is too absolute-many mixed-type arrays still support calculations depending on the resulting dtype. Option C is vague and misses the crucial fact that conversion occurs. Option D is not how NumPy works; it never automatically splits inputs into multiple arrays by type.
Understanding dtype coercion matters because it affects memory usage, performance, and whether numerical operations behave as expected.


NEW QUESTION # 19
Which file system is commonly used in Windows and supports file permissions?

  • A. FAT32
  • B. EXT4
  • C. NTFS
  • D. HFS+

Answer: C

Explanation:
Windows commonly uses the NTFS (New Technology File System) for internal drives and many external drives because it supports advanced features required for modern operating systems. One of the most important features is support forfile and folder permissionsvia Access Control Lists (ACLs). Permissions enable the OS to enforce security policies by controlling which users and groups can read, write, execute, modify, or delete specific resources. This is fundamental to multi-user security and is a standard topic in operating systems and security textbooks.
FAT32 is an older file system designed for simplicity and broad compatibility. It does not provide the same fine-grained permission model as NTFS, which is why it is often used for removable media where cross- platform compatibility matters more than access control. HFS+ is historically associated with Apple's macOS systems, and EXT4 is widely used on Linux. While these file systems have their own permission and feature models, they are not the common Windows default for permission-managed storage in typical Windows deployments.
NTFS also supports journaling (improving reliability after crashes), large file sizes, quotas, compression, and encryption features (through Windows facilities). In enterprise environments, NTFS permissions integrate with Windows authentication and directory services, enabling centralized user management. Therefore, for Windows systems requiring file permissions, NTFS is the correct answer.


NEW QUESTION # 20
What is the correct way to represent a boolean value in Python?

  • A. "true"
  • B. "True"
  • C. True
  • D. true

Answer: C

Explanation:
Python has a built-in boolean type named bool, which has exactly two values: True and False. These are language keywords/constants and are case-sensitive. Therefore, the correct representation of a boolean value is True (capital T, lowercase rest) or False (capital F). This is consistently taught in introductory programming textbooks because it affects conditional statements (if, while), logical operations (and, or, not), and comparisons.
Option A, "True", is a string literal, not a boolean. While it visually resembles the boolean constant, it behaves differently: non-empty strings are "truthy" in conditions, but "True" == True is false because they are different types (str vs bool). Option B, "true", is also a string, and it differs in casing as well. Option D, true, is not valid in Python; it will raise a NameError unless a variable named true has been defined.
Textbooks also stress that boolean values often result from comparisons, such as x > 0, and that booleans are a subtype of integers in Python (True behaves like 1 and False like 0 in arithmetic contexts). Still, their primary use is representing logical truth values for control flow and decision- making.


NEW QUESTION # 21
What is traversal in the context of trees and graphs?

  • A. The process of changing the value of nodes
  • B. The process of removing all nodes
  • C. The process of connecting all nodes
  • D. The process of visiting all nodes

Answer: D

Explanation:
In data structures and algorithms,traversalrefers to systematicallyvisiting nodesin a tree or graph in order to process them. "Visiting" typically means performing some operation at each node, such as reading its value, marking it as seen, computing a property, or collecting it into an output structure. Traversal is foundational because many algorithms-search, path finding, connectivity checks, topological analysis, and evaluation of expressions-are built on traversal patterns.
Intrees, traversal has classic forms: preorder, inorder, and postorder depth-first traversals, as well as breadth- first traversal (level-order). Each defines a rule for the order in which nodes are visited relative to their children. Ingraphs, traversal must additionally handle the possibility of cycles and multiple paths; textbooks therefore emphasize maintaining a "visited" set to avoid infinite loops. The two principal graph traversal strategies areDepth-First Search (DFS)andBreadth-First Search (BFS). DFS explores along a path as far as possible before backtracking, while BFS explores layer by layer outward from a start node.
Options A, B, and C do not define traversal. Changing values may happen during traversal, but it is not what traversal means. Removing all nodes is deletion, not traversal. Connecting all nodes is not a standard traversal concept. The correct definition is the process of visiting all nodes (typically reachable from a starting node, or all nodes in the structure if fully connected).


NEW QUESTION # 22
What is another term for the inputs into a function?

  • A. Variables
  • B. Procedures
  • C. Arguments
  • D. Outputs

Answer: C

Explanation:
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, while argumentsare 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.


NEW QUESTION # 23
What happens if one element of a NumPy array is changed to a string?

  • A. All elements in the array are coerced to integers.
  • B. The operation is not allowed and raises an error.
  • C. All elements in the array are coerced to strings.
  • D. The array becomes a list of the original integers.

Answer: B

Explanation:
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.


NEW QUESTION # 24
What Python code would return the value 40 from np_2d, where np_2d = np.array([[1, 2, 3, 4], [10, 20, 30,
40]])?

  • A. np_2d[1, 3]
  • B. np_2d[0, 4]
  • C. np_2d[3, 1]
  • D. np_2d[4, 1]

Answer: A

Explanation:
In a 2D NumPy array, indexing is written as array[row_index, column_index] using zero-based indices. The array np_2d = np.array([[1, 2, 3, 4], [10, 20, 30, 40]]) has two rows (indices 0 and 1) and four columns (indices 0, 1, 2, 3). The value 40 is located in the second row and the fourth column. Using zero-based indexing, that corresponds to row index 1 and column index 3. Therefore, np_2d[1, 3] returns 40.
Option A attempts to access row 3, which does not exist and would raise an IndexError. Option C attempts to access column 4 in row 0, but valid column indices are only 0 through 3, so it would also error. Option D likewise refers to a non-existent row 4. Only option B uses valid indices and points to the correct location.
Textbooks emphasize multi-dimensional indexing because it underlies matrix operations, dataset manipulation, and feature extraction in data science. Correctly interpreting rows and columns is essential when rows represent observations (like people) and columns represent attributes (like age, weight, height). This question tests precise control over row/column addressing, which prevents subtle bugs in numerical analysis.


NEW QUESTION # 25
What is the correct way to convert an integer to a string in Python?

  • A. tostring(variable)
  • B. string(variable)
  • C. int_to_str(variable)
  • D. str(variable)

Answer: D

Explanation:
Python provides built-in type conversion functions that construct a value of a target type from a supplied object when possible. To convert an integer to a string, Python uses the constructor function str(). For example, str(42) produces the string "42". This operation is fundamental in programming textbooks because it enables tasks like formatting output, concatenating numbers into messages, building file names, or preparing numeric values for text-based storage and transmission.
Python distinguishes clearly between numeric types (int, float) and text type (str). You cannot concatenate an integer directly with a string (e.g., "Age: " + 30 raises a TypeError) because the types are different. Using str (30) resolves this by converting the integer into its string representation: "Age: " + str(30) becomes valid.
Modern Python commonly uses f-strings (f"Age: {30}"), which perform conversion automatically, but str() remains the canonical and explicit method.
Options A, B, and C are not standard Python built-ins for conversion. While some libraries define helper functions with similar names, the language's standard approach is str(...). Textbooks also highlight that str() is not limited to integers: it can convert many objects into readable string representations, often by invoking the object's __str__ method. This ties conversion to Python's object model and supports consistent display and logging across programs.


NEW QUESTION # 26
How does the data type of a variable get set in Python?

  • A. It is determined by the value assigned to it.
  • B. It is chosen randomly.
  • C. It is always set to string by default.
  • D. It is explicitly declared by the programmer.

Answer: A

Explanation:
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.


NEW QUESTION # 27
Which aspect is excluded from a NumPy array's structure?

  • A. The data type or dtype pointer
  • B. The shape of the array
  • C. The encryption key of the array
  • D. The data pointer

Answer: C

Explanation:
A NumPy ndarray is designed for efficient numerical computing, and its structure is defined by metadata required to interpret a contiguous (or strided) block of memory as an n-dimensional array. Textbooks and NumPy's own conceptual model describe key components such as: adata buffer(where the raw bytes live), a data pointer(reference to the start of that buffer), thedtype(which specifies how to interpret each element's bytes-e.g., int32, float64), theshape(the size in each dimension), andstrides(how many bytes to step in memory to move along each dimension). Together, these allow fast indexing, slicing, and vectorized operations without Python-level loops.
Options A, B, and C are all part of what an array must track to function correctly: the array must know where its data is, how it is laid out (shape/strides), and how to interpret bytes (dtype). In contrast, anencryption key is not a concept that belongs to the internal representation of a numerical array. Encryption is a security mechanism applied at storage or transport layers (for example, encrypting a file on disk or encrypting data sent over a network), not something built into the in-memory structure of a NumPy array object.
Therefore, the aspect excluded from a NumPy array's structure is the encryption key.


NEW QUESTION # 28
What is the purpose of user management and access control in a networked environment?

  • A. To restrict all users from accessing confidential documents
  • B. To provide unlimited access to all network resources
  • C. To ensure all users have the same level of access to resources
  • D. To establish permissions and monitor resource usage

Answer: D

Explanation:
In a networked environment, user management and access control exist to ensure that resources are used securely, appropriately, and accountably. The core idea isauthorization: defining what each user (or group of users) is allowed to do-read files, modify data, access applications, administer systems, and so on. This is commonly guided by the principle ofleast privilege, which states that users should receive only the permissions necessary to perform their tasks. Proper access control reduces the damage from mistakes and limits the impact of compromised accounts.
User management also includesauthenticationsupport (ensuring a user is who they claim to be) and administrative functions such as creating accounts, assigning roles, revoking access, and enforcing policies (password rules, multi-factor authentication requirements, session timeouts). In many systems, access control is implemented through models like discretionary access control (DAC), role-based access control (RBAC), or mandatory access control (MAC), each with different security properties.
Option B correctly reflects this: the goal is to establish permissions and to monitor or audit usage (logging access, tracking changes, detecting suspicious behavior). Option A is wrong because equal access is rarely secure or practical. Option C is the opposite of secure practice. Option D is too absolute:
systems typically restrict some users from some confidential resources, not all users from all confidential documents.


NEW QUESTION # 29
Which Python function is used to display the data type of a given variable?

  • A. Show()
  • B. Data()
  • C. type()
  • D. GetVar()

Answer: C

Explanation:
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 <class 'int'>, type(3.14) returns <class 'float'>, and type("hello") returns <class 'str'>. This is commonly used in debugging, learning exercises, and when writing functions that must behave differently depending on input types.
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().


NEW QUESTION # 30
What are Python functions that belong to specific Python objects?

  • A. Scripts
  • B. Libraries
  • C. Modules
  • D. Methods

Answer: D

Explanation:
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. A libraryis 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.


NEW QUESTION # 31
What is the expected output of numpy_array[1]?

  • A. An error message in the array
  • B. A display of the entire array
  • C. The second element of the array
  • D. The first element of the array

Answer: C

Explanation:
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.


NEW QUESTION # 32
What will the expression fam[3:6] return?

  • A. A list with elements at index 6
  • B. A list with elements at index 4, 5, and 6
  • C. A list with elements at index 3, 4, 5, and 6
  • D. A list with elements at index 3, 4, and 5

Answer: D

Explanation:
Python slicing follows the rule `sequence[start:stop]`, where the `start` index is **inclusive** and the `stop` index is **exclusive**. This convention is taught widely because it makes many algorithms and boundary cases simpler: the length of the slice is `stop - start` (when step is 1), and adjacent slices can partition a sequence without overlap. For a list named `fam`, the slice `fam[3:6]` starts at index 3 and includes the elements at indices 3, 4, and 5, but it stops before index 6.
This is a frequent source of off-by-one errors for beginners, so textbooks emphasize remembering: "start is included, stop is not." If `fam` had at least 6 elements, then `fam[3:6]` would produce a new list of exactly three elements (positions 3, 4, 5). If `fam` had fewer than 6 elements, Python would still return a valid slice up to the end without raising an error, because slicing is designed to be safe within bounds.
# Option A is incorrect because it skips index 3 and incorrectly includes index 6. Option B is incorrect because it includes index 6, which the stop boundary excludes. Option D is incorrect because slicing returns a sublist, not a single element; a single element would require indexing like `fam[6]`.


NEW QUESTION # 33
Which statement describes the data type restriction found in most NumPy arrays?

  • A. NumPy arrays can only hold integer data types.
  • B. NumPy arrays adapt to the most complex data type on the fly.
  • C. NumPy arrays are restricted to string data types only.
  • D. NumPy arrays must be of the same type of data.

Answer: D

Explanation:
Most NumPy arrays enforce a key constraint: all elements share the samedtype(data type). This uniform typing is foundational to NumPy's performance model. Because each element has the same size and representation, NumPy can store the array in a contiguous memory block and apply low-level, vectorized operations efficiently. This is why NumPy is widely used for numerical computing, statistics, and data analysis: operations like addition, multiplication, and reductions (sum/mean) can be implemented in optimized compiled code without per-element Python overhead.
Option B captures this textbook principle: elements in a typical ndarray are of the same data type. The other options are incorrect. NumPy is not restricted to strings (A), and it is not limited to integers (C); it supports floats, complex numbers, booleans, fixed-width strings, datetime types, and many others. Option D is misleading: NumPy does not continuously "adapt on the fly" during normal use. The dtype is generally fixed once the array exists. What NumPydoesdo is choose an appropriate common dtype when you create an array from mixed inputs (for example, mixing ints and floats yields floats). But after creation, assignments are cast into the existing dtype rather than dynamically changing the dtype to accommodate new values.
This restriction is precisely what differentiates NumPy arrays from Python lists and enables predictable memory layout and fast numerical computation.


NEW QUESTION # 34
How can a user subset a NumPy array bmi to only include values over 23?

  • A. bmi.where(bmi > 23)
  • B. bmi.get_values(>23)
  • C. bmi[bmi > 23]
  • D. bmi.select(23)

Answer: C

Explanation:
NumPy supports a powerful technique calledBoolean indexing(also called Boolean masking) to filter arrays based on a condition. When you write bmi > 23, NumPy performs an element-wise comparison and produces a Boolean array of the same shape, containing True where the condition holds and False otherwise. Using that Boolean array inside square brackets, as in bmi[bmi > 23], tells NumPy to return a new 1D array containing only the elements whose mask value is True. This approach is heavily emphasized in scientific computing curricula because it expresses selection logic without explicit loops and runs efficiently in optimized compiled code.
Option B looks close but is not standard NumPy usage. The function commonly used is np.where(condition) or np.where(condition, x, y). While np.where(bmi > 23) can return indices, bmi.where(...) is not a NumPy array method; it is more associated with pandas objects. Options A and C are not valid NumPy APIs for filtering.
Boolean indexing is central in data analysis tasks such as removing invalid measurements, selecting a population subgroup, applying thresholds, and building feature subsets. It composes cleanly with vectorized computation, for example bmi[bmi > 23].mean(), enabling concise and high-performance numerical workflows.


NEW QUESTION # 35
How is a NumPy array named data with 6 elements reshaped into a 2x3 array?

  • A. data.set_shape(2, 3)
  • B. np.reshape(data, (2, 3))
  • C. data_reshape[2, 3]
  • D. np_reshape(list, (2, 3))

Answer: B

Explanation:
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.


NEW QUESTION # 36
What is the component of the operating system that manages core system resources but allows no user access?

  • A. Device driver manager
  • B. The kernel
  • C. User interface layer
  • D. The File Explorer

Answer: B

Explanation:
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.


NEW QUESTION # 37
......

Get Instant Access to Foundations-of-Computer-Science Practice Exam Questions: https://www.prepawaytest.com/WGU/Foundations-of-Computer-Science-practice-exam-dumps.html

Reliable Study Materials & Testing Engine for Foundations-of-Computer-Science Exam Success!: https://drive.google.com/open?id=1D0Kp_pcMv4zytEeeEcPHT9kjEZtc3kjj

Contact Us

If you have any question please leave me your email address, we will reply and send email to you in 12 hours.

Our Working Time: ( GMT 0:00-15:00 )
From Monday to Saturday

Support: Contact now