0% found this document useful (0 votes)
21 views64 pages

Ict8 Q2 WK3

Uploaded by

zokishivall
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views64 pages

Ict8 Q2 WK3

Uploaded by

zokishivall
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 64

Programming

Introduction to Computer
Programming
After going through this module, you are
expected to:
1. Identify the parts of C programming
language.
2. Make a simple program that shows
student’s
personal information.
3. Appreciate the impact of computer
Pre-Test:

Multiple Choices. Read each item


carefully. Choose the letter of the
correct answer.
1.which of the following is
compiled programming
language?
a. phyton
b. c++
c. java script
d. Ruby
2. Which of the following languages
is known for its use in web
development on both front-end and
back-end?
a. Phyton
b. C#
c. Java Script
d. R
3.Pascal, Python, Java, basic and
C++ are all _______________
a. Computer Program
b. windows software
c. programming language
d. foreign language
4. Computer programming is the act of
writing computer programs, which are a
___________________________ written using a
Human Language to perform a specified
task by the computer.
a. Sequence of Instruction
b. Sequence of Numbers
c. Scientific Method
d. Series of menu
5. A computer A computer program
is also program is also called a
________, which can range from two
lines to millions of lines of
instructions.
a. computer software
b. computer hardware
c. computer techniques
d. computer system
6. Below are examples of
computer programming
languages EXCEPT:
a. C++
b. Python
c. HTML
d. Microsoft Word
7. Which of the statements below are
correct?
a. Computer programs are used to develop
graphics and special effects in movie making.
b. Computer programs are used to perform
Ultrasounds, X-rays, and other medical
examinations.
c. Computer programs are being used in our
mobile phones for SMS, Chat, and voice
communication.
d. All of the above
8. Computer program instructions
are also called__________________.
a. Program Source Code
b. Program Reference
c. Source Information
d. Computer Data
9. Which part of a program is
responsible for executing
statements in sequence?
A) Control flow
B) Data structure
C) Variables
D) Libraries
10. Which of the following is the
entry point of a C program?
A) #include directive
B) main() function
C) return statement
D) printf() function
11. Which of the following is an
advantage of the C programming
language?
A) Object-oriented programming
B) Low-level memory manipulation
C) Automatic garbage collection
D) Extensive built-in libraries for web
development
12. One major disadvantage of C
programming is:
A) Lack of portability
B) Absence of manual memory
management
C) No automatic garbage collection
D) Slow execution speed
13. Who is considered the first
computer programmer, for their
work on Charles Babbage’s
Analytical Engine?
A) Alan Turing
B) Ada Lovelace
C) Grace Hopper
D) John von Neumann
14. Which programming paradigm
emphasizes the use of functions and
procedures to perform tasks?
A) Object-oriented programming
B) Functional programming
C) Imperative programming
D) Logic programming
15. Which of the following languages
is considered an example of a low-
level programming language?
A) Python
B) Java
C) C
D) Assembly language
Answer key
1. C
2. B
3. B
4. B
5. C
6. B
7. A
8. B
9. B
10. B
11. B
12. A
13. B
14. B
15. B
Activity 2: WORD HUNT
ALGORITHMIC AUTOMATED COLLABORATION
DEBUGGING DEVELOPMENT EFFICIENT
INNOVATIVE ITERATIVE
Guide Questions:
1. Identify 10 items in your house that require
coding to function.
2. What are the practical benefits of coding in our
daily life?
3. Can you think of other everyday tasks coding
could help save time or make things more
efficient.
What is Computer Programming?
The process of creating, composing, testing,
and updating the code necessary for
computer programs and applications to run is
known as computer programming. It entails
writing programs, or sets of instructions, that
a computer can use to carry out particular
operations, resolve issues, or handle data.
A programming language is a set of
instructions that lets people communicate
with computers. It uses a set of symbols
as a means of translating human thoughts
into instructions that computers can
comprehend. Every language has a
distinct syntax, structure, vocabulary,
slang, and shortcuts, just like spoken
languages
The "lingua francas" of software
development in the broad digital realm are
programming languages, which enable
global talks between developers and
computers, no matter where they are. They
enable us to use technology to create,
automate, and bring our ideas to life, which
is why their significance goes far beyond
lines of code.
Types of Programming Languages
1. High-level / Low-level
2. Declarative / Imperative / Procedural
3. General-Purpose / Domain-Specific
4. Object-Oriented / Concurrent
5. Command / Complied / Script Language
6. Answer Set
C Programming Language
• C programming language is a general-
purpose, high-level language
• Was originally developed by Dennis M.
Ritchie to develop the UNIX operating
system at Bell Labs.
C Programming Language
• Originally first implemented on the
DEC PDP-11 computer in 1972. In
1978, Brian Kernighan and Dennis
Ritchie produced the first publicly
available description of C, now known
as the K&R standard.
Advantages of C Disadvantages of C
1.Efficiency 1. Complex Syntax
2.Portability 2. No Object-Oriented
3.Rich Library Programming
4.Low-Level Manipulation 3. Manual Memory Management
5.Structured 4. Lack of Exception Handling
5. No Run-Time type checking
Programming
6. Limited standard library
6.Memory Management 7. Pointer usage
7.Legacy codebase 8. Error prone
8.Embedded systems 9. Limited support for modern
9.Data types and programming
Structures
10.Extensibility
Steps in Creating a Simple
Computer Program
1. Define the Problem
- Clearly articulate what you
want your program to do. Identify
the inputs, outputs, and any
specific requirements.
2. Plan the Solution
• Pseudocode: Write pseudocode to
outline the logic and steps of your
program in plain language.
• Flowchart: Optionally, create a
flowchart to visualize the program’s
structure and flow of control.
3. Choose a Programming

Language
• Select a language suitable for
your project. Popular choices
for beginners include Python,
JavaScript, or Java.
4. Set Up the Development Environment
Install the necessary software, such as:
 Text Editor/IDE: Tools like Visual Studio
Code, PyCharm, or Jupyter Notebook for
coding.
 Compiler/Interpreter: Depending on your
chosen language, ensure you have the
appropriate compiler (for languages like
C/C++) or interpreter (for languages like
Python).
5. Write the Code
Start coding based on your
pseudocode or flowchart. Focus on one
part of the program at a time, and
ensure you:
 Declare variables.
 Implement functions or methods.
 Use control structures (loops,
conditionals) to control the flow.
6. Test the Code
- Run your program with different inputs to
check for correctness. Look for:
• Syntax errors: Mistakes in code
structure.
• Logical errors: Errors where the
program runs but doesn’t give the
expected results.
- Debug any issues that arise, using print
statements or debugging tools to identify
problems.
7. Refine and Optimize
 Review your code for efficiency and
clarity. Consider:
• Reducing redundancy.
• Improving variable names for
better readability.
• Adding comments to explain
complex parts of your code.
8. Document the Program
 Write documentation that explains
how to use your program, its
functionality, and any special
features. This can include:
• A README file.
• Inline comments within the
code.
9. Gather Feedback
• If possible, share your program
with others to get feedback. They
may identify areas for
improvement or additional
features.
10. Maintain and Update
• After deployment, continue to
maintain and update your
program as necessary. Fix any
bugs that are reported and
consider adding new features
based on user feedback.
Step four:
Add
additional
details to the
railroad
tracks on the
sides of the
rails.
Step five:
Let’s begin drawing
the railroad station
in one point
perspective. Begin
by drawing a
rectangle. Be sure
to keep the corners
square 90 degree
angles.
Step six:
Draw
two DIAGONAL
lines that
connect to the
vanishing point
to form the sides
of the railroad
station.
Step seven:
Draw a
straight, VERTICA
L line to define
where the wall
ends. Be sure this
line meets at the
horizon line at a
perpendicular/ 90
degree angle.
Step eight:

Add details such


as doors, windows,
roof, etc. Note
which lines are
horizontal, vertical
and/or converging
to the vanishing
point.
Step nine:
Let’s add some
electrical lines!
Lightly draw two
DIAGONAL
guidelines that
converge towards
the vanishing point.
These lines will
define where the top
and bottom of the
Step ten:

Draw VERTICAL
lines to define the
poles. Note how the
poles get thinner,
closer together, and
smaller as they
move towards the
vanishing point.
Step eleven:

To define the
electrical lines, draw
four DIAGONAL lines
that converge to the
vanishing point.
Then, draw
HORIZONTAL lines
for additional details.
Step twelve:

Let’s add some


trees! Begin by
drawing two
DIAGONAL
guidelines which will
help to define the
tops and bottoms of
the trees.
Step thirteen:
Sketch the trees, and a
sidewalk with
DIAGONAL lines.
Note how the organic
lines found in nature do
not need to rigidly follow
the rules of linear
perspective. However,
the trees will still appear
to get smaller, closer
together, and less
detailed as they move
towards the vanishing
Step fourteen:

Take a moment to
clean up your
sketch by erasing
out any lines that
should not remain
visible.
Step sixteen:
Using a tool of
your choice (such
as a pencil for
shading or colored
pencils), begin
finalizing your line
drawing.
Final step:
Add shadows.
The sun is setting
in the middle,
therefore
shadows will be
angled on the
side opposite the
sun.
Concept of Perspective in 2D Drawing
Perspective is a technique used in drawing to
represent three-dimensional objects on a two-
dimensional surface (such as paper) in a way that looks
realistic and mimics how the human eye sees the
world.
It creates the illusion of depth, making objects appear
smaller as they get farther away, and converging
towards a point in the distance, just like in real life.
1. Horizon Line
This represents the viewer's eye level. Everything
in the drawing is positioned relative to this line. Objects
above the horizon line appear to be above eye level,
while those below it appears below eye level

Horizon Line
2. Vanishing Point
A point on the horizon line where parallel lines
(orthogonal lines) appear to converge. This is the focal
point of a perspective drawing and where objects
seem to "disappear" into the distance.
3. Orthogonal Lines
These are lines that lead to the vanishing point. In
perspective drawing, objects are drawn with lines
receding towards the vanishing point to create the
illusion of depth.
Types of Perspective in
2D Drawing
1. 1-Point Perspective
Uses a single vanishing point on the
horizon line. It's often used to depict
objects that are directly facing the viewer,
like looking down a long hallway, street, or
at the front of a building.
Key Elements of
Perspective Drawing

You might also like