D.A set of instructions that tells a computer what to do
Correct Answer: A set of instructions that tells a computer what to do
Explanation:
A computer program is a sequence of instructions written to perform a specific task on a computer.
Incorrect! Try again.
2A program written by a programmer in a human-readable language is called the:
What is computer Program
Easy
A.Machine code
B.Object file
C.Source code
D.Binary dump
Correct Answer: Source code
Explanation:
Source code is the version of a program written in a programming language that humans can read and edit.
Incorrect! Try again.
3Which of the following is an example of application software?
What is computer Program
Easy
A.A CPU
B.A hard disk
C.A power supply
D.A word processor
Correct Answer: A word processor
Explanation:
A word processor is application software, while the other options are hardware components.
Incorrect! Try again.
4The language that a computer's processor can directly understand is called:
What is computer Program
Easy
A.Machine language
B.Flowchart language
C.Pseudocode
D.English
Correct Answer: Machine language
Explanation:
Machine language is made of binary (0s and 1s) and is the only language the CPU directly executes.
Incorrect! Try again.
5A collection of programs and related data that runs on a computer is generally called:
What is computer Program
Easy
A.Hardware
B.A monitor
C.Firmware chip
D.Software
Correct Answer: Software
Explanation:
Software refers to the programs and data that instruct the hardware, as opposed to the physical components.
Incorrect! Try again.
6Which type of software acts as a bridge between the hardware and application programs?
Hardware/Software Interaction
Easy
A.Media player
B.Web browser
C.Spreadsheet
D.Operating system
Correct Answer: Operating system
Explanation:
The operating system manages hardware resources and allows application software to run on them.
Incorrect! Try again.
7Which statement about hardware and software is correct?
Hardware/Software Interaction
Easy
A.Software is a physical component
B.Hardware is a set of instructions
C.Software needs hardware to run
D.Hardware runs without any software
Correct Answer: Software needs hardware to run
Explanation:
Software is a set of instructions that requires physical hardware to execute its operations.
Incorrect! Try again.
8A small program that lets the operating system communicate with a specific hardware device is called a:
Hardware/Software Interaction
Easy
A.Text editor
B.Device driver
C.Spreadsheet
D.Compiler
Correct Answer: Device driver
Explanation:
A device driver translates operating system commands into instructions a hardware device understands.
Incorrect! Try again.
9When you press a key on the keyboard, which component processes the resulting instruction?
Hardware/Software Interaction
Easy
A.The speaker
B.The printer
C.The CPU
D.The monitor
Correct Answer: The CPU
Explanation:
The CPU (Central Processing Unit) processes instructions, including input received from the keyboard.
Incorrect! Try again.
10Where must a program be loaded before the CPU can execute it?
Hardware/Software Interaction
Easy
A.Main memory (RAM)
B.The keyboard
C.The printer
D.The mouse
Correct Answer: Main memory (RAM)
Explanation:
Programs are loaded into RAM so the CPU can quickly fetch and execute their instructions.
Incorrect! Try again.
11A diagram that uses symbols to show the steps of a program is called a:
Planning a Computer Program
Easy
A.Web page
B.Database
C.Spreadsheet
D.Flowchart
Correct Answer: Flowchart
Explanation:
A flowchart uses standard symbols and arrows to represent the sequence of steps in a program.
Incorrect! Try again.
12Writing program logic in plain English-like statements before coding is known as:
Planning a Computer Program
Easy
A.Pseudocode
B.Compiling
C.Machine code
D.Debugging
Correct Answer: Pseudocode
Explanation:
Pseudocode expresses program logic in readable, informal terms without strict programming syntax.
Incorrect! Try again.
13In a standard flowchart, which shape usually represents a decision?
Planning a Computer Program
Easy
A.Rectangle
B.Circle
C.Triangle
D.Diamond
Correct Answer: Diamond
Explanation:
A diamond shape represents a decision point where the flow branches based on a condition.
Incorrect! Try again.
14What is usually the first step when planning a computer program?
Planning a Computer Program
Easy
A.Deleting the source code
B.Writing the final code
C.Selling the software
D.Understanding and defining the problem
Correct Answer: Understanding and defining the problem
Explanation:
You must clearly understand the problem before designing or coding a solution.
Incorrect! Try again.
15An algorithm can best be described as:
Planning a Computer Program
Easy
A.A physical part of a computer
B.A brand of software
C.A step-by-step procedure to solve a problem
D.A type of monitor
Correct Answer: A step-by-step procedure to solve a problem
Explanation:
An algorithm is a finite set of ordered steps used to solve a problem or complete a task.
Incorrect! Try again.
16In a flowchart, which symbol is generally used to represent a process or action step?
Planning a Computer Program
Easy
A.Diamond
B.Oval
C.Rectangle
D.Arrow
Correct Answer: Rectangle
Explanation:
A rectangle represents a processing step or action in a standard flowchart.
Incorrect! Try again.
17The process of finding and fixing errors in a program is called:
How programs Solve Problems
Easy
A.Debugging
B.Planning
C.Printing
D.Compiling
Correct Answer: Debugging
Explanation:
Debugging is the activity of locating and correcting errors, or bugs, in a program.
Incorrect! Try again.
18A general model of how a program solves a problem follows the order:
How programs Solve Problems
Easy
A.Input, process, output
B.Input, output, process
C.Process, input, output
D.Output, process, input
Correct Answer: Input, process, output
Explanation:
Programs typically take input, process it according to instructions, and then produce output.
Incorrect! Try again.
19An error in the rules or grammar of a programming language is called a:
How programs Solve Problems
Easy
A.Syntax error
B.Hardware error
C.Power error
D.Network error
Correct Answer: Syntax error
Explanation:
A syntax error occurs when code breaks the grammatical rules of the programming language.
Incorrect! Try again.
20To solve a large, complex problem with a program, it is best to:
How programs Solve Problems
Easy
A.Break it into smaller subproblems
B.Remove all input steps
C.Write random code
D.Ignore the problem
Correct Answer: Break it into smaller subproblems
Explanation:
Dividing a big problem into smaller, manageable parts makes it easier to design and solve.
Incorrect! Try again.
21A student writes a set of instructions in Python that reads two numbers and prints their sum. Before the CPU can execute these instructions, what must happen?
What is computer Program
Medium
A.The instructions must be sent to the monitor first
B.The instructions must be translated into machine code
C.The instructions must be stored on a printer
D.The instructions must be converted into a spreadsheet
Correct Answer: The instructions must be translated into machine code
Explanation:
A program written in a high-level language is source code. The CPU only understands machine code, so a compiler or interpreter must translate it before execution.
Incorrect! Try again.
22Which statement best distinguishes a program from an algorithm?
What is computer Program
Medium
A.An algorithm needs a compiler, while a program never does
B.An algorithm runs on hardware, while a program runs only on paper
C.An algorithm is a step-by-step method, while a program is that method written in a programming language
D.An algorithm is machine code, while a program is always in English
Correct Answer: An algorithm is a step-by-step method, while a program is that method written in a programming language
Explanation:
An algorithm is a logical, language-independent solution. A program is the concrete implementation of that algorithm in a specific programming language.
Incorrect! Try again.
23A program is described as a sequence of instructions that is stored and then executed. This idea is central to which computer concept?
What is computer Program
Medium
A.The open-source concept
B.The client-server concept
C.The plug-and-play concept
D.The stored-program concept
Correct Answer: The stored-program concept
Explanation:
The stored-program concept means instructions are held in memory alongside data and fetched for execution, which is the basis of modern computers.
Incorrect! Try again.
24Which of the following is the clearest example of system software rather than an application program?
What is computer Program
Medium
A.A photo editor used to crop images
B.An operating system that manages memory and devices
C.A game played for entertainment
D.A word processor used to type letters
Correct Answer: An operating system that manages memory and devices
Explanation:
System software, such as an operating system, manages hardware and provides a platform. The other options are application programs that serve end-user tasks.
Incorrect! Try again.
25A file with the .exe extension runs directly when double-clicked, while a .py file needs Python installed. What does this difference tell you?
What is computer Program
Medium
A.The .exe is source code, while the .py is machine code
B.The .exe already contains machine code, while the .py needs an interpreter
C.The .exe is written in English, while the .py is not
D.The .py is faster because it is already compiled
Correct Answer: The .exe already contains machine code, while the .py needs an interpreter
Explanation:
An executable file holds machine code the CPU can run directly, while a .py script is source code that requires the Python interpreter to translate and run it.
Incorrect! Try again.
26When you press a key on the keyboard, which layer is most directly responsible for translating that hardware signal so applications can use it?
Hardware/Software Interaction
Medium
A.The application software alone
B.The monitor's display controller
C.The power supply unit
D.The operating system through its device drivers
Correct Answer: The operating system through its device drivers
Explanation:
Device drivers, managed by the operating system, translate hardware signals into a form that software can understand, bridging hardware and applications.
Incorrect! Try again.
27An application wants to save a file to disk but cannot access the hardware directly. How does it accomplish this?
Hardware/Software Interaction
Medium
A.It converts itself into a device driver
B.It rewrites the disk's firmware itself
C.It bypasses the OS and controls the disk motor
D.It requests the service from the operating system
Correct Answer: It requests the service from the operating system
Explanation:
Applications ask the operating system to perform hardware operations through system calls. The OS then coordinates with drivers and hardware, keeping access safe and managed.
Incorrect! Try again.
28Which sequence correctly represents the layers of interaction from top to bottom?
Hardware/Software Interaction
Medium
A.Operating System → Hardware → Application
B.Application → Operating System → Hardware
C.Application → Hardware → Operating System
D.Hardware → Application → Operating System
Correct Answer: Application → Operating System → Hardware
Explanation:
The user interacts with applications, which call the operating system, which in turn controls the hardware. This layered model keeps each level manageable.
Incorrect! Try again.
29A new printer is connected but does not work until specific software is installed. What is this software called and what does it do?
Hardware/Software Interaction
Medium
A.An antivirus that scans the printer for errors
B.A compiler that turns print jobs into source code
C.A spreadsheet that stores the printer's settings
D.A device driver that lets the OS communicate with the printer
Correct Answer: A device driver that lets the OS communicate with the printer
Explanation:
A device driver provides the OS with instructions on how to control a specific hardware device, enabling proper communication between software and the printer.
Incorrect! Try again.
30During program execution, where are the active instructions and data primarily held for the CPU to access quickly?
Hardware/Software Interaction
Medium
A.In RAM (main memory)
B.Inside the monitor buffer
C.In the keyboard controller
D.On the hard disk permanently
Correct Answer: In RAM (main memory)
Explanation:
When a program runs, its instructions and data are loaded into RAM so the CPU can fetch and execute them quickly, since disk access is much slower.
Incorrect! Try again.
31Why is software necessary for hardware to be useful?
Hardware/Software Interaction
Medium
A.Software physically powers the hardware components
B.Hardware performs no meaningful task without instructions from software
C.Hardware can only work if it is connected to the internet
D.Hardware stores software so it does not need electricity
Correct Answer: Hardware performs no meaningful task without instructions from software
Explanation:
Hardware is the physical machinery, but it needs software instructions to know what to do. Together they form a working computer system.
Incorrect! Try again.
32A developer draws boxes and arrows to map the flow of decisions and steps before coding. Which planning tool is being used?
Planning a Computer Program
Medium
A.A firewall rule
B.A spreadsheet macro
C.A flowchart
D.A database schema
Correct Answer: A flowchart
Explanation:
A flowchart uses standardized symbols and arrows to represent the logic and flow of a program, helping plan the solution before writing code.
Incorrect! Try again.
33In a flowchart, which symbol is used to represent a decision that has multiple possible outcomes?
Planning a Computer Program
Medium
A.An oval
B.A rectangle
C.A parallelogram
D.A diamond
Correct Answer: A diamond
Explanation:
The diamond symbol represents a decision point where a condition is tested, leading to different paths such as yes/no or true/false.
Incorrect! Try again.
34Why do programmers often write pseudocode before writing actual code?
Planning a Computer Program
Medium
A.It automatically compiles into machine code
B.It runs faster than the final program
C.It replaces the need for testing the program
D.It expresses program logic in plain language without worrying about syntax
Correct Answer: It expresses program logic in plain language without worrying about syntax
Explanation:
Pseudocode lets programmers focus on the logic of the solution using readable statements, free from the strict syntax rules of any language.
Incorrect! Try again.
35What is the correct general order of steps in the program development process?
Planning a Computer Program
Medium
A.Test → code → design → define the problem
B.Design → test → define the problem → code
C.Define the problem → design the solution → code → test
D.Code → define the problem → test → design
Correct Answer: Define the problem → design the solution → code → test
Explanation:
Good program development starts by understanding the problem, designing a solution, implementing it as code, and finally testing to verify correctness.
Incorrect! Try again.
36A team breaks a large program into smaller, manageable pieces that each handle one task. What planning approach is this?
Planning a Computer Program
Medium
A.Random coding
B.Hardware layering
C.Modular design (decomposition)
D.Direct compilation
Correct Answer: Modular design (decomposition)
Explanation:
Decomposition, or modular design, splits a big problem into smaller modules that are easier to develop, test, and maintain independently.
Incorrect! Try again.
37In a flowchart, what is the purpose of the oval (terminator) symbol?
Planning a Computer Program
Medium
A.To store data on disk
B.To make a decision
C.To perform a calculation
D.To mark the start or end of the process
Correct Answer: To mark the start or end of the process
Explanation:
The oval terminator symbol shows where a flowchart begins and where it ends, defining the boundaries of the process.
Incorrect! Try again.
38A program repeatedly executes a block of code until a condition becomes false. Which control structure does this describe?
How programs Solve Problems
Medium
A.A loop (iteration)
B.A sequence
C.A single assignment
D.A constant declaration
Correct Answer: A loop (iteration)
Explanation:
A loop repeats a set of instructions while a condition holds, allowing programs to handle repetitive tasks efficiently.
Incorrect! Try again.
39A program must choose between two different actions based on whether a user's age is . Which control structure is required?
How programs Solve Problems
Medium
A.Sequence
B.Iteration
C.Declaration
D.Selection (if-else)
Correct Answer: Selection (if-else)
Explanation:
Selection structures like if-else let a program choose different paths based on whether a condition is true or false.
Incorrect! Try again.
40Programs solve problems by processing input into output. In the model , what does the process stage represent?
How programs Solve Problems
Medium
A.The logic and calculations applied to the data
B.The device used to display results
C.The raw data entered by the user
D.The physical storage of the program
Correct Answer: The logic and calculations applied to the data
Explanation:
The process stage is where the program applies logic, calculations, and transformations to convert input data into useful output.
Incorrect! Try again.
41A program is described as a set of instructions that is stored and then executed. In the stored-program (von Neumann) model, which characteristic most directly distinguishes a program from fixed-function hardware logic?
What is computer Program
Hard
A.Instructions are permanently etched into silicon and cannot be altered
B.Instructions are limited to arithmetic and cannot perform branching
C.Instructions reside in the same addressable memory as data and can be modified at runtime
D.Instructions execute only when triggered by an external mechanical switch
Correct Answer: Instructions reside in the same addressable memory as data and can be modified at runtime
Explanation:
The stored-program concept treats instructions like data in the same memory space, so programs can be loaded, changed, and even generated at runtime. Fixed-function hardware encodes logic physically and cannot be reprogrammed this way.
Incorrect! Try again.
42Consider source code, object code, and an executable. Which statement correctly orders their dependence and portability characteristics?
What is computer Program
Hard
A.Object code is most portable; source code must be linked before editing; the executable is human-readable
B.Source code is most portable; object code is machine-specific but unlinked; the executable is machine-specific and runnable
C.All three are equally portable because they represent the same instructions
D.The executable is most portable across CPUs; source code is CPU-specific; object code is human-readable
Correct Answer: Source code is most portable; object code is machine-specific but unlinked; the executable is machine-specific and runnable
Explanation:
Source code is high-level and portable across platforms via recompilation. Object code is machine-level output of compilation but not yet linked. The linked executable is machine-specific and directly runnable.
Incorrect! Try again.
43A programmer claims that an interpreted program and a compiled program are "the same program". From a purely definitional standpoint, what is the most accurate response?
What is computer Program
Hard
A.They are different programs because only compiled code counts as instructions
B.They are different programs because interpreted code is not a real program
C.They are identical in execution speed because the logic is the same
D.They are the same logical program; only the translation-and-execution strategy differs
Correct Answer: They are the same logical program; only the translation-and-execution strategy differs
Explanation:
A program is defined by its logic and instructions, independent of how it is translated. Interpretation and compilation are different execution strategies, not different programs. Execution speed usually differs, so that claim is false.
Incorrect! Try again.
44Why is a program written entirely in machine code considered a valid program but rarely written directly by humans today?
What is computer Program
Hard
A.It runs slower than high-level code, discouraging its use
B.It is not executable without an interpreter and therefore avoided
C.It cannot represent loops or conditions, limiting its use
D.It is directly executable but error-prone and unmaintainable due to raw binary encoding
Correct Answer: It is directly executable but error-prone and unmaintainable due to raw binary encoding
Explanation:
Machine code is the CPU's native, directly executable form, so it is a valid program. Humans avoid it because writing binary opcodes by hand is extremely error-prone and hard to maintain, not because it lacks capability or speed.
Incorrect! Try again.
45When an application requests to write a file to disk, the request typically passes through multiple layers. Which sequence best reflects the interaction from top to bottom?
Hardware/Software Interaction
Hard
A.Application → OS system call → device driver → hardware controller
B.Application → device driver → OS system call → hardware controller
C.Application → hardware controller → OS system call → device driver
Correct Answer: Application → OS system call → device driver → hardware controller
Explanation:
The application issues a system call to the OS, which routes it to the appropriate device driver, which in turn communicates with the physical hardware controller. This layering isolates applications from hardware specifics.
Incorrect! Try again.
46A CPU can only execute machine instructions. Given a high-level program, which combination of components is minimally required to make it run on the hardware?
Hardware/Software Interaction
Hard
A.Only firmware, which interprets high-level code natively
B.Only a compiler, since the OS is optional for any program
C.A translator (compiler/interpreter) plus an OS to load and manage execution
D.Only an OS, since it can execute high-level code directly
Correct Answer: A translator (compiler/interpreter) plus an OS to load and manage execution
Explanation:
High-level code must be translated to machine instructions the CPU understands, and an operating system is normally needed to load the program and manage its access to hardware and memory. The CPU and OS alone cannot run untranslated high-level code.
Incorrect! Try again.
47During an interrupt-driven I/O operation, why is polling generally considered less efficient than interrupts for hardware/software interaction?
Hardware/Software Interaction
Hard
A.Polling wastes CPU cycles repeatedly checking device status, while interrupts notify only when ready
B.Polling cannot detect device status, so data is lost
C.Interrupts are slower because they bypass the device driver
D.Interrupts require the CPU to check devices continuously, unlike polling
Correct Answer: Polling wastes CPU cycles repeatedly checking device status, while interrupts notify only when ready
Explanation:
Polling loops keep the CPU busy checking whether a device is ready, wasting cycles. Interrupts let the device signal the CPU only when attention is needed, freeing the CPU for other work in the meantime.
Incorrect! Try again.
48System software and application software both interact with hardware. Which statement most accurately contrasts their access?
Hardware/Software Interaction
Hard
A.System software often runs in privileged mode with direct hardware access; applications run in user mode and request services
B.Application software runs in privileged mode; system software is restricted to user mode
C.Both run in privileged mode with identical direct hardware access
D.Neither can access hardware; only firmware can
Correct Answer: System software often runs in privileged mode with direct hardware access; applications run in user mode and request services
Explanation:
The OS (system software) runs in a privileged/kernel mode with direct hardware control. Applications run in a restricted user mode and must request hardware services through the OS, which protects the system from misbehaving programs.
Incorrect! Try again.
49A program compiled for one CPU architecture fails to run on another even though both use the same operating system family. What is the primary reason?
Hardware/Software Interaction
Hard
A.The machine instruction set differs, so the compiled binary is not understood by the other CPU
B.Source code cannot be compiled twice for different machines
C.High-level languages are architecture-specific and cannot be reused
D.The operating system refuses to load any external files
Correct Answer: The machine instruction set differs, so the compiled binary is not understood by the other CPU
Explanation:
A compiled binary targets a specific instruction set architecture (ISA). A different CPU with a different ISA cannot decode those instructions. Recompiling the same source for the new architecture is the usual solution.
Incorrect! Try again.
50In the program development cycle, why must problem analysis and requirement specification precede algorithm design?
Planning a Computer Program
Hard
A.Requirements can only be understood after the program is tested
B.A correct algorithm cannot be designed without a clear, unambiguous definition of the problem and expected outputs
C.Algorithm design produces the requirements automatically once coding begins
D.Analysis is optional because coding reveals the true problem
Correct Answer: A correct algorithm cannot be designed without a clear, unambiguous definition of the problem and expected outputs
Explanation:
You cannot design a solution to a problem you have not clearly defined. Establishing inputs, outputs, and constraints first ensures the algorithm actually solves the intended problem rather than a misunderstood one.
Incorrect! Try again.
51A flowchart and pseudocode both express algorithm logic before coding. Which statement best captures a meaningful trade-off between them?
Planning a Computer Program
Hard
A.Flowcharts visualize control flow well but scale poorly; pseudocode scales to complex logic but hides visual flow
B.Flowcharts are executable while pseudocode must be compiled
C.Pseudocode is language-specific while flowcharts are language-independent
D.Pseudocode can only represent loops, while flowcharts represent everything else
Correct Answer: Flowcharts visualize control flow well but scale poorly; pseudocode scales to complex logic but hides visual flow
Explanation:
Flowcharts make branching and flow visually clear but become cluttered for large programs. Pseudocode handles complex logic compactly using structured text but does not visually depict flow. Neither is executable, and both are language-independent.
Incorrect! Try again.
52During planning, a developer identifies that a required calculation depends on a value not available until runtime. What planning technique best addresses this before coding?
Planning a Computer Program
Hard
A.Define it as an input variable and specify how it will be obtained and validated
B.Skip the calculation until the program is running
C.Remove the calculation because runtime values cannot be planned
D.Hard-code an assumed constant to simplify the algorithm
Correct Answer: Define it as an input variable and specify how it will be obtained and validated
Explanation:
Good planning treats runtime-dependent values as inputs, specifying their source and validation. Hard-coding assumptions or deferring the design leads to fragile programs. Recognizing inputs early is central to the analysis phase.
Incorrect! Try again.
53Why does modular (top-down) program design improve maintainability compared to a single monolithic block of code?
Planning a Computer Program
Hard
A.It eliminates the need for algorithms entirely
B.It guarantees the program runs faster on all hardware
C.It removes the need for testing since modules are independent
D.Each module isolates a subproblem, so changes and testing can be localized without affecting others
Correct Answer: Each module isolates a subproblem, so changes and testing can be localized without affecting others
Explanation:
Top-down decomposition splits a problem into independent modules. This localizes changes, simplifies testing, and improves reuse. It does not remove the need for algorithms or testing, and it does not guarantee speed.
Incorrect! Try again.
54A team writes detailed pseudocode but skips documenting assumptions and edge cases. What is the most likely downstream consequence?
Planning a Computer Program
Hard
A.The program will not compile at all
B.The pseudocode becomes executable without translation
C.Testing becomes unnecessary because logic is complete
D.Coders make inconsistent assumptions, producing defects that surface only for boundary inputs
Correct Answer: Coders make inconsistent assumptions, producing defects that surface only for boundary inputs
Explanation:
Undocumented assumptions and edge cases lead different implementers to fill gaps differently, causing bugs that appear at boundaries (empty input, maximums, zero, etc.). Pseudocode alone does not compile and does not eliminate testing.
Incorrect! Try again.
55An algorithm to find the maximum in a list initializes max to the first element rather than to . Why is this the more robust choice?
How programs Solve Problems
Hard
A.Initializing to the first element handles negative values and empty-guarded lists correctly
B.Initializing to the first element avoids the need for a loop
C.Initializing to is faster on all hardware
D.Initializing to works for any list of any values
Correct Answer: Initializing to the first element handles negative values and empty-guarded lists correctly
Explanation:
If all values are negative, starting max at wrongly returns . Starting from the first actual element (after confirming the list is non-empty) guarantees a valid comparison base regardless of value ranges.
Incorrect! Try again.
56Two algorithms solve the same problem: Algorithm A runs in and Algorithm B in . For a small input of , A completes faster. What is the correct interpretation?
How programs Solve Problems
Hard
A.Complexity analysis is invalid for values below
B.Big-O is wrong because B should always be faster
C.Asymptotic complexity describes scaling for large ; for small constant factors can make A faster
D.A is permanently the better algorithm for all inputs
Correct Answer: Asymptotic complexity describes scaling for large ; for small constant factors can make A faster
Explanation:
Big-O describes growth as becomes large and ignores constant factors. For small inputs, a lower-complexity algorithm may lose to a higher-complexity one with smaller constants. B wins as grows large.
Incorrect! Try again.
57A problem-solving process follows: understand the problem, devise a plan, carry out the plan, then review. Which activity best represents the "review" step in program development?
How programs Solve Problems
Hard
A.Defining the inputs and outputs of the problem
B.Testing outputs against expected results and refining the algorithm for missed cases
C.Choosing a programming language for the solution
D.Writing the first line of source code
Correct Answer: Testing outputs against expected results and refining the algorithm for missed cases
Explanation:
The review step validates the solution by comparing actual results to expected ones and improving it where it fails. Defining inputs is part of understanding; choosing a language and writing code belong to earlier steps.
Incorrect! Try again.
58A recursive solution and an iterative solution both compute the same result. On a system with a small call stack, the recursive version crashes for large inputs while the iterative one succeeds. What is the root cause?
How programs Solve Problems
Hard
A.Iteration uses more memory but avoids computation errors
B.Deep recursion consumes stack frames until the stack overflows, unlike the iterative loop
C.Recursion produces incorrect logic for large numbers
Correct Answer: Deep recursion consumes stack frames until the stack overflows, unlike the iterative loop
Explanation:
Each recursive call adds a stack frame. For large inputs without tail-call optimization, the stack can overflow. An iterative loop reuses a fixed set of variables, avoiding unbounded stack growth.
Incorrect! Try again.
59An algorithm uses a loop with condition while (x != 0) and decrements x by 2 each iteration. Starting from an odd positive x, what problem arises and why?
How programs Solve Problems
Hard
A.The loop terminates correctly for all starting values
B.An infinite loop occurs because x never equals exactly when starting odd and stepping by
C.The loop runs exactly once regardless of x
D.The loop never executes because the condition is false initially
Correct Answer: An infinite loop occurs because x never equals exactly when starting odd and stepping by
Explanation:
Subtracting from an odd number keeps it odd, so x skips over (e.g., ) and the exact equality check with never holds. Using x > 0 or checking parity would fix it.
Incorrect! Try again.
60When decomposing a complex problem into subproblems, why is it important that subproblem solutions can be combined without unintended interaction?
How programs Solve Problems
Hard
A.Subproblems must share global variables to communicate correctly
B.Independent, composable subproblems prevent one module's side effects from corrupting another's result
C.Combining subproblems automatically improves time complexity to
D.Decomposition removes the need to verify the combined result
Correct Answer: Independent, composable subproblems prevent one module's side effects from corrupting another's result
Explanation:
Effective decomposition relies on subproblems being independent so their results combine cleanly. Uncontrolled side effects or shared mutable state can make one module corrupt another's output, breaking the overall solution.
Incorrect! Try again.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill.
The rest comes out of a student's own pocket: the domain, the storage,
and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it.
What it pays for →