NEW
Font size
WorksheetsIntroduction to Programming - Basic Concepts
Total questions: 72
Worksheet time: 36mins
What is a computer? Fill in the blank: A computer is a device which processes information according to _______ it has been given.
instructions
size
color
speed
Which of the following is NOT a basic concept in programming?
Algorithm
Data processing
Cooking
Description methods
Translate the following term to English: 'Thuật toán'.
Algorithm
Computer
Program
Data
What is Machine code (Machine language)?
The only language that a computer can understand and execute directly
A language used by humans to communicate
A high-level programming language
A type of assembly language
Fill in the blank: Machine code is usually represented in ________ or hexadecimal form.
binary
decimal
octal
ASCII
What is Assembly language?
A. A language that uses mnemonic codes to represent instructions
B. A language that is easy for humans to read and write
C. A type of machine code
D. A high-level programming language
Which of the following is an example of an Assembly language instruction?
mov
int main()
10011001
What is a High-level programming language?
A. A language based on human language, easy to read and write
B. A language that only computers can understand
C. A type of machine code
D. A type of assembly language
What are programming languages, and how are they structured?
They are created based on human languages and structured to give instructions to the computer.
They are only used for mathematical calculations.
They are not based on human languages.
They are used for drawing images.
Fill in the blank. The ________ or interpreter helps translate programs written in high-level programming languages into low-level languages that the computer can execute.
compiler
database
router
monitor
There are many different programming languages, and the choice of which to learn depends on personal needs and job requirements.
True
False
What is a computer program? Fill in the blank: A computer program is _______.
A set of instructions written in a programming language to direct the computer to solve problems according to human requirements.
A device used to store data temporarily.
A type of hardware component that processes information.
A graphical user interface for interacting with the computer.
Who is a programmer? Fill in the blank: A programmer/coder/software developer is a person who creates ________.
computer programs
paintings
musical instruments
recipes
What are the three main components of a computer science problem?
Input, Output, Constraint
Input, Process, Output
Data, Algorithm, Result
Input, Storage, Output
Given an integer n. Check if n is a positive integer or not. What is the output if the input is 7?
true
false
undefined
zero
Given an integer n. Check if n is a positive integer or not. What is the output if the input is -2?
false
true
0
2
Given a sequence of integers a. How many positive integers are in this sequence? If the input is 1 9 -4 5 0 -7, what is the output?
3
2
4
1
Given an integer sequence a. What is the largest value in a?
Input: an integer sequence a; Output: the largest value in a; Constraint: a is not empty; Type of problem: Search/Maximum value
Input: an integer sequence a; Output: the smallest value in a; Constraint: a is not empty; Type of problem: Search/Minimum value
Input: an integer sequence a; Output: the sum of all values in a; Constraint: a is not empty; Type of problem: Summation
Input: an integer sequence a; Output: the average value in a; Constraint: a is not empty; Type of problem: Average
Given coins with denominations 1, 2, 5, 10, 20, and 50 and a total amount n. Find a way to exchange n into coins of these denominations so that the total number of coins is minimized. Analyze the problem:
Input: total amount n and denominations 1, 2, 5, 10, 20, 50; Output: list of coins that sum to n with the minimum number of coins; Constraint: denominations are available in unlimited supply; Type of problem: Optimization/Greedy
Input: total amount n and denominations 1, 2, 5, 10, 20, 50; Output: list of coins that sum to n with the maximum number of coins; Constraint: denominations are available in limited supply; Type of problem: Enumeration
Input: total amount n and denominations 1, 2, 5, 10, 20, 50; Output: list of coins that sum to n with the minimum number of coins; Constraint: denominations are available in limited supply; Type of problem: Dynamic Programming
Input: total amount n and denominations 1, 2, 5, 10, 20, 50; Output: list of coins that sum to n with the minimum number of coins; Constraint: denominations are available in unlimited supply; Type of problem: Simulation
What is an algorithm? Fill in the blank: An algorithm is a finite sequence of ________, unambiguous, computer-implementable instructions to solve a given problem.
step-by-step
random
vague
infinite
Which of the following is a characteristic of an algorithm? Choose the correct answer.
It must be described in a concrete way so that a machine can execute it.
It must always run forever.
It does not need to give correct results.
It can be applied only in one specific case.
Fill in the blank: An algorithm must terminate after a finite number of steps. This characteristic is called _________.
Finiteness
Correctness
Efficiency
Recursion
Fill in the blank: The result of an algorithm must be correct. This characteristic is called _________.
Correctness
Efficiency
Complexity
Finiteness
Fill in the blank: The effectiveness of an algorithm is evaluated based on criteria such as time and space when executed. This is related to the _________ of the algorithm.
Efficiency (Hiệu quả)
Complexity (Độ phức tạp)
Correctness (Độ đúng đắn)
Robustness (Độ bền vững)
Fill in the blank: An algorithm must be applicable to all cases of the problem. This characteristic is called _________.
Generality (Phổ quát)
Efficiency (Hiệu quả)
Accuracy (Chính xác)
Simplicity (Đơn giản)
Which of the following is NOT one of the three basic structures in algorithms?
A. Sequence
B. Selection
C. Loop
D. Recursion
List the three basic structures in algorithms.
Sequence, Selection, Loop
Array, Function, Variable
Input, Output, Process
Class, Object, Method
Fill in the blank: The sequence structure is the most basic structure, where each statement is executed in the order it appears. For example, to calculate the sum of two integers a and b, the first step is to ________ a and b.
Input
Output
Multiply
Subtract
Fill in the blank: In the example of calculating the sum of two integers a and b, the second step is to ________ sum = a + b.
Compute
Delete
Divide
Given two integers a and b. Write an algorithm to swap the values of a and b.
Use a temporary variable to swap the values: temp = a; a = b; b = temp;
Add a and b, then subtract a from b: a = a + b; b = a - b; a = b - a;
Multiply a and b, then divide: a = a * b; b = a / b; a = b / a;
Assign a to b and b to a directly: a = b; b = a;
Algorithm example: Check if n is a positive integer or not? Step 1: Input n Step 2: Set t to false Step 3: If n > 0, t = true. Go to step 4; otherwise, go to step 4. Step 4: Output t (the result is true/false) Step 5: End. What is the value of t if n = 5?
true
false
5
undefined
Algorithm example: Check if n is a positive integer or not? Step 1: Input n Step 2: Set t to false Step 3: If n > 0, t = true. Go to step 4; otherwise, go to step 4. Step 4: Output t (the result is true/false) Step 5: End. What is the value of t if n = -3?
false
true
0
-3
Which of the following algorithms correctly checks if n is a positive integer?
If n > 0 and n is an integer, then n is a positive integer.
If n < 0, then n is a positive integer.
If n = 0, then n is a positive integer.
If n is not an integer, then n is a positive integer.
Which of the following is the correct algorithm to solve the quadratic equation ax2+bx+c=0 , where a ≠ 0?
Calculate the discriminant D = b2−4ac , then find the roots using x=(−b±√D)/(2a) .
Divide both sides by a and solve for x using linear methods.
Set b and c to zero and solve for x.
Use x = (-c)/b to find the root.
Loop structure: Perform a command/sequence of commands repeatedly a finite number of times. Example 9: Write the algorithm to calculate the sum S = 1 + 2 + ... + n (with n > 0). Which of the following is the correct sequence of steps for this algorithm?
1. Input n; 2. Initialize S = 0, i = 1; 3. If i ≤ n, S = S + i; Go to step 4; Otherwise, go to step 5; 4. i = i + 1; Go back to step 3; 5. Output S; 6. End.
1. Input n; 2. Initialize S = 0, i = 1; 3. If i > n, S = S + i; Go to step 4; Otherwise, go to step 5; 4. i = i + 1; Go back to step 3; 5. Output S; 6. End.
1. Input n; 2. Initialize S = 0, i = 1; 3. If i ≤ n, S = S - i; Go to step 4; Otherwise, go to step 5; 4. i = i + 1; Go back to step 3; 5. Output S; 6. End.
1. Input n; 2. Initialize S = 0, i = 1; 3. If i ≤ n, S = S * i; Go to step 4; Otherwise, go to step 5; 4. i = i + 1; Go back to step 3; 5. Output S; 6. End.
Given a positive integer n. Write an algorithm to calculate the product P = 1 x 2 x ... x n.
P = 1 x 2 x ... x n (the algorithm should multiply all integers from 1 to n).
P = 1 + 2 + ... + n (the algorithm should add all integers from 1 to n).
P = n x (n-1) x ... x 1 (the algorithm should multiply all integers from n down to 1).
P = n2 (the algorithm should square the integer n).
Step 1 in algorithm design: Carefully read the description to determine the requirements of the problem, including Input, Output, and Constraints. What are the three main components to identify in this step?
Input, Output, Constraints
Variables, Functions, Loops
Algorithm, Flowchart, Pseudocode
Complexity, Efficiency, Scalability
Step 2 in algorithm design: Find the solution to the problem. Which type of thinking is applied to break down the problem and find the simplest solution?
Computational thinking
Critical thinking
Creative thinking
Logical thinking
What is the third step in algorithm design? Fill in the blank: The third step in algorithm design is _________?
Estimating the complexity of the algorithm and finding improvements (if any).
Writing the code for the algorithm.
Testing the algorithm with sample inputs.
Defining the problem statement.
What is the fourth step in algorithm design? Fill in the blank: The fourth step in algorithm design is _________?
Implementing the program.
Analyzing the problem.
Testing the algorithm.
Designing the solution.
What is the fifth step in algorithm design? Fill in the blank: The fifth step in algorithm design is _________?
Testing and debugging the program.
Writing the algorithm in pseudocode.
Analyzing the problem requirements.
Designing the user interface.
Which of the following is NOT a method for describing algorithms?
Natural language
Pseudocode
Flowchart
Binary code
Fill in the blank: The three methods for describing algorithms are ________, pseudocode, and flowchart.
natural language
binary code
machine language
assembly language
What is the purpose of using pseudocode in algorithm description?
To use a set of keywords and syntax to describe an algorithm in a way that is close to programming language but not specific to any one language.
To execute the algorithm directly on a computer.
To make the algorithm more complex and harder to understand.
To translate the algorithm into machine code.
Which step comes first in the natural language description of the sum algorithm?
Set S = 0, i = 1
Input n
S = S + i
i = i + 1
Fill in the blank: In the sum algorithm, the loop continues while ________.
i ≤ n
i = n
i < 0
i > n
What is the final output of the sum algorithm described in the pseudocode?
The sum S = 1 + 2 + ... + n
The product P = 1 × 2 × ... × n
The difference D = n - (1 + 2 + ... + n)
The average A = (1 + 2 + ... + n)/n
What is the purpose of the 'READ n' step in the flowchart?
To input the value of n.
To output the value of n.
To initialize the value of n.
To validate the value of n.
What is the description of the 'Terminal' block in a flowchart?
Điểm bắt đầu/kết thúc thuật toán (Start/End point of the algorithm)
Thực hiện phép toán (Performing calculations)
Quyết định điều kiện (Decision making)
Nhập/xuất dữ liệu (Input/Output data)
What is the description of the 'Input/Output' block in a flowchart?
Nhập/xuất dữ liệu (Input/Output data)
Quyết định (Decision)
Bắt đầu/Kết thúc (Start/End)
Xử lý (Process)
What is the description of the 'Process' block in a flowchart?
Thao tác xử lý dữ liệu, tính toán, phép gán (Data processing, calculation, assignment)
Biểu diễn quyết định, rẽ nhánh (Decision, branching)
Biểu diễn nhập/xuất dữ liệu (Input/Output)
Biểu diễn kết nối các phần của lưu đồ (Connector)
What is the description of the 'Decision' block in a flowchart?
Thực hiện các chọn lựa dựa vào biểu thức điều kiện để rẽ nhánh (Make choices based on condition expressions for branching)
Lưu trữ dữ liệu tạm thời (Temporarily store data)
Bắt đầu hoặc kết thúc một quá trình (Start or end a process)
Hiển thị kết quả ra màn hình (Display results on the screen)
What is the description of the 'Flowline (Arrowhead)' block in a flowchart?
Kết nối các khối, thể hiện thứ tự thực hiện của các bước (Connects blocks, shows the order of execution)
Bắt đầu hoặc kết thúc một quá trình (Start or end a process)
Thực hiện một phép toán hoặc hành động (Perform an operation or action)
Lưu trữ dữ liệu (Store data)
Which flowchart best describes the algorithm that calculates and prints the sum of two integers a and b?
Start → Input a, b → Calculate sum = a + b → Print sum → End
Start → Input a, b → Print a → Print b → End
Start → Input a, b → Calculate product = a * b → Print product → End
Start → Input a, b → Print a + b without calculation → End
Which flowchart best describes the algorithm for swapping the values of two integers a and b?
A flowchart that uses a temporary variable to store one value, swaps the values, and then assigns the temporary value to the other variable.
A flowchart that adds both values and assigns the sum to both variables.
A flowchart that multiplies both values and assigns the product to both variables.
A flowchart that compares the two values and assigns the larger value to both variables.
Which of the following flowcharts correctly describes the algorithm to check if n is a positive integer or not?
Start → Input n → Is n > 0? → Yes: Output 'n is positive integer' → No: Output 'n is not positive integer' → End
Start → Input n → Is n < 0? → Yes: Output 'n is positive integer' → No: Output 'n is not positive integer' → End
Start → Input n → Is n = 0? → Yes: Output 'n is positive integer' → No: Output 'n is not positive integer' → End
Start → Input n → Is n > 1? → Yes: Output 'n is positive integer' → No: Output 'n is not positive integer' → End
Which of the following flowcharts correctly describes the algorithm to calculate the product P = 1 x 2 x ... x n (with n > 0)?
A flowchart that initializes P=1, uses a loop from i=1 to n multiplying P by i each time, and outputs P at the end.
A flowchart that initializes P=0, adds i from 1 to n to P, and outputs P at the end.
A flowchart that initializes P=1, divides P by i from 1 to n, and outputs P at the end.
A flowchart that initializes P=1, subtracts i from P for i from 1 to n, and outputs P at the end.
Which flowchart best describes the algorithm for solving a quadratic equation of the form ax2+bx+c=0 (a ≠ 0)?
A flowchart that calculates the discriminant, checks its value, and finds the roots using the quadratic formula.
A flowchart that only adds the coefficients a, b, and c.
A flowchart that multiplies a and c and ignores b.
A flowchart that solves for x by dividing c by a.
Which step should be included in a flowchart for solving a quadratic equation of the form ax2+bx+c=0 (a ≠ 0)?
Prompt the user to re-enter 'a' until a ≠ 0
Accept any value for 'a', including a = 0
Ignore the value of 'a' and solve for x
Set 'a' to zero if the user enters a = 0
Fill in the blank: Master the basic concepts in ________.
programming
cooking
gardening
painting
Fill in the blank: Understand the concept of Algorithm and its ________.
characteristics
limitations
applications
syntax
Fill in the blank: Be able to design algorithms with three structures: sequence, selection, and ________.
iteration (loop)
recursion
abstraction
inheritance
Which of the following is NOT a software mentioned for drawing flowcharts?
Microsoft Visio
Flowgorithm
Crocodile ICT
Adobe Photoshop
Fill in the blank: The free software mentioned for drawing flowcharts is __________.
Flowgorithm
Photoshop
MS Word
Excel
What is the first step to draw a flowchart using Microsoft Visio?
Select Flowchart
Start Microsoft Visio
Double click Basic Flowchart
Save the file
Fill in the blank: After starting Microsoft Visio, the next step is to choose __________.
Flowchart
Spreadsheet
Presentation
Document
What do you double click to start creating a flowchart in Microsoft Visio?
Flowgorithm
Crocodile ICT
Basic Flowchart
Advanced Flowchart
What is the action described in Step 4 for drawing block diagrams in MS Visio?
Drag the first block into the drawing area.
Select the print option from the File menu.
Change the background color of the page.
Save the diagram as a PDF file.
What should you do to create the next block from the existing block in MS Visio?
Select the triangle to generate the next block.
Right-click and choose 'Duplicate Block'.
Press Ctrl+N to create a new block.
Drag the block to the canvas again.
How do you connect two blocks together in MS Visio?
Move the mouse to the Start block, then select the triangle below.
Right-click on the block and choose 'Connect'.
Drag and drop one block onto another.
Double-click on both blocks simultaneously.
Describe the result shown in the MS Visio window.
The MS Visio window displays a flowchart diagram.
The MS Visio window shows a spreadsheet with data.
The MS Visio window contains a bar graph.
The MS Visio window presents a text document.
Describe the result shown in the MS Visio window.
The MS Visio window displays a completed flowchart diagram.
The MS Visio window shows a blank workspace with no shapes.
The MS Visio window contains a network topology diagram.
The MS Visio window displays a Gantt chart.
