CFP Notes
CFP Notes
1|P a g e
INTRODUCTION TO COMPUTER PROGRAMMING 3. Triple ware
Computer Programming - the act of writing 4. Procedure
computer programs.
There are hundreds of programming languages, ALGORITHM
which can be used to write computer programs Algorithm is a step-by-step procedure to resolve
and following are a few of them: any problem. An algorithm is an effective method
▪ Java expressed as a finite set of well-defined
▪ C instructions.
▪ C++
▪ Python A computer programmer lists down all the steps
▪ PHP required to resolve a problem before writing the
▪ Perl actual code. Following is a simple example of an
▪ Ruby algorithm to find out the largest number from a
USES OF COMPUTER PROGRAMS given list of numbers:
Computer programs are being used in almost 1. Get a list of numbers L1, L2, L3....LN
every field, household, agriculture, medical, 2. Assume L1 is the largest, Largest = L1
entertainment, defense, communication, etc. 3. Take next number Li from the list and do the
following
Listed below are a few applications of computer 4. If Largest is less than Li
Programs: 5. Largest = Li
• MS Word, MS Excel, Adobe Photoshop, Internet 6. If Li is last number from the list, then
Explorer, Chrome, etc., are examples of computer 7. Print value stored in Largest and come out
programs. 8. Else repeat same process starting from step 3
• Computer programs are being used to develop
graphics and special effects in movie making. COMPUTER PROGRAMMING - BASICS
• Computer programs are being used to perform English Language, which is a well-known Human
Ultrasounds, X-Rays, and other medical Interface Language. English has a predefined
examinations. grammar, which needs to be followed to write
• Computer programs are being used in our mobile English statements in a correct way. Likewise, most
phones for SMS, Chat, and voice communication. of the Human Interface Languages (Hindi, English,
Spanish, French, etc.) are made of several
COMPUTER PROGRAMMER elements like verbs, nouns, adjectives, adverbs,
Computer Programmer - someone who can write propositions, and conjunctions, etc.
computer programs or in other words, someone
who can do computer programming. Computer Programming Languages are also made
of several elements.
Based on computer programming language These basic elements include:
expertise, we can name a computer programmer • Programming Environment
as follows: • Basic Syntax
▪ C Programmer • Data Types
▪ C++ Programmer • Variables
▪ Java Programmer • Keywords
▪ Python Programmer • Basic Operators
▪ PHP Programmer • Decision Making
▪ Perl Programmer • Loops
▪ Ruby Programmer • Numbers
• Characters
Four Elements of Computer System • Arrays
1. Hardware – It consists of Input Devices, • Strings
Processing Devices, Output Devices and • Functions
Memory Devices. • File I/O
2. Software – It consists of Application Software,
System Software and Programming Software. COMPUTER PROGRAMMING - ENVIRONMENT
Environment Setup is not an element of any
Types of System Software – It consists of Programming Language, it is the first step to be
Operating System, Utility Software and followed before setting on to write a program.
Communication Software.
Environment Setup, it simply implies a base on top So, if you are going to write your program in any
of which we can do our programming. Thus, we such language, which needs compilation like C,
need to have the required software setup, i.e., C++, Java and Pascal, etc., then you will need to
installation on our PC which will be used to write install their compilers before you start
computer programs, compile, and execute them. programming.
For example, if you need to browse Internet, then
you need the following setup on your machine − Interpreter
A working Internet connection to connect Compilers are required in case you are going to
to the Internet write your program in a programming language
A Web browser such as Internet Explorer, that needs to be compiled into binary format
Chrome, Safari, etc. before its execution.
There are other programming languages such as
Similarly, you will need the following setup to start Python, PHP, and Perl, which do not need any
with programming using any programming compilation into binary format, rather an
language. interpreter can be used to read such programs line
A text editor to create computer programs. by line and execute them directly without any
A compiler to compile the programs into further conversion.
binary format.
An interpreter to execute the programs
directly.
Text Editor
A text editor is a software that is used to write
computer programs.
Your Windows machine must have a Notepad,
which can be used to type programs. You can
launch it by following these steps:
Start Icon → All Programs → Accessories →
Notepad → Mouse Click on Notepad
Compiler
You write your computer program using your Online Compilation
favorite programming language and save it in a If you are not able to set up any editor, compiler,
text file called the program file. or interpreter on your machine, then
Actually, the computer cannot understand your tutorialspoint.com provides a facility to compile
program directly given in the text format, so we and run almost all the programs online with an
need to convert this program in a binary format, ease of a single click.
which can be understood by the computer.
The conversion from text program to binary file is UNIT 2: FLOWCHARTING
done by another software called Compiler and this Flowchart is a means of visually presenting the
process of conversion from text formatted flow of data through an information processing
program to binary format file is called program system, the operations performed within the
compilation. system and the sequence in which they are
performed.
The following flow diagram gives an illustration of Program flowchart - describes what operations
the process: (and in what sequence) are required to solve a
given problem. The program flowchart can be
likened to the blueprint of a building.
A A A A A A A
RELATIONAL OR LOGICAL EXPRESSIONS A B AND OR NAND NOR XOR XNOR
B B B B B B
A relational expression is formed by using any of
the following relational operators: 0 0 0 0 1 1 1 0 1
1 0 0 1 0 1 0 1 0
0 1 0 1 1 1 0 1 0
1 1 1 1 0 0 0 0 1
LIBRARY FUNCTIONS IN BASIC
The word `library' stands for collection. In the
context of computer languages, a library is
essentially a collection of useful programs. These
programs are used by the programmers to simplify
their task of program development. These
programs are often referred as subroutines.