wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Introduction to Programming - Basic Concepts

Total questions: 72

Worksheet time: 36mins

Name
Class
Date
1.

What is a computer? Fill in the blank: A computer is a device which processes information according to _______ it has been given.

a)

instructions

b)

size

c)

color

d)

speed

2.

Which of the following is NOT a basic concept in programming?

a)

Algorithm

b)

Data processing

c)

Cooking

d)

Description methods

3.

Translate the following term to English: 'Thuật toán'.

a)

Algorithm

b)

Computer

c)

Program

d)

Data

4.

What is Machine code (Machine language)?

a)

The only language that a computer can understand and execute directly

b)

A language used by humans to communicate

c)

A high-level programming language

d)

A type of assembly language

5.

Fill in the blank: Machine code is usually represented in ________ or hexadecimal form.

a)

binary

b)

decimal

c)

octal

d)

ASCII

6.

What is Assembly language?

a)

A. A language that uses mnemonic codes to represent instructions

b)

B. A language that is easy for humans to read and write

c)

C. A type of machine code

d)

D. A high-level programming language

7.

Which of the following is an example of an Assembly language instruction?

a)

mov

b)

int main()

c)

10011001

d)

print

8.

What is a High-level programming language?

a)

A. A language based on human language, easy to read and write

b)

B. A language that only computers can understand

c)

C. A type of machine code

d)

D. A type of assembly language

9.

What are programming languages, and how are they structured?

a)

They are created based on human languages and structured to give instructions to the computer.

b)

They are only used for mathematical calculations.

c)

They are not based on human languages.

d)

They are used for drawing images.

10.

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.

a)

compiler

b)

database

c)

router

d)

monitor

11.

There are many different programming languages, and the choice of which to learn depends on personal needs and job requirements.

a)

True

b)

False

12.

What is a computer program? Fill in the blank: A computer program is _______.

a)

A set of instructions written in a programming language to direct the computer to solve problems according to human requirements.

b)

A device used to store data temporarily.

c)

A type of hardware component that processes information.

d)

A graphical user interface for interacting with the computer.

13.

Who is a programmer? Fill in the blank: A programmer/coder/software developer is a person who creates ________.

a)

computer programs

b)

paintings

c)

musical instruments

d)

recipes

14.

What are the three main components of a computer science problem?

a)

Input, Output, Constraint

b)

Input, Process, Output

c)

Data, Algorithm, Result

d)

Input, Storage, Output

15.

Given an integer n. Check if n is a positive integer or not. What is the output if the input is 7?

a)

true

b)

false

c)

undefined

d)

zero

16.

Given an integer n. Check if n is a positive integer or not. What is the output if the input is -2?

a)

false

b)

true

c)

0

d)

2

17.

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?

a)

3

b)

2

c)

4

d)

1

18.

Given an integer sequence a. What is the largest value in a?

a)

Input: an integer sequence a; Output: the largest value in a; Constraint: a is not empty; Type of problem: Search/Maximum value

b)

Input: an integer sequence a; Output: the smallest value in a; Constraint: a is not empty; Type of problem: Search/Minimum value

c)

Input: an integer sequence a; Output: the sum of all values in a; Constraint: a is not empty; Type of problem: Summation

d)

Input: an integer sequence a; Output: the average value in a; Constraint: a is not empty; Type of problem: Average

19.

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:

a)

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

b)

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

c)

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

d)

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

20.

What is an algorithm? Fill in the blank: An algorithm is a finite sequence of ________, unambiguous, computer-implementable instructions to solve a given problem.

a)

step-by-step

b)

random

c)

vague

d)

infinite

21.

Which of the following is a characteristic of an algorithm? Choose the correct answer.

a)

It must be described in a concrete way so that a machine can execute it.

b)

It must always run forever.

c)

It does not need to give correct results.

d)

It can be applied only in one specific case.

22.

Fill in the blank: An algorithm must terminate after a finite number of steps. This characteristic is called _________.

a)

Finiteness

b)

Correctness

c)

Efficiency

d)

Recursion

23.

Fill in the blank: The result of an algorithm must be correct. This characteristic is called _________.

a)

Correctness

b)

Efficiency

c)

Complexity

d)

Finiteness

24.

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.

a)

Efficiency (Hiệu quả)

b)

Complexity (Độ phức tạp)

c)

Correctness (Độ đúng đắn)

d)

Robustness (Độ bền vững)

25.

Fill in the blank: An algorithm must be applicable to all cases of the problem. This characteristic is called _________.

a)

Generality (Phổ quát)

b)

Efficiency (Hiệu quả)

c)

Accuracy (Chính xác)

d)

Simplicity (Đơn giản)

26.

Which of the following is NOT one of the three basic structures in algorithms?

a)

A. Sequence

b)

B. Selection

c)

C. Loop

d)

D. Recursion

27.

List the three basic structures in algorithms.

a)

Sequence, Selection, Loop

b)

Array, Function, Variable

c)

Input, Output, Process

d)

Class, Object, Method

28.

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.

a)

Input

b)

Output

c)

Multiply

d)

Subtract

29.

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.

a)

Compute

b)

Delete

c)

Print

d)

Divide

30.

Given two integers a and b. Write an algorithm to swap the values of a and b.

a)

Use a temporary variable to swap the values: temp = a; a = b; b = temp;

b)

Add a and b, then subtract a from b: a = a + b; b = a - b; a = b - a;

c)

Multiply a and b, then divide: a = a * b; b = a / b; a = b / a;

d)

Assign a to b and b to a directly: a = b; b = a;

31.

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?

a)

true

b)

false

c)

5

d)

undefined

32.

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?

a)

false

b)

true

c)

0

d)

-3

33.

Which of the following algorithms correctly checks if n is a positive integer?

a)

If n > 0 and n is an integer, then n is a positive integer.

b)

If n < 0, then n is a positive integer.

c)

If n = 0, then n is a positive integer.

d)

If n is not an integer, then n is a positive integer.

34.

Which of the following is the correct algorithm to solve the quadratic equation ax2+bx+c=0ax^2 + bx + c = 0 , where a ≠ 0?

a)

Calculate the discriminant D = b24acb^2 - 4ac , then find the roots using x=(b±D)/(2a)x = (-b ± √D) / (2a) .

b)

Divide both sides by a and solve for x using linear methods.

c)

Set b and c to zero and solve for x.

d)

Use x = (-c)/b to find the root.

35.

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?

a)

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.

b)

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.

c)

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.

d)

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.

36.

Given a positive integer n. Write an algorithm to calculate the product P = 1 x 2 x ... x n.

a)

P = 1 x 2 x ... x n (the algorithm should multiply all integers from 1 to n).

b)

P = 1 + 2 + ... + n (the algorithm should add all integers from 1 to n).

c)

P = n x (n-1) x ... x 1 (the algorithm should multiply all integers from n down to 1).

d)

P = n2n^2 (the algorithm should square the integer n).

37.

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?

a)

Input, Output, Constraints

b)

Variables, Functions, Loops

c)

Algorithm, Flowchart, Pseudocode

d)

Complexity, Efficiency, Scalability

38.

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?

a)

Computational thinking

b)

Critical thinking

c)

Creative thinking

d)

Logical thinking

39.

What is the third step in algorithm design? Fill in the blank: The third step in algorithm design is _________?

a)

Estimating the complexity of the algorithm and finding improvements (if any).

b)

Writing the code for the algorithm.

c)

Testing the algorithm with sample inputs.

d)

Defining the problem statement.

40.

What is the fourth step in algorithm design? Fill in the blank: The fourth step in algorithm design is _________?

a)

Implementing the program.

b)

Analyzing the problem.

c)

Testing the algorithm.

d)

Designing the solution.

41.

What is the fifth step in algorithm design? Fill in the blank: The fifth step in algorithm design is _________?

a)

Testing and debugging the program.

b)

Writing the algorithm in pseudocode.

c)

Analyzing the problem requirements.

d)

Designing the user interface.

42.

Which of the following is NOT a method for describing algorithms?

a)

Natural language

b)

Pseudocode

c)

Flowchart

d)

Binary code

43.

Fill in the blank: The three methods for describing algorithms are ________, pseudocode, and flowchart.

a)

natural language

b)

binary code

c)

machine language

d)

assembly language

44.

What is the purpose of using pseudocode in algorithm description?

a)

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.

b)

To execute the algorithm directly on a computer.

c)

To make the algorithm more complex and harder to understand.

d)

To translate the algorithm into machine code.

45.

Which step comes first in the natural language description of the sum algorithm?

a)

Set S = 0, i = 1

b)

Input n

c)

S = S + i

d)

i = i + 1

46.

Fill in the blank: In the sum algorithm, the loop continues while ________.

a)

i ≤ n

b)

i = n

c)

i < 0

d)

i > n

47.

What is the final output of the sum algorithm described in the pseudocode?

a)

The sum S = 1 + 2 + ... + n

b)

The product P = 1 × 2 × ... × n

c)

The difference D = n - (1 + 2 + ... + n)

d)

The average A = (1 + 2 + ... + n)/n

48.

What is the purpose of the 'READ n' step in the flowchart?

a)

To input the value of n.

b)

To output the value of n.

c)

To initialize the value of n.

d)

To validate the value of n.

49.

What is the description of the 'Terminal' block in a flowchart?

a)

Điểm bắt đầu/kết thúc thuật toán (Start/End point of the algorithm)

b)

Thực hiện phép toán (Performing calculations)

c)

Quyết định điều kiện (Decision making)

d)

Nhập/xuất dữ liệu (Input/Output data)

50.

What is the description of the 'Input/Output' block in a flowchart?

a)

Nhập/xuất dữ liệu (Input/Output data)

b)

Quyết định (Decision)

c)

Bắt đầu/Kết thúc (Start/End)

d)

Xử lý (Process)

51.

What is the description of the 'Process' block in a flowchart?

a)

Thao tác xử lý dữ liệu, tính toán, phép gán (Data processing, calculation, assignment)

b)

Biểu diễn quyết định, rẽ nhánh (Decision, branching)

c)

Biểu diễn nhập/xuất dữ liệu (Input/Output)

d)

Biểu diễn kết nối các phần của lưu đồ (Connector)

52.

What is the description of the 'Decision' block in a flowchart?

a)

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)

b)

Lưu trữ dữ liệu tạm thời (Temporarily store data)

c)

Bắt đầu hoặc kết thúc một quá trình (Start or end a process)

d)

Hiển thị kết quả ra màn hình (Display results on the screen)

53.

What is the description of the 'Flowline (Arrowhead)' block in a flowchart?

a)

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)

Bắt đầu hoặc kết thúc một quá trình (Start or end a process)

c)

Thực hiện một phép toán hoặc hành động (Perform an operation or action)

d)

Lưu trữ dữ liệu (Store data)

54.

Which flowchart best describes the algorithm that calculates and prints the sum of two integers a and b?

a)

Start → Input a, b → Calculate sum = a + b → Print sum → End

b)

Start → Input a, b → Print a → Print b → End

c)

Start → Input a, b → Calculate product = a * b → Print product → End

d)

Start → Input a, b → Print a + b without calculation → End

55.

Which flowchart best describes the algorithm for swapping the values of two integers a and b?

a)

A flowchart that uses a temporary variable to store one value, swaps the values, and then assigns the temporary value to the other variable.

b)

A flowchart that adds both values and assigns the sum to both variables.

c)

A flowchart that multiplies both values and assigns the product to both variables.

d)

A flowchart that compares the two values and assigns the larger value to both variables.

56.

Which of the following flowcharts correctly describes the algorithm to check if n is a positive integer or not?

a)

Start → Input n → Is n > 0? → Yes: Output 'n is positive integer' → No: Output 'n is not positive integer' → End

b)

Start → Input n → Is n < 0? → Yes: Output 'n is positive integer' → No: Output 'n is not positive integer' → End

c)

Start → Input n → Is n = 0? → Yes: Output 'n is positive integer' → No: Output 'n is not positive integer' → End

d)

Start → Input n → Is n > 1? → Yes: Output 'n is positive integer' → No: Output 'n is not positive integer' → End

57.

Which of the following flowcharts correctly describes the algorithm to calculate the product P = 1 x 2 x ... x n (with n > 0)?

a)

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.

b)

A flowchart that initializes P=0, adds i from 1 to n to P, and outputs P at the end.

c)

A flowchart that initializes P=1, divides P by i from 1 to n, and outputs P at the end.

d)

A flowchart that initializes P=1, subtracts i from P for i from 1 to n, and outputs P at the end.

58.

Which flowchart best describes the algorithm for solving a quadratic equation of the form ax2+bx+c=0ax^2 + bx + c = 0 (a ≠ 0)?

a)

A flowchart that calculates the discriminant, checks its value, and finds the roots using the quadratic formula.

b)

A flowchart that only adds the coefficients a, b, and c.

c)

A flowchart that multiplies a and c and ignores b.

d)

A flowchart that solves for x by dividing c by a.

59.

Which step should be included in a flowchart for solving a quadratic equation of the form ax2+bx+c=0ax^2 + bx + c = 0 (a ≠ 0)?

a)

Prompt the user to re-enter 'a' until a ≠ 0

b)

Accept any value for 'a', including a = 0

c)

Ignore the value of 'a' and solve for x

d)

Set 'a' to zero if the user enters a = 0

60.

Fill in the blank: Master the basic concepts in ________.

a)

programming

b)

cooking

c)

gardening

d)

painting

61.

Fill in the blank: Understand the concept of Algorithm and its ________.

a)

characteristics

b)

limitations

c)

applications

d)

syntax

62.

Fill in the blank: Be able to design algorithms with three structures: sequence, selection, and ________.

a)

iteration (loop)

b)

recursion

c)

abstraction

d)

inheritance

63.

Which of the following is NOT a software mentioned for drawing flowcharts?

a)

Microsoft Visio

b)

Flowgorithm

c)

Crocodile ICT

d)

Adobe Photoshop

64.

Fill in the blank: The free software mentioned for drawing flowcharts is __________.

a)

Flowgorithm

b)

Photoshop

c)

MS Word

d)

Excel

65.

What is the first step to draw a flowchart using Microsoft Visio?

a)

Select Flowchart

b)

Start Microsoft Visio

c)

Double click Basic Flowchart

d)

Save the file

66.

Fill in the blank: After starting Microsoft Visio, the next step is to choose __________.

a)

Flowchart

b)

Spreadsheet

c)

Presentation

d)

Document

67.

What do you double click to start creating a flowchart in Microsoft Visio?

a)

Flowgorithm

b)

Crocodile ICT

c)

Basic Flowchart

d)

Advanced Flowchart

68.

What is the action described in Step 4 for drawing block diagrams in MS Visio?

a)

Drag the first block into the drawing area.

b)

Select the print option from the File menu.

c)

Change the background color of the page.

d)

Save the diagram as a PDF file.

69.

What should you do to create the next block from the existing block in MS Visio?

a)

Select the triangle to generate the next block.

b)

Right-click and choose 'Duplicate Block'.

c)

Press Ctrl+N to create a new block.

d)

Drag the block to the canvas again.

70.

How do you connect two blocks together in MS Visio?

a)

Move the mouse to the Start block, then select the triangle below.

b)

Right-click on the block and choose 'Connect'.

c)

Drag and drop one block onto another.

d)

Double-click on both blocks simultaneously.

71.

Describe the result shown in the MS Visio window.

a)

The MS Visio window displays a flowchart diagram.

b)

The MS Visio window shows a spreadsheet with data.

c)

The MS Visio window contains a bar graph.

d)

The MS Visio window presents a text document.

72.

Describe the result shown in the MS Visio window.

a)

The MS Visio window displays a completed flowchart diagram.

b)

The MS Visio window shows a blank workspace with no shapes.

c)

The MS Visio window contains a network topology diagram.

d)

The MS Visio window displays a Gantt chart.