Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
Question 1 of 60 · introduction to programming · Easy
What is a computer program?
Not quite. Try another option.
Answer: A set of instructions written to perform a specific task
A program is a collection of instructions that a computer follows to accomplish a specific task.
Question 2 of 60 · introduction to programming · Easy
The process of writing a set of instructions for a computer is called:
Not quite. Try another option.
Answer: Programming
Programming is the activity of writing instructions (code) that direct a computer to perform tasks.
Question 3 of 60 · program concept · Easy
A person who writes computer programs is called a:
Not quite. Try another option.
Answer: Programmer
A programmer is the individual who designs, writes, and tests computer programs.
Question 4 of 60 · program concept · Easy
Which of the following best describes source code?
Not quite. Try another option.
Answer: The human-readable instructions written by a programmer in a programming language
Source code is the set of human-readable statements written in a programming language before translation into machine code.
Question 5 of 60 · characteristics of programming · Easy
Which of the following is a desirable characteristic of a good program?
Not quite. Try another option.
Answer: Reliability
A good program should be reliable, meaning it produces correct results consistently.
Question 6 of 60 · characteristics of programming · Easy
A program that is easy to read, understand, and modify is said to have good:
Not quite. Try another option.
Answer: Maintainability
Maintainability refers to how easily a program can be understood, corrected, and updated over time.
Question 7 of 60 · characteristics of programming · Easy
The ability of a program to run on different types of machines with little or no change is called:
Not quite. Try another option.
Answer: Portability
Portability is the characteristic that allows a program to be moved and run across different platforms.
Question 8 of 60 · stages in program development · Easy
Which stage usually comes first in program development?
Not quite. Try another option.
Answer: Problem definition and analysis
Understanding and defining the problem is the first step before designing or coding a solution.
Question 9 of 60 · stages in program development · Easy
The process of finding and correcting errors in a program is known as:
Not quite. Try another option.
Answer: Debugging
Debugging is the stage where errors (bugs) in the program are located and fixed.
Question 10 of 60 · algorithms · Easy
What is an algorithm?
Not quite. Try another option.
Answer: A step-by-step procedure to solve a problem
An algorithm is a finite sequence of well-defined steps used to solve a particular problem.
Question 11 of 60 · algorithms · Easy
Which property must every algorithm have?
Not quite. Try another option.
Answer: It must terminate after a finite number of steps
An algorithm must be finite, meaning it ends after a limited number of steps.
Question 12 of 60 · algorithms · Easy
Each step of an algorithm should be:
Not quite. Try another option.
Answer: Clear and unambiguous
Every step in an algorithm must be precise and unambiguous so it can be followed without confusion.
Question 13 of 60 · notations · Easy
Pseudocode is best described as:
Not quite. Try another option.
Answer: An informal, language-like way of describing an algorithm
Pseudocode expresses the logic of an algorithm in plain, structured language without strict programming syntax.
Question 14 of 60 · notations · Easy
Which notation uses plain English-like statements rather than a specific programming language syntax?
Not quite. Try another option.
Answer: Pseudocode
Pseudocode describes algorithm logic using readable statements independent of any programming language.
Question 15 of 60 · flowchart · Easy
A flowchart is a:
Not quite. Try another option.
Answer: Graphical representation of an algorithm
A flowchart uses symbols and arrows to visually represent the steps and flow of an algorithm.
Question 16 of 60 · flowchart · Easy
In a flowchart, which symbol is used to represent a decision?
Not quite. Try another option.
Answer: Diamond
The diamond symbol represents a decision point where the flow branches based on a condition.
Question 17 of 60 · flowchart · Easy
Which flowchart symbol represents the start or end of a process?
Not quite. Try another option.
Answer: Oval (terminal)
The oval or rounded terminal symbol marks the beginning and the end of a flowchart.
Question 18 of 60 · types of programming methodologies · Easy
Which of the following is a programming methodology?
Not quite. Try another option.
Answer: Structured programming
Structured programming is a well-known methodology that organizes code using clear control structures and avoids unstructured jumps.
Question 19 of 60 · top down and bottom up program development cycle with case study · Easy
In the top-down approach, a large problem is:
Not quite. Try another option.
Answer: Broken down into smaller sub-problems
Top-down design starts with the main problem and divides it into smaller, manageable modules.
Question 20 of 60 · top down and bottom up program development cycle with case study · Easy
The bottom-up approach to program development begins by:
Not quite. Try another option.
Answer: Building smaller components first and then combining them into a complete system
Bottom-up design starts by creating basic lower-level modules and then integrating them to form the larger system.
Question 21 of 60 · introduction to programming · Medium
A team is converting a real-world payroll process into a computer program. Which sequence correctly represents the transformation from problem to executable software?
Not quite. Try another option.
Answer: Problem → Algorithm → Program → Machine code
A problem is first analyzed and expressed as an algorithm, then coded into a program, which is finally translated into machine code the computer can execute.
Question 22 of 60 · program concept · Medium
A program repeatedly produces different results for the same input values even though the code is unchanged. Which fundamental property of a correct program is being violated?
Not quite. Try another option.
Answer: Determinism
A correct program should be deterministic: given the same inputs, it must always produce the same outputs. Varying results for identical inputs indicate a violation of determinism.
Question 23 of 60 · characteristics of programming · Medium
A developer rewrites a long function into several smaller, self-contained functions. Which programming characteristic is most directly improved?
Not quite. Try another option.
Answer: Modularity
Breaking a large routine into smaller independent units improves modularity, making the code easier to test, reuse, and maintain.
Question 24 of 60 · characteristics of programming · Medium
Two programs solve the same task, but Program A runs in time while Program B runs in time. Which characteristic distinguishes Program A as the better choice for large inputs?
Not quite. Try another option.
Answer: Efficiency
Efficiency measures how well a program uses time and resources. For large , an solution scales far better than an one.
Question 25 of 60 · stages in program development · Medium
During program development, a compiler reports that a semicolon is missing. At which stage is this error detected?
Not quite. Try another option.
Answer: Compilation stage
Syntax errors like a missing semicolon are caught by the compiler during compilation, before the program can be executed.
Question 26 of 60 · stages in program development · Medium
A program compiles and runs, but gives wrong output because a formula was written incorrectly. This is best classified as which type of error, and it is handled in which stage?
Not quite. Try another option.
Answer: Logical error, testing/debugging stage
A wrong formula that still compiles and runs produces incorrect results, which is a logical error discovered and fixed during the testing and debugging stage.
Question 27 of 60 · stages in program development · Medium
Which ordering of program development stages is correct?
Development begins by understanding the problem, designing a solution, coding it, testing for correctness, and finally maintaining it over time.
Question 28 of 60 · algorithms · Medium
Consider this algorithm step: while (i > 0) { print i; } where i is never changed inside the loop. Which essential property of an algorithm does this violate?
Not quite. Try another option.
Answer: Finiteness
An algorithm must terminate after a finite number of steps. Since i never decreases, the loop runs forever, violating finiteness.
Question 29 of 60 · algorithms · Medium
An algorithm contains the instruction "add a suitable number to " without specifying which number. Which property of a good algorithm is missing?
Not quite. Try another option.
Answer: Definiteness
Definiteness requires each step to be precise and unambiguous. "A suitable number" is vague, so the step is not clearly defined.
Question 30 of 60 · algorithms · Medium
Given the algorithm: sum = 0; for i = 1 to 4: sum = sum + i, what is the final value of sum?
Not quite. Try another option.
Answer:
The loop adds , so sum finishes at .
Question 31 of 60 · notations · Medium
Which of the following expressions is written in postfix (Reverse Polish) notation for the infix expression ?
Not quite. Try another option.
Answer:
Multiplication has higher precedence, so becomes , then adding gives in postfix form.
Question 32 of 60 · notations · Medium
The prefix notation of an expression is . Which infix expression does it represent?
Not quite. Try another option.
Answer:
In prefix, the outer operator applies to and . Since is , the expression is .
Question 33 of 60 · flowchart · Medium
While drawing a flowchart, which symbol should be used to represent a decision such as if x > 0?
Not quite. Try another option.
Answer: Diamond (rhombus)
A diamond represents a decision point with branching paths. Rectangles are for processing, parallelograms for input/output, and ovals for start/stop.
Question 34 of 60 · flowchart · Medium
In a flowchart, the parallelogram symbol is used to represent which operation?
Not quite. Try another option.
Answer: Input or output
The parallelogram denotes input/output operations such as reading data or displaying results, while other symbols handle processing, decisions, and terminals.
Question 35 of 60 · flowchart · Medium
A flowchart contains many arrows crossing back to earlier steps, forming complex loops in a large program. Which limitation of flowcharts does this illustrate?
Not quite. Try another option.
Answer: They become hard to modify and manage as complexity grows
Flowcharts are good for small logic, but for large programs they become cluttered and difficult to modify or maintain.
Question 36 of 60 · types of programming methodologies · Medium
A methodology that organizes software around objects containing both data and the functions that operate on them is called:
Not quite. Try another option.
Answer: Object-oriented programming
Object-oriented programming bundles data and behavior into objects, unlike procedural programming which separates data from procedures.
Question 37 of 60 · types of programming methodologies · Medium
A programmer avoids goto statements and builds a program using only sequence, selection, and iteration constructs. Which methodology is being followed?
Not quite. Try another option.
Answer: Structured programming
Structured programming relies on sequence, selection, and iteration while avoiding unrestricted jumps like goto, improving clarity and reliability.
Question 38 of 60 · top down and bottom up program development · Medium
A design team first builds and tests small utility functions, then combines them into larger modules to form the final system. Which approach is this?
Not quite. Try another option.
Answer: Bottom-up approach
The bottom-up approach starts with low-level components, testing them first, then integrates them upward into higher-level modules.
Question 39 of 60 · top down and bottom up program development · Medium
In a top-down design of a billing system, the main problem is split into "read data", "calculate bill", and "print bill". This process of dividing a problem into smaller subproblems is called:
Not quite. Try another option.
Answer: Stepwise refinement
Top-down design uses stepwise refinement, breaking a main problem into progressively smaller and more detailed subproblems until they are easy to code.
Question 40 of 60 · top down and bottom up program development · Medium
In a case study, a team must build a large system reusing many existing tested library components. Which development approach is generally most suitable?
Not quite. Try another option.
Answer: Bottom-up, because existing components are combined into the whole
When reusable, tested components already exist, the bottom-up approach fits best since it assembles these lower-level parts into the complete system.
Question 41 of 60 · algorithms · Hard
Consider the algorithm:
set x = 0
for i from 1 to n:
for j from i to n:
x = x + 1
What is the final value of as a closed-form expression in ?
Not quite. Try another option.
Answer:
The inner loop runs times for each . Summing .
Question 42 of 60 · algorithms · Hard
An algorithm must be finite, definite, effective, and have input/output. Which scenario violates the property of definiteness specifically?
Not quite. Try another option.
Answer: A step says "choose a suitable value for x" without specifying how
Definiteness requires each step be precisely and unambiguously defined. A vague instruction violates definiteness. Non-termination violates finiteness, and an unperformable step violates effectiveness.
Question 43 of 60 · flowchart · Hard
In a flowchart, a program reads , then while replaces with if even, else , counting iterations. For , how many iterations occur before becomes ?
Not quite. Try another option.
Answer: 8
Sequence: . That is 8 transitions (iterations) to reach 1.
Question 44 of 60 · top down and bottom up program development cycle with case study · Hard
A team builds a payroll system by first coding and unit-testing utility routines (tax calc, date math), then combining them into modules, and finally into the full application. Which methodology and integration strategy does this reflect?
Not quite. Try another option.
Answer: Bottom-up development with bottom-up integration testing
Starting from low-level utilities and composing upward is bottom-up development. Testing lower modules first and combining upward (using drivers, not stubs) is bottom-up integration.
Question 45 of 60 · types of programming methodologies · Hard
Which statement most accurately distinguishes procedural from structured programming?
Not quite. Try another option.
Answer: Structured programming restricts control flow to sequence, selection, and iteration, avoiding arbitrary jumps, while procedural programming organizes code into procedures/functions
Structured programming is defined by disciplined control flow (no unrestricted goto). Procedural focuses on decomposing tasks into procedures. They overlap heavily but emphasize different aspects.
Question 46 of 60 · stages in program development · Hard
During which stage is the root cause of a logical error (correct compilation but wrong output) most appropriately identified and corrected?
Not quite. Try another option.
Answer: Testing and debugging
A logical error compiles fine but yields incorrect results. It is exposed during testing and resolved during debugging, though its origin may trace to analysis or design decisions.
Question 47 of 60 · algorithms · Hard
Two algorithms solve the same problem: A runs in and B runs in . For which range of input sizes is algorithm B strictly faster than A?
Not quite. Try another option.
Answer:
B is faster when , i.e. . For , A becomes faster. Asymptotics favor A, but for small inputs B wins.
Question 48 of 60 · flowchart · Hard
Why can an unstructured flowchart containing arbitrary crossing flow lines and multiple entry points into a loop be problematic when translated to structured code?
Not quite. Try another option.
Answer: It may require goto or duplicated logic because it cannot map cleanly onto sequence/selection/iteration constructs
Structured programming allows only single-entry/single-exit blocks. Multiple entries into a loop cannot be expressed with pure structured constructs, forcing goto or code duplication.
Question 49 of 60 · characteristics of programming · Hard
A program computes correct results but its runtime doubles each time input size increases by one element. Which quality characteristic is most severely compromised?
Not quite. Try another option.
Answer: Efficiency
Doubling per unit input implies exponential behavior. Results are still correct, so correctness holds; the failing attribute is efficiency (resource/time usage).
Question 50 of 60 · notations · Hard
Convert the infix expression to postfix notation, respecting standard operator precedence and left-to-right associativity.
Not quite. Try another option.
Answer:
, then . Then . Finally subtract: .
Question 51 of 60 · top down and bottom up program development cycle with case study · Hard
In top-down development of a large system, why are stubs used during early integration testing?
Not quite. Try another option.
Answer: To simulate lower-level modules that are not yet implemented, so higher-level logic can be tested
Top-down starts from top-level modules. Stubs are placeholder routines returning canned values, letting higher modules be tested before lower ones exist. Drivers serve the reverse role in bottom-up.
Question 52 of 60 · algorithms · Hard
Consider this algorithm on integer :
c = 0
while n > 0:
n = n & (n - 1)
c = c + 1
What does represent when the loop ends?
Not quite. Try another option.
Answer: The number of 1-bits (set bits) in the binary representation of
The operation n & (n-1) clears the lowest set bit each iteration. The count therefore equals the number of set bits (Brian Kernighan's algorithm).
Question 53 of 60 · stages in program development · Hard
A completed program passes all developer tests but frequently breaks after client-side changes over the years. Which stage of the program development life cycle is most directly involved in addressing this ongoing situation?
Not quite. Try another option.
Answer: Maintenance
Adapting a working program to changing requirements and environments over time is the maintenance stage, often the longest and costliest phase of the life cycle.
Question 54 of 60 · notations · Hard
Evaluate the postfix expression 5 1 2 + 4 * + 3 - using a stack. What is the result?
Not quite. Try another option.
Answer: 14
; ; ; . The stack-based evaluation yields 14.
Question 55 of 60 · introduction to programming · Hard
Which statement best explains why a high-level language program cannot be executed directly by the CPU without a translator?
Not quite. Try another option.
Answer: The CPU only executes machine code (binary instructions), so source code must be compiled or interpreted first
A CPU understands only its native machine instruction set in binary. High-level source must be translated (compiled/interpreted/assembled) into machine code before execution.
Question 56 of 60 · program concept · Hard
A student claims: "A program and an algorithm are exactly the same thing." What is the most accurate correction?
Not quite. Try another option.
Answer: An algorithm is a language-independent finite procedure; a program is its concrete implementation in a specific programming language
An algorithm is an abstract step-by-step method independent of any language. A program expresses that algorithm in a concrete syntax executable by a machine.
Question 57 of 60 · flowchart · Hard
A flowchart uses a diamond symbol with one entry and two exits labeled True/False. Which fundamental structured-programming construct does this represent, and what is the risk if one exit path is left unconnected?
Not quite. Try another option.
Answer: Selection (decision); an unconnected exit causes undefined/incomplete control flow
A diamond is the decision (selection) symbol. Every branch must lead somewhere; leaving a path unconnected produces incomplete, undefined flow of control.
Question 58 of 60 · characteristics of programming · Hard
Two correct programs solve the same task. Program X uses cryptic single-letter names and no comments; Program Y is well-structured and documented. Both run identically fast. Which characteristic most justifies preferring Y in a long-lived project?
Not quite. Try another option.
Answer: Maintainability
Since both are equally correct and fast, the differentiator is how easily the code can be understood and modified over time, which is maintainability.
Question 59 of 60 · types of programming methodologies · Hard
Which combination of features uniquely characterizes the object-oriented methodology as opposed to purely structured/procedural approaches?
Not quite. Try another option.
Answer: Encapsulation, inheritance, and polymorphism organized around objects
Object-oriented programming is distinguished by bundling data and behavior into objects and by encapsulation, inheritance, and polymorphism, unlike procedural/structured styles.
Question 60 of 60 · top down and bottom up program development cycle with case study · Hard
For an ATM software case study, module reuse across many banks is a top priority and the low-level transaction primitives are well understood. Which development approach is most advantageous, and why?
Not quite. Try another option.
Answer: Bottom-up, because reusable, well-tested low-level modules are built first and combined into varied higher systems
When robust, reusable primitives are the goal and are well understood, bottom-up excels: solid low-level components are built and tested first, then assembled into different higher-level systems.
That's unit 1
Answer a few questions and your score shows up here.
Nearly through. Did unit 1 of CAP1008 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 1 of CAP1008 save you a night before the exam?
Then you can help keep it free for the next batch. 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.