Practice Assignment: Identify Parts of a Program
Practice Assignment: Identify Parts of a Program
Practice identifying the main parts of a program, including comments, variables, input, processing logic, output, statements, expressions, functions, and the entry point.
Assignment Overview
In this practice assignment, students will learn how to identify the different parts of a program. Before writing large programs, it is important to understand how a program is organized and what each part does.
A program is not just a random collection of instructions. It usually contains a clear structure such as comments, variables, input, processing logic, output, functions, and an entry point from where execution begins.
This assignment is language-neutral. That means the focus is not on one specific programming language, but on the common parts found in most programming languages.
Learning Objectives
After completing this assignment, students will be able to:
Objectives
- Identify comments in a program.
- Identify variables and constants.
- Identify input statements.
- Identify processing or calculation logic.
- Identify output statements.
- Identify expressions and statements.
- Identify functions or reusable blocks of code.
- Identify the entry point of a program.
- Explain the purpose of each program part.
- Understand how different parts work together to solve a problem.
Prerequisites
Before attempting this assignment, students should have basic knowledge of the following topics:
Required Knowledge
- What is programming?
- What is a program?
- Basic program structure.
- Main method or entry point.
- Statements and expressions.
- Keywords and identifiers.
- Comments.
- Variables and data types.
- Input, process, and output model.
- Functions or reusable blocks of code.
- Syntax and semantics.
Assignment Instructions
Read each program carefully and identify its parts. You do not need to write actual code in a specific programming language. You only need to understand what each part of the program represents.
Student Instructions
- Read the given program or pseudocode carefully.
- Identify the comments.
- Identify variables and constants.
- Identify input statements.
- Identify processing or calculation steps.
- Identify output statements.
- Identify expressions and statements.
- Identify functions or reusable blocks.
- Identify the entry point.
- Write a short explanation for each identified part.
Program Parts Reminder
The following table reminds students about the common parts of a program.
| Program Part | Meaning | Example |
|---|---|---|
| Comment | A human-readable note that explains code. | // Calculate total marks. |
| Variable | A named storage location for data. | studentName, totalMarks |
| Constant | A fixed value that should not change. | PASS_MARK = 35 |
| Input | Data received by the program. | INPUT marks |
| Process | Logic or calculation performed on data. | total = price * quantity |
| Output | Result displayed or returned by the program. | DISPLAY total |
| Statement | A complete instruction. | SET age = 18 |
| Expression | A combination that produces a value. | price * quantity |
| Function | A reusable block of code. | calculateTotal() |
| Entry Point | The place where program execution begins. | ENTRY POINT |
Assignment Problems
Complete the following tasks by identifying the different parts of each program.
Problem 1: Identify Parts in a Simple Output Program
// Display a welcome message.
ENTRY POINT
DISPLAY "Welcome to Programming Mastery"
END ENTRY POINT
Student Task
- Identify the comment.
- Identify the entry point.
- Identify the output statement.
- Explain what the program does.
Answer Format
Comment:
Entry Point:
Output Statement:
Program Purpose:
Problem 2: Identify Parts in a Calculation Program
// Calculate total bill amount.
ENTRY POINT
SET price = 100
SET quantity = 3
SET totalAmount = price * quantity
DISPLAY totalAmount
END ENTRY POINT
Student Task
- Identify the comment.
- Identify all variables.
- Identify the expression.
- Identify the processing statement.
- Identify the output statement.
- Explain the purpose of the program.
Problem 3: Identify Input, Process, and Output
ENTRY POINT
INPUT length
INPUT width
SET area = length * width
DISPLAY area
END ENTRY POINT
Student Should Identify
| Part | Student Answer |
|---|---|
| Input | Write the input values used by the program. |
| Process | Write the calculation or logic used by the program. |
| Output | Write the result displayed by the program. |
Problem 4: Identify Condition and Decision Logic
// Check whether a student passes or fails.
ENTRY POINT
INPUT marks
IF marks >= 35 THEN
DISPLAY "Pass"
ELSE
DISPLAY "Fail"
END IF
END ENTRY POINT
Student Task
- Identify the comment.
- Identify the input.
- Identify the condition.
- Identify the decision statement.
- Identify the possible outputs.
- Explain how the program decides Pass or Fail.
Problem 5: Identify Loop Parts
ENTRY POINT
SET counter = 1
WHILE counter <= 5 DO
DISPLAY counter
SET counter = counter + 1
END WHILE
END ENTRY POINT
Student Should Identify
| Loop Part | Meaning |
|---|---|
| Initialization | The starting value of the loop variable. |
| Condition | The rule that decides whether the loop continues. |
| Repeated Statement | The statement that runs again and again. |
| Update | The statement that changes the loop variable. |
Problem 6: Identify Functions and Function Calls
FUNCTION showWelcome
DISPLAY "Welcome to Programming Mastery"
END FUNCTION
FUNCTION calculateTotal
SET price = 100
SET quantity = 3
SET total = price * quantity
RETURN total
END FUNCTION
ENTRY POINT
CALL showWelcome
SET billAmount = CALL calculateTotal
DISPLAY billAmount
END ENTRY POINT
Student Task
- Identify all function definitions.
- Identify all function calls.
- Identify the entry point.
- Identify variables used inside functions.
- Identify returned value.
- Explain the flow of execution.
Problem 7: Identify Parts in a Complete Program
/*
This program calculates total and average marks
of a student.
*/
CONSTANT SUBJECT_COUNT = 3
FUNCTION calculateTotal
SET total = mathMarks + scienceMarks + englishMarks
RETURN total
END FUNCTION
FUNCTION calculateAverage
SET average = totalMarks / SUBJECT_COUNT
RETURN average
END FUNCTION
ENTRY POINT
INPUT studentName
INPUT mathMarks
INPUT scienceMarks
INPUT englishMarks
SET totalMarks = CALL calculateTotal
SET averageMarks = CALL calculateAverage
DISPLAY studentName
DISPLAY totalMarks
DISPLAY averageMarks
END ENTRY POINT
Student Task
- Identify the multi-line comment.
- Identify the constant.
- Identify all functions.
- Identify the entry point.
- Identify all inputs.
- Identify all variables.
- Identify all expressions.
- Identify processing logic.
- Identify all output statements.
- Explain the complete program flow.
Assignment Submission Template
Students can use the following template for each problem.
Problem Number:
Program Purpose:
Comment(s):
Entry Point:
Variables:
Constants:
Input Statement(s):
Processing Statement(s):
Expression(s):
Output Statement(s):
Function Definition(s):
Function Call(s):
Condition(s):
Loop Part(s):
Explanation of Program Flow:
Evaluation Rubric
The assignment can be evaluated using the following rubric.
| Criteria | Marks | Description |
|---|---|---|
| Program Reading | 10 | Student reads and understands the given program correctly. |
| Identifying Basic Parts | 20 | Correctly identifies comments, variables, constants, input, process, and output. |
| Identifying Logic Parts | 20 | Correctly identifies expressions, conditions, loops, and statements. |
| Identifying Functions | 15 | Correctly identifies function definitions, function calls, and return values. |
| Entry Point Understanding | 15 | Correctly identifies where the program starts and how execution flows. |
| Explanation Quality | 10 | Explains the purpose of program parts clearly. |
| Presentation | 10 | Submission is neat, organized, and easy to read. |
Common Mistakes to Avoid
Mistakes
- Confusing variables with values.
- Confusing expressions with statements.
- Missing the entry point.
- Ignoring comments.
- Not identifying function calls.
- Not separating input, process, and output.
- Writing only answers without explanation.
- Assuming every line is the same type of program part.
Better Practice
- Read the whole program first.
- Identify the entry point before tracing flow.
- Mark comments separately.
- Separate variables, constants, input, process, and output.
- Underline expressions inside statements.
- Trace function calls step by step.
- Write short explanations for each part.
- Use the assignment template for clean submission.
Final Submission Checklist
Before submitting, students should check the following:
Checklist
- Have I identified the program purpose?
- Have I identified all comments?
- Have I identified the entry point?
- Have I identified all variables and constants?
- Have I identified input, process, and output?
- Have I identified expressions and statements?
- Have I identified conditions and loops where present?
- Have I identified functions and function calls?
- Have I explained the program flow clearly?
- Have I checked my submission for neatness and completeness?
Sample Solved Example
The following example shows how students should solve one problem.
Given Program
// Calculate total bill.
ENTRY POINT
SET price = 50
SET quantity = 4
SET total = price * quantity
DISPLAY total
END ENTRY POINT
Sample Answer
| Part | Answer |
|---|---|
| Comment | // Calculate total bill. |
| Entry Point | ENTRY POINT to END ENTRY POINT |
| Variables | price, quantity, total |
| Expression | price * quantity |
| Processing Statement | SET total = price * quantity |
| Output Statement | DISPLAY total |
| Program Purpose | The program calculates and displays the total bill amount. |
Mini Quiz
What is the entry point of a program?
The entry point is the place where program execution begins.
What is a variable?
A variable is a named storage location used to store data.
What is an expression?
An expression is a combination of values, variables, and operators that produces a value.
What is an output statement?
An output statement displays or returns the result of a program.
Why should students identify parts of a program?
It helps them understand program structure, execution flow, debugging, and logical problem solving.
Interview Questions on Parts of a Program
What are the common parts of a program?
Common parts include comments, variables, constants, input, process, output, statements, expressions, functions, and entry point.
What is the difference between input and output?
Input is data given to a program, while output is the result produced by the program.
What is the difference between a statement and an expression?
An expression produces a value, while a statement performs a complete instruction.
Why are functions used in programs?
Functions are used to organize code into reusable blocks that perform specific tasks.
Why is program structure important?
Program structure is important because it makes code easier to read, understand, debug, test, and maintain.
Quick Summary
| Program Part | Purpose |
|---|---|
| Comment | Explains code for humans. |
| Variable | Stores data. |
| Constant | Stores fixed data. |
| Input | Accepts data into the program. |
| Process | Performs calculations or logic. |
| Output | Displays or returns result. |
| Statement | Performs a complete instruction. |
| Expression | Produces a value. |
| Function | Groups reusable logic. |
| Entry Point | Starts program execution. |
Final Takeaway
This assignment helps students understand how a program is built from different parts. By identifying comments, variables, constants, input, process, output, expressions, statements, functions, and entry point, students become better at reading code, explaining logic, debugging programs, and writing structured solutions.