Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 4 fuera de 74 páginas
Examen

CMPT 145 Exam Prep 2026 | 200 Questions & Answers with Explanations | Latest Update

Document preview thumbnail
Vista previa 4 fuera de 74 páginas

CMPT 145 Exam Prep 2026 | 200 Questions & Answers with Explanations | Latest Update

Vista previa del contenido

CMPT 145 ALL TESTED QUESTIONS WITH ANSWERS GRADED
A+ / 2025/2026

1. When is software considered correct?

> A) It runs without crashing

> B) It does everything that it is intended to do and nothing that it is not intended to do

> C) It produces output within a given time limit

> D) It passes a random set of test cases



Correct Answer: B

Explanation: A program is correct if it meets its specification precisely. It must implement all required
functions and avoid any unintended side effects or behaviours. Just running without errors is not
sufficient for correctness; correctness requires performing the intended task exactly as specified without
errors or omissions.



2. Which of the following best describes software efficiency?

> A) The program’s ability to handle unexpected inputs

> B) The relative measure of the degree to which software consumes computational resources, including
time and memory

> C) The frequency of software updates

> D) The number of features in the software



Correct Answer: B

Explanation: Software efficiency is about resource usage. An efficient program accomplishes its task
while using as little CPU time and memory as possible. It is a quantitative measure: we can compare two
programs on the same hardware to determine which uses fewer resources for the same input.



3. Which statement about Abstract Data Types (ADTs) is false?

> A) An ADT permits programmers to use a data structure without knowing its internal implementation.

> B) Understanding the internal implementation of an ADT is not necessary to use it correctly.

,> C) An ADT is defined by its interface and operations, not its implementation details.

> D) An ADT is defined by an implementation, not an interface.



Correct Answer: D

Explanation: ADTs are defined by their public interface (the set of operations you can perform), not by
the internal implementation. Hiding the implementation details is the entire point of abstraction; it
allows programmers to change the underlying code without breaking the programs that use the ADT.



4. True or False: It is necessary to understand the internal implementation of an ADT to correctly use it.

> A) True

> B) False



Correct Answer: B

Explanation: The whole purpose of an ADT is to hide the implementation details behind a well-defined
interface. As long as you know what the operations do, you can use the ADT correctly without knowing
how it works inside. In fact, the implementation could change entirely (e.g., from an array to a linked
list), and your code using the ADT would still work as long as the interface remains the same.



5. True or False: Software reusability is a quantitative (measurable) software goal.

> A) True

> B) False



Correct Answer: B

Explanation: Reusability is a qualitative quality goal, not a quantitative one. It is difficult to assign a
precise number to measure “how reusable” a piece of code is. While there are metrics like the number
of times code is reused, these are indirect and do not directly measure reusability as a property of the
code itself.



6. True or False: Software efficiency measures the relative consumption of computational resources,
such as time and memory.

> A) True

> B) False

,Correct Answer: A

Explanation: Efficiency is precisely about how well software uses computational resources. It is often
measured in terms of time complexity (how many steps are executed) and space complexity (how much
memory is used). Efficiency can be expressed as a function of the input size, allowing comparisons
between different algorithms.



7. True or False: In the context of describing a function’s interface, the Purpose is a brief statement in
plain language about what the function is intended to do.

> A) True

> B) False



Correct Answer: A

Explanation: Documenting the Purpose is the first step in specifying a function’s interface. It should be a
clear, concise description in plain English of the function’s intended behaviour, such as “returns the sum
of all elements in the list.” It does not need to describe how the function achieves its purpose, only what
it accomplishes.



8. What happens every time you evaluate an expression in Python?

> A) A variable is created

> B) An object is created

> C) A frame is created

> D) A reference is updated



Correct Answer: B

Explanation: When Python evaluates an expression (like `2 + 3` or `“hello“.upper()`), it creates a new
object in memory to hold the resulting value. That object then has a specific type and a location in the
heap. For example, evaluating `5` creates an integer object with the value `5`. The static integer `5` is not
copied; a new object is created every time a literal is evaluated.



9. Which of the following correctly describes a Pure function?

> A) A function that never uses loops

, > B) A function that modifies global variables

> C) A function with no effect other than returning a value

> D) A function that always returns None



Correct Answer: C

Explanation: A pure function’s output depends only on its input arguments, and it has no side effects (no
printing, no modifying global variables, no file I/O). It returns a value based solely on its inputs. Pure
functions are easier to test and reason about because they behave like mathematical functions.



10. What does the arrow represent on a Frame diagram?

> A) The value of a variable

> B) The type of an object

> C) An address or reference to an object in memory

> D) The priority of execution



Correct Answer: C

Explanation: In frame diagrams used to visualize Python’s memory model, arrows represent references.
A variable “points to” its object, meaning that the variable stores the address (memory location) where
that object resides. Frequently when you write `a = b`, you are not copying the object—you are copying
the reference, so both variables point to the same object.



11. Do assignment statements in Python copy objects?

> A) Yes, they always create a copy of the object

> B) Yes, but only for mutable objects

> C) No, references get copied but objects do not

> D) No, they only copy the frame



Correct Answer: C

Explanation: In Python, assignment copies the reference, not the object itself. For immutable objects like
integers and strings, this is usually fine because they are treated as values. But for mutable objects like
lists, assigning one variable to another creates a second reference to the same list, not a separate copy.
If you modify the list through one reference, the change is visible through the other.

Información del documento

Subido en
30 de abril de 2026
Número de páginas
74
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$38.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
francisndungu1
5.0
(1)
Vendido
7
Seguidores
0
Artículos
589
Última venta
3 días hace


Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes