FBISE, NCP & NBF-aligned resources for Classes 9–12
Browse by Class
Browse by Type
Computer Chapter 3 : Topic 4.1
An algorithm is a set of instructions
1 / 18
Which statement best describes the meaning of an algorithm in the context of programming and problem solving?
Reasoning: An algorithm is a step-by-step set of instructions designed to solve a problem or perform a task.
2 / 18
In JavaScript programming, why is it important that an algorithm follows a specific logical sequence of steps?
Reasoning: Algorithms must follow sequence so that each step executes in correct order to produce accurate results.
3 / 18
Which type of programming structure is used when instructions are executed one after another without any condition?
Reasoning: Sequence structure executes instructions step-by-step in a fixed order without decision making.
4 / 18
Which control structure allows a program to make decisions based on whether a condition is true or false?
Reasoning: Selection uses conditions like if/else to decide which block of code should run.
5 / 18
In JavaScript, which keyword is primarily used to implement decision-making in an algorithm?
Reasoning: The if statement is used to perform selection based on conditions.
6 / 18
What will happen if a selection condition in an if statement evaluates to false in a JavaScript program?
Reasoning: If the condition is false, the code inside the if block is not executed.
7 / 18
Which structure is best used when a task must be repeated multiple times until a condition becomes false?
Reasoning: Repetition (loops) is used when actions must be repeated based on a condition.
8 / 18
Which JavaScript loop is most suitable when the number of repetitions is known in advance?
Reasoning: The for loop is used when iteration count is fixed or known.
9 / 18
What is the main risk of writing a repetition structure incorrectly in an algorithm?
Reasoning: Incorrect loop conditions can cause infinite loops where execution never stops.
10 / 18
Which statement best explains how sequence, selection, and repetition work together in an algorithm?
Reasoning: These three structures together form the foundation of algorithm design.
11 / 18
In a JavaScript algorithm, what is the purpose of using an else statement with an if condition?
Reasoning: The else block runs when the if condition evaluates to false.
12 / 18
Which loop structure guarantees that the code inside it will execute at least once before checking the condition?
Reasoning: do...while executes first, then checks the condition afterward.
13 / 18
What is the correct interpretation of a step-by-step algorithm used in JavaScript programming?
Reasoning: Algorithms are structured logical steps to solve problems systematically.
14 / 18
Which part of a loop controls whether the repetition continues or stops in JavaScript?
Reasoning: The loop condition determines whether the loop continues or terminates.
15 / 18
What will be the effect of placing a break statement inside a loop in JavaScript?
Reasoning: break is used to exit a loop immediately when a condition is met.
16 / 18
Which of the following best describes a real-world example of a selection structure in an algorithm?
Reasoning: Selection involves decision-making based on conditions such as user login status.
17 / 18
Why is indentation and logical structure important when writing algorithms or JavaScript code?
Reasoning: Proper structure helps programmers understand flow and identify errors easily.
18 / 18
Which of the following best explains how repetition improves efficiency in an algorithm?
Reasoning: Loops allow reuse of instructions, making programs shorter and more efficient.
Your score is
Restart quiz