Font size
WorksheetsBasic Algorithm in C (Data type, Expression, Branching, Looping)
Total questions: 40
Worksheet time: 36mins
What is the role of the Central Processing Unit (CPU) in a computer?
It stores data and instructions.
It executes instructions and performs calculations.
It allows communication with external devices.
It performs arithmetic and logical operations.
What does the memory unit do in a computer?
It stores data and instructions currently being used.
It executes instructions.
It directs the flow of data.
It allows communication with external devices.
Logical units in a computer, some of which include...
(Select all correct answers)
Arithmetic and Logic Unit (ALU), Control Unit (CU)
Input/Output Unit
Power Supply Unit (PSU)
Storage Unit
Graphics Processing Unit (GPU)
What is an algorithm?
A type of computer hardware component.
Which of the following is one of the requirements of a good algorithm?
A good algorithm must have well-defined inputs and outputs.
A good algorithm should be complex to solve problems efficiently.
A good algorithm must be written in a programming language.
What is algorithm notation?
A set of rules for executing an algorithm on a computer.
Algorithm notation is a symbolic or structured way to represent an algorithm.
What is a flowchart?
A programming language used to implement algorithms.
A diagram that represents the steps of an algorithm using symbols.
A type of software that executes algorithms automatically.
A mathematical symbols used to solve complex problems.
What is a variable?
Which of the following are the rules for naming variables in C programming languages?
(Select all correct answers)
Can start with a number.
Cannot contain spaces.
Cannot use reserved keywords or built-in functions.
Case-Sensitive.
Allowed Characters: Variable names can only consist of letters (A-Z, a-z), numbers (0-9), and underscores (_).
Which of the following are valid variable names in programming? (Select all correct answers)
user_name
2ndValue
_dataCount
int
totalAmount$
Consider the following pseudocode. When this pseudocode is executed, will the output be 6, 4?
YES! ✅
NO! ❌
Consider the following pseudocode, if someone claims that the output of this pseudocode is x = 8 and y = 3, is this statement True or False?
FALSE
TRUE
What is a data type?
BONUS TIME:
Do you want a bonus point?
NO!
YES!
An operator is a value or variable that is manipulated within an expression.
TRUE
FALSE
Which of the following correctly represents the order of operator precedence from highest to lowest?
B - A - D - E - F - C
D - B - E - A - F - C
B - D - A - E - F - C
B - E - D - A - F - C
B - D - E - A - F - C
What is the result of the following Boolean expression?
(3 == 5) || (10 > 2 && 7 < 4)
TRUE
FALSE
10 + 3 * 2 - 8 / 4 % 3
Evaluate the following mathematical expression, considering operator precedence:
(20 − 5) + (8 % 3 * ((6 / 2) / 5))
What is the final result?
(a)
If the following expression is executed in the C programming language, what will be the result?
14
24
27
29
32
BONUS TIME:
Select all 'POINT's and you will get 2 points!
POINT
X
POINT
X
X
What is branching in programming?
Branching refers to the method of repeating a set of instructions multiple times until a condition is met.
Branching is the process of executing a sequence of statements in a linear order without any decision-making.
Branching is a programming concept that allows the execution of different code paths based on conditions.
What will be the output of the following C program?
(a)
What will be the output of the following C program?
Case A
Case B
Case C
Case D
Case E
What will be the output of the following C program?
Option A
Option B
Option C
Option C and Option D
Option E
Which of the following is NOT a main structure in looping?
Initialization
Condition
Function Call
Update Statement
The following are basic structures in looping, except...
for loops
Switch-case
What will be the output of the following C program if the user inputs n = 5?
8 7 6 5 4
8 6 4 2
8 7 6 5 4 3 2
What will be the output of the following C code?
If you reach this part, write your favorite pet.
If the following C program is executed, what will be the output?
Here are the purposes of 'break' control commands except...
Stops the execution of a loop before the final condition is reached.
Stops execution in a switch-case after a case has been satisfied.
To skip an iteration in a loop and continue with the next one.
To stop execution when a certain condition is met
What is traversal in the context of looping and branching?
Traversal is process of executing a block of code repeatedly based on a condition.
Traversal is a method of skipping iterations in a loop using a control command.
Traversal is process of accessing each element in a data structure systematically.
Traversal is the act of making decisions using conditional statements.
Which of the following is NOT a correct use of traversal in data structures?
Searching: Traversing helps you find a specific element in a data structure.
Sorting: Traversing and comparing data helps you sort the data.
Teleportation: Traversing allows you to instantly access any data without scanning.
Accessibility: Traversing makes data more accessible
Modifying data: Traversing allows you to modify or change data.
BONUS TIME:
Write 'EXTRA' and you will get an extra point!
(a)
Consider the following C program, what will be the output of this program?
1 2 4 5 7 8
1 2 3 4 5 6 7
What will be the output of the following C program?
10 8 7 5 4 2 1 0
10 9 8 7 6 5 4 3 2 1 0
9 8 6 5 3 2 0
9 7 6 4 3 1 0
Tino runs at a speed of 5 meters per second but must rest for 10 seconds after every 50 seconds of running. If he runs for a total duration of 5 minutes (300 seconds), how far will he travel?
(a)
Consider the following C program, what will be the final value of num after executing this program?
(a)
Observe the following C program. If the user inputs the value 5, what will be the output?
0 1 3 4 7 11
0 1 1 2 3
0 1 1 2 3 5
0 1 2 3 5 8
