SlideShare a Scribd company logo
1 of 59
Download to read offline
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 1/59Chapter 12: Computer LanguagesRef Page
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 2/59Chapter 12: Computer LanguagesRef Page
In this chapter you will learn about:
Ā§ Computer languages or programming languages
Ā§ Three broad categories of programming languages ā€“
machine, assembly, and high-level languages
Ā§ Commonly used programming language tools such as
assembler, compiler, linker, and interpreter
Ā§ Concepts of object-oriented programming languages
Ā§ Some popular programming languages such as
FORTRAN, COBOL, BASIC, Pascal, C, C++, C#, Java,
RPG, LISP and SNOBOL
Ā§ Related concepts such as Subprogram, Characteristics of
a good programming language, and factors to consider
while selecting a language for coding an application
Learning ObjectivesLearning Objectives
208
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 3/59Chapter 12: Computer LanguagesRef Page
Broad Classification of
Computer Languages
Broad Classification of
Computer Languages
Ā§ Machine language
Ā§ Assembly language
Ā§ High-level language
209
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 4/59Chapter 12: Computer LanguagesRef Page
Machine LanguageMachine Language
Ā§ Only language of a computer understood by it
without using a translation program
Ā§ Normally written as strings of binary 1s and 0s
Ā§ Written using decimal digits if the circuitry of
the computer being used permits this
209
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 5/59Chapter 12: Computer LanguagesRef Page
A Typical Machine Language
Instruction Format
A Typical Machine Language
Instruction Format
Ā§ OPCODE tells the computer which operation to perform
from the instruction set of the computer
Ā§ OPERAND tells the address of the data on which the
operation is to be performed
OPCODE
(operation code)
OPERAND
(Address/Location)
210
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 6/59Chapter 12: Computer LanguagesRef Page
A Sample Machine Language ProgramA Sample Machine Language Program
10001471
14002041
30003456
50773456
00000000
001000000000001100111001
001100000000010000100001
011000000000011100101110
101000111111011100101110
000000000000000000000000
In Binary
(Difficult to read and understand)
In Decimal
(Easier to read and understand)
210
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 7/59Chapter 12: Computer LanguagesRef Page
Advantages & Limitations of
Machine Language
Advantages & Limitations of
Machine Language
Advantage
Ā§ Can be executed very fast
Limitations
Ā§ Machine Dependent
Ā§ Difficult to program
Ā§ Error prone
Ā§ Difficult to modify
210
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 8/59Chapter 12: Computer LanguagesRef Page
Assembly/Symbolic LanguageAssembly/Symbolic Language
Ā§ Using alphanumeric mnemonic codes instead of numeric codes for
the instructions in the instruction set
e.g. using ADD instead of 1110 (binary) or 14 (decimal) for
instruction to add
Ā§ Allowing storage locations to be represented in form of alphanumeric
addresses instead of numeric addresses
e.g. representing memory locations 1000, 1001, and 1002 as FRST,
SCND, and ANSR respectively
Ā§ Providing pseudo-instructions that are used for instructing the
system how we want the program to be assembled inside the
computerā€™s memory
e.g. START PROGRAM AT 0000; SET ASIDE AN ADRESS FOR FRST
Programming language that overcomes the limitations of machine
language programming by:
211
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 9/59Chapter 12: Computer LanguagesRef Page
AssemblerAssembler
Ā§ Software that translates as assembly language
program into an equivalent machine language program
of a computer
One-to-one correspondence
(Source Program) (Object Program)
Assembler
Assembly
language
program
Machine
language
program
Input Output
212
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 10/59Chapter 12: Computer LanguagesRef Page
A subset of the set of instructions supported by a computer
Halt, used at the end of program to stop
Clear and add into A register
Add to the contents of A register
Subtract from the contents of A register
Store A register
00
10
14
15
30
HLT
CLA
ADD
SUB
STA
MeaningOpcodeMnemonic
An Example of Assembly
Language Program
An Example of Assembly
Language Program
213
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 11/59Chapter 12: Computer LanguagesRef Page
START PROGRAM AT 0000
START DATA AT 1000
SET ASIDE AN ADDRESS FOR FRST
SET ASIDE AN ADDRESS FOR SCND
SET ASIDE AN ADDRESS FOR ANSR
CLA FRST
ADD SCND
STA ANSR
HLT
Sample assembly language program for adding two numbers and
storing the result
An Example of Assembly
Language Program
An Example of Assembly
Language Program
213
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 12/59Chapter 12: Computer LanguagesRef Page
1000
1001
1002
FRST
SCND
ANSR
Memory locationSymbolic name
Mapping table set up by the assembler for the data items
of the assembly language program
An Example of Assembly
Language Program
An Example of Assembly
Language Program
213
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 13/59Chapter 12: Computer LanguagesRef Page
An Example of Assembly
Language Program
An Example of Assembly
Language Program
Equivalent machine language program for the assembly language program
AddressOpcode
1000
1001
1002
Clear and add the number stored at FRST to A register
Add the number stored at SCND to the contents of A
register
Store the contents of A register into ANSR
Halt
Reserved for FRST
Reserved for SCND
Reserved for ANSR
10
14
30
00
0000
0001
0002
0003
-
-
-
1000
1001
1002
CommentsContentsMemory
location
214
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 14/59Chapter 12: Computer LanguagesRef Page
Advantages of Assembly Language
Over Machine Language
Advantages of Assembly Language
Over Machine Language
Ā§ Easier to understand and use
Ā§ Easier to locate and correct errors
Ā§ Easier to modify
Ā§ No worry about addresses
Ā§ Easily relocatable
Ā§ Efficiency of machine language
214
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 15/59Chapter 12: Computer LanguagesRef Page
Limitations of Assembly LanguageLimitations of Assembly Language
Ā§ Machine dependent
Ā§ Knowledge of hardware required
Ā§ Machine level coding
215
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 16/59Chapter 12: Computer LanguagesRef Page
Ā§ Mainly used today to fine-tune important parts of
programs written in a high-level language to improve
the programā€™s execution efficiency
Typical Uses of Assembly LanguageTypical Uses of Assembly Language
215
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 17/59Chapter 12: Computer LanguagesRef Page
Assembly Languages with
Macro Instructions
Assembly Languages with
Macro Instructions
Ā§ Any assembly language instruction that gets translated
into several machine language instructions is called a
macro instruction
Ā§ Several assembly languages support such macro
instructions to speed up the coding process
Ā§ Assemblers of such assembly languages are designed to
produce multiple machine language instructions for each
macro instruction of the assembly language
215
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 18/59Chapter 12: Computer LanguagesRef Page
High-Level LanguagesHigh-Level Languages
Ā§ Machine independent
Ā§ Do not require programmers to know anything about the
internal structure of computer on which high-level
language programs will be executed
Ā§ Deal with high-level coding, enabling the programmers
to write instructions using English words and familiar
mathematical symbols and expressions
216
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 19/59Chapter 12: Computer LanguagesRef Page
Ā§ Translator program (software) that translates a high-
level language program into its equivalent machine
language program
Ā§ Compiles a set of machine language instructions for
every program instruction in a high-level language
CompilerCompiler
217
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 20/59Chapter 12: Computer LanguagesRef Page
One-to-many correspondence
(Source
Program)
(Object
Program)
Compiler
High-level
language
program
Machine
language
program
Input Output
CompilerCompiler
217
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 21/59Chapter 12: Computer LanguagesRef Page
Illustrating the requirement of a separate compiler for each
high-level language supported by a computer
A computer supporting languages L1 and L2
Program P1 in
high-level
language L1
Program P2 in
high-level
language L2
Machine code
for P1
Machine code
for P2
Compiler for
language L1
Compiler for
language L2
CompilerCompiler
(Continued on next slide)
218
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 22/59Chapter 12: Computer LanguagesRef Page
Illustrating the machine independence characteristic of a
high-level language. Separate compilers are required for the
same language on different computers
Compiler for
language L1
on computer A
Program P1 in high-
level language L1
Machine code for
P1 that will run
on computer A
Executed on
computer A
Compiler for
language L1
on computer B
Machine code for
P1 that will run on
computer B
Executed on
computer B
Same results
obtained
CompilerCompiler
(Continued from previous slide..)
218
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 23/59Chapter 12: Computer LanguagesRef Page
Syntax ErrorsSyntax Errors
In addition to doing translation job, compilers also
automatically detect and indicate syntax errors
Syntax errors are typically of following types:
Note : A compiler cannot detect logic errors in a program
Ā§ Illegal characters
Ā§ Illegal combination of characters
Ā§ Improper sequencing of instructions in a program
Ā§ Use of undefined variable names
219
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 24/59Chapter 12: Computer LanguagesRef Page
START
Edit
source program
Syntax
errors
detected?
Yes
Compile
source program
Source program
Generate list of coded
error messages
Generate
object program
Object program
STOP
No
The Process of Removing Syntax Errors
From A Source Program
The Process of Removing Syntax Errors
From A Source Program
219
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 25/59Chapter 12: Computer LanguagesRef Page
Ā§ For a large software, storing all the lines of program
code in a single source file will be:
Ā§ Hence, a modular approach is generally adapted to
develop large software where the software consists of
multiple source program files
Ā§ No need to write programs for some modules as it might
be available in library offering the same functionality
ā€“ Difficult to work with
ā€“ Difficult to deploy multiple programmers to
concurrently work towards its development
ā€“ Any change in the source program would require the
entire source program to be recompiled
LinkerLinker
(Continued on next slide)
219
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 26/59Chapter 12: Computer LanguagesRef Page
LinkerLinker
Ā§ Each source program file can be independently
modified and compiled to create a corresponding
object program file
Ā§ Linker program (software) is used to properly
combine all the object program files (modules)
Ā§ Creates the final executable program (load module)
(Continued from previous slide..)
220
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 27/59Chapter 12: Computer LanguagesRef Page
Ā§ Interpreter is a high-level language translator
Ā§ Takes one statement of a high-level language
program, translates it into machine language
instructions
Ā§ Immediately executes the resulting machine language
instructions
Ā§ Compiler simply translates the entire source program
into an object program and is not involved in its
execution
InterpreterInterpreter
220
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 28/59Chapter 12: Computer LanguagesRef Page
Interpreter
(translates and
executes
statement-by-
statement)
High-level language
program
(Source Program)
Result of
program
execution
Input Output
Role of an InterpreterRole of an Interpreter
220
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 29/59Chapter 12: Computer LanguagesRef Page
Intermediate Language Compiler &
Interpreter
Intermediate Language Compiler &
Interpreter
Ā§ New type of compiler and interpreter combines the
speed, ease, and control of both compiler and
interpreter
Ā§ Compiler first compiles the source program to an
intermediate object program
Ā§ Intermediate object program is not a machine
language code but written in an intermediate
language that is virtually machine independent
Ā§ Interpreter takes intermediate object program,
converts it into machine language program and
executes it
221
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 30/59Chapter 12: Computer LanguagesRef Page
Benefits of Intermediate Language
Compiler & Interpreter
Benefits of Intermediate Language
Compiler & Interpreter
Ā§ Intermediate object program is in compiled form and thus is
not original source code, so safer and easier to share
Ā§ Intermediate object program is based on a standard
Intermediate Definition Language (IDL)
Ā§ Interpreter can be written for any computer architecture and
operating system providing virtual machine environment to the
executing program
Ā§ Newer Interpreter compiles intermediate program, in memory,
into final host machine language program and executes it
Ā§ This technique is called Just-In-Time (JIT) Compilation
221
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 31/59Chapter 12: Computer LanguagesRef Page
Advantages of High-Level LanguagesAdvantages of High-Level Languages
Ā§ Machine independent
Ā§ Easier to learn and use
Ā§ Fewer errors during program development
Ā§ Lower program preparation cost
Ā§ Better documentation
Ā§ Easier to maintain
222
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 32/59Chapter 12: Computer LanguagesRef Page
Limitations of High-Level LanguagesLimitations of High-Level Languages
Ā§ Lower execution efficiency
Ā§ Less flexibility to control the computerā€™s CPU, memory
and registers
222
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 33/59Chapter 12: Computer LanguagesRef Page
Object-Oriented Programming LanguagesObject-Oriented Programming Languages
Ā§ Programming languages are used for simulating real-
world problems on computers
Ā§ Much of the real world is made up of objects
Ā§ Essence of OOP is to solve a problem by:
Ā§ Identifying the real-world objects of the problem
Ā§ Identifying processing required of them
Ā§ Creating simulations of objects, processes, and their
communications
223
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 34/59Chapter 12: Computer LanguagesRef Page
Ā§ Stands for FORmula TRANslation
Ā§ Originally developed by John Backus and his team at
IBM followed by several revisions
Ā§ Standardized by ANSI as FORTRAN-77 and FORTRAN-90
Ā§ Designed for solving scientific & engineering problems
Ā§ Oriented towards solving problems of a mathematical
nature
Ā§ Popular language amongst scientists and engineers
FORTRANFORTRAN
223
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 35/59Chapter 12: Computer LanguagesRef Page
C FORTRAN PROGRAM TO COMPUTE
C THE SUM OF 10 NUMBERS
SUM = 0
DO 50 I = 1, 10
READ (5, 10) N
SUM = SUM + N
50 CONTINUE
WRITE (6, 20) SUM
10 FORMAT (F6.2)
20 FORMAT (1X, ā€™THE SUM OF GIVEN NUMBERS = ā€™,
F10.2)
STOP
END
A Sample FORTRAN ProgramA Sample FORTRAN Program
224
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 36/59Chapter 12: Computer LanguagesRef Page
Ā§ Stands for COmmon Business Oriented Language
Ā§ Originally developed started under Grace Hopper
followed by COnference on DAta SYstems Languages
(CODASYL)
Ā§ Standardized by ANSI as COBOL-74, COBOL-85, and
COBOL-2002
Ā§ Designed for programming business data processing
applications
Ā§ Designed to have the appearance and structure of a
business report written in English, hence often referred
to as a self-documenting language
COBOLCOBOL
224
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 37/59Chapter 12: Computer LanguagesRef Page
IDENTIFICATION DIVISION.
PROGRAM_ID. SUMUP.
AUTHOR. P K SINHA.
* THIS PROGRAM COMPUTES AND PRINTS
* THE SUM OF GIVEN NUMBERS.
ENVIROMENT DIVISION.
CONFIGURATION SECTION.
SOURCE_COMPUTER. BURROUGHS_6700.
OBJECT_COMPUTER. BURROUGHS_6700.
INPUT_OUTPUT SECTION.
FILE_CONTROL.
SELECT DATA_FILE ASSIGN TO DISK.
SELECT OUTPUT_FILE ASSIGN TO PRINTER.
DATA DIVISION.
FILE SECTION.
A Sample COBOL ProgramA Sample COBOL Program
(Continued on next slide)
226
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 38/59Chapter 12: Computer LanguagesRef Page
FD DATA_FILE
RECORD CONTAINS 80 CHARACTERS
LABEL RECORD IS OMITTED
DATA RECORD IS INPUT_DATA_
RECORD.
01 INPUT_DATA_RECORD.
05 NPICTURE 9(6)V99.
05 FILLER PICTURE X(72).
FD OUTPUT_FILE
RECORD CONTAINS 132 CHARACTERS
LABEL RECORD IS OMITTED
DATA RECORD IS OUTPUT_RECORD.
A Sample COBOL ProgramA Sample COBOL Program
(Continued from previous slide..)
(Continued on next slide)
226
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 39/59Chapter 12: Computer LanguagesRef Page
01 OUTPUT_RECORD.
05 FILLER PICTURE X.
05TITLE PICTURE X(25).
05 SUM PICTURE 9(10)V99.
05 FILLER PICTURE X(94).
WORKING_STORAGE SECTION.
77MESSAGE PICTURE X(25)
VALUE IS ā€œTHE SUM OF GIVEN NUMBERS=ā€.
PROCEDURE DIVISION.
OPEN_FILES.
OPEN INPUT DATA_FILE.
OPEN OUTPUT OUTPUT_FILE.
INITIALIZATION.
MOVE SPACES TO OUTPUT_RECORD.
MOVE ZERO TO SUM.
A Sample COBOL ProgramA Sample COBOL Program
(Continued from previous slide..)
(Continued on next slide)
226
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 40/59Chapter 12: Computer LanguagesRef Page
PROCESS_LOOP.
READ DATA_FILE AT END GO TO
PRINT_PARA.
ADD N TO SUM.
GO TO PROCESS_LOOP.
PRINT_PARA.
MOVE MESSAGE TO TITLE.
WRITE OUTPUT_RECORD.
END_OF_JOB.
CLOSE DATA_FILE.
CLOSE OUTPUT_FILE.
STOP RUN.
A Sample COBOL ProgramA Sample COBOL Program
(Continued from previous slide..)
226
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 41/59Chapter 12: Computer LanguagesRef Page
Ā§ Stands for Beginners All-purpose Symbolic Instruction
Code
Ā§ Developed by Professor John Kemeny and Thomas Kurtz
at Darmouth College in the United States
Ā§ Standardized by ANSI as BASIC-78
Ā§ Designed to be an interactive language and to use an
interpreter instead of a compiler
Ā§ Simple to implement, learn and use language. Hence, it
is a widely used language on personal computers
Ā§ Flexible and reasonably powerful language and can be
used for both business and scientific applications
BASICBASIC
227
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 42/59Chapter 12: Computer LanguagesRef Page
5 REM PROGRAM TO COMPUTE
6 REM THE SUM OF 10 NUMBERS
10 LET S = 0
20 FOR I = 1 TO 10
30 READ N
40 LET S = S + N
50 NEXT I
60 PRINT ā€œTHE SUM OF GIVEN NUMBERS = ā€; S
70 DATA 4, 20, 15, 32, 48
80 DATA 12, 3, 9, 14, 44
90 END;
A Sample BASIC ProgramA Sample BASIC Program
227
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 43/59Chapter 12: Computer LanguagesRef Page
Ā§ Named after the famous seventeenth-century French
mathematician Blaise Pascal
Ā§ Developed by Professor Nicklaus Wirth of Federal Institute of
Technology in Zurich
Ā§ Encourages programmers to write well-structured, modular
programs, instills good program practices
Ā§ Recognized as an educational language and is used to teach
programming to beginners
Ā§ Suitable for both scientific & business applications
Ā§ Has features to manipulate numbers, vectors, matrices,
strings, sets, records, files, and lists
PascalPascal
228
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 44/59Chapter 12: Computer LanguagesRef Page
PROGRAM SUMNUMS (INPUT, OUTPUT);
(* PROGRAM TO COMPUTE THE SUM OF 10 NUMBERS *)
(* DECLARATION OF VARIABLES *)
VAR SUM, N : REAL;
VAR I : INTEGER;
(* MAIN PROGRAM LOGIC STARTS HERE *)
BEGIN
SUM := 0;
FOR I := 1 TO 10 DO
BEGIN
READ (N);
SUM := SUM + N;
END;
WRITELN (ā€˜THE SUM OF GIVEN NUMBERS=ā€™, SUM);
END;
A Sample Pascal ProgramA Sample Pascal Program
228
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 45/59Chapter 12: Computer LanguagesRef Page
CC
Ā§ Developed in 1972 at AT&Tā€™s Bell laboratories, USA
by Dennis Ritchie and Brian Kernighan
Ā§ Standardized by ANSI and ISO as C89, C90, C99
Ā§ High-level programming languages (mainly machine
independence) with the efficiency of an assembly
language
Ā§ Language of choice of programmers for portable
systems software and commercial software packages
like OS, compiler, spreadsheet, word processor, and
database management systems
229
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 46/59Chapter 12: Computer LanguagesRef Page
/* PROGRAM TO COMPUTE THE SUM OF 10 NUMBERS */
/* Directives to include standard library and header */
#include <stdlib.h>
#include <stdio.h>
/* Main function starts here */
void main ( )
{
/* Declaration of variables */
float Sum = 0.0, N = 0.0;
int Count = 0;
for (Count = 0; Count < 10; Count++)
{
printf(ā€œnGive a number:ā€);
scanf(ā€œ%fā€, N);
Sum += N;
}
printf(ā€œTHE SUM OF GIVEN NUMBERS = %fā€, &Sum);
}
A Sample C ProgramA Sample C Program
230
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 47/59Chapter 12: Computer LanguagesRef Page
C++C++
Ā§ Named C++ as ++ is increment operator and C
language is incremented to its next level with C++
Ā§ Developed by Bjarne Stroustrup at Bell Labs in the
early 1980s
Ā§ Contains all elements of the basic C language
Ā§ Expanded to include numerous object-oriented
programming features
Ā§ Provides a collection of predefined classes, along with
the capability of user-defined classes
229
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 48/59Chapter 12: Computer LanguagesRef Page
JavaJava
Ā§ Development started at Sun Microsystems in 1991 by a
team led by James Gosling
Ā§ Developed to be similar to C++ with fewer features to
keep it simple and easy to use
Ā§ Compiled code is machine-independent and developed
programs are simple to implement and use
Ā§ Uses just-in-time compilation
Ā§ Used in embedded systems such as hand-held devices,
telephones and VCRs
Ā§ Comes in two variants ā€“ Java Runtime Engine (JRE) and
Java Software Development Kit (SDK)
231
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 49/59Chapter 12: Computer LanguagesRef Page
C# (C Sharp)C# (C Sharp)
Ā§ Object-oriented programming language developed by
Anders Hejlsberg and released by Microsoft as part of
Microsoftā€™s .NET technology initiative
Ā§ Standardized by ECMA and ISO
Ā§ Syntactically and semantically very close to C++ and
adopts various object-oriented features from both C++
and Java
Ā§ Compilers target the Common Language Infrastructure
(CLI) implemented by Common Language Runtime (CLR)
of .NET Framework
Ā§ CLR provides important services such as, memory
management, exception handling, and security
232
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 50/59Chapter 12: Computer LanguagesRef Page
RPGRPG
Ā§ Stands for Report Program Generator
Ā§ Developed by IBM to meet customer requests for an
easy and economic mechanism for producing reports
Ā§ Designed to generate the output reports resulting from
the processing of common business applications
Ā§ Easier to learn and use as compared to COBOL
Ā§ Programmers use very detailed coding sheets to write
specifications about input, calculations, and output
232
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 51/59Chapter 12: Computer LanguagesRef Page
LISPLISP
Ā§ Stands for LISt Processing
Ā§ Developed in 1959 by John McCarthy of MIT
Ā§ Designed to have features for manipulating non-
numeric data, such as symbols and strings of text
Ā§ Due to its powerful list processing capability, it is
extensively used in the areas of pattern recognition,
artificial intelligence, and for simulation of games
Ā§ Functional programming language in which all
computation is accomplished by applying functions to
arguments
232
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 52/59Chapter 12: Computer LanguagesRef Page
SNOBOLSNOBOL
Ā§ Stands for StriNg Oriented symBOlic Language
Ā§ Used for non-numeric applications
Ā§ Powerful string manipulation features
Ā§ Widely used for applications in the area of text
processing
233
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 53/59Chapter 12: Computer LanguagesRef Page
Characteristics of a Good
Programming Language
Characteristics of a Good
Programming Language
Ā§ Simplicity
Ā§ Naturalness
Ā§ Abstraction
Ā§ Efficiency
Ā§ Structured Programming Support
Ā§ Compactness
Ā§ Locality
Ā§ Extensibility
Ā§ Suitability to its environment
233
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 54/59Chapter 12: Computer LanguagesRef Page
Factors for Selecting a Language for
Coding an Application
Factors for Selecting a Language for
Coding an Application
Ā§ Nature of the application
Ā§ Familiarity with the language
Ā§ Ease of learning the language
Ā§ Availability of program development tools
Ā§ Execution efficiency
Ā§ Features of a good programming language
234
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 55/59Chapter 12: Computer LanguagesRef Page
SubprogramSubprogram
Ā§ Program written in a manner that it can be brought into
use in other programs and used whenever needed
without rewriting
Ā§ Also referred to as subroutine, sub-procedure, or function
Ā§ Subprogram call statement contains the name of the
subprogram followed by a list of parameters enclosed
within a pair of parentheses
Ā§ Intrinsic subprograms (also called built-in-functions) are
those provided with the programming language
Ā§ Programmer-written subprograms are written and used
as and when they are needed
235
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 56/59Chapter 12: Computer LanguagesRef Page
sqrt (x)
Set of instructions that perform
the intended task
Subprogram name Parameter
Subprogram header
Subprogram body
Structure of a SubprogramStructure of a Subprogram
235
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 57/59Chapter 12: Computer LanguagesRef Page
A program that calls
the subprogram twice
subprogram header
subprogram body
subprogram call statement
next statement
subprogram call statement
next statement
A subprogram Flow of control
1
3
7
2
6 4
5
8
9
Flow of Control in Case of Subprogram CallsFlow of Control in Case of Subprogram Calls
236
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 58/59Chapter 12: Computer LanguagesRef Page
Key Words/PhrasesKey Words/Phrases
Ā§ Assembler
Ā§ Assembly language
Ā§ BASIC
Ā§ Built-in function
Ā§ C
Ā§ C++
Ā§ C#
Ā§ COBOL
Ā§ Coding
Ā§ Compiler
Ā§ Computer language
Ā§ FORTRAN
Ā§ Function
Ā§ High-level language
Ā§ HotJava Interpreter
Ā§ Intrinsic subprogram
Ā§ Intermediate compiler and
Interpreter
Ā§ Java
Ā§ Just-in-time compilation
Ā§ Language processor
Ā§ Linker
Ā§ LISP
Ā§ Load module
Ā§ Logic error
Ā§ Low-level language
Ā§ Machine language
Ā§ Macro instructions
Ā§ Object program
Ā§ Object-oriented programming
Ā§ Opcode
Ā§ Operand
Ā§ Pascal
Ā§ Programmer
Ā§ Programming
Ā§ Programming language
Ā§ Pseudo instruction
Ā§ RPG
Ā§ Self-documenting language
(Continued on next slide)
236
Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha
Slide 59/59Chapter 12: Computer LanguagesRef Page
Ā§ SNOBOL
Ā§ Source program
Ā§ Sub-procedure
Ā§ Subprogram
Ā§ Subroutine
Ā§ Symbolic language
Ā§ Syntax error
Ā§ Syntax rules
Ā§ Written subprograms
Key Words/PhrasesKey Words/Phrases
(Continued from previous slide..)
236

More Related Content

What's hot

Computer Fundamentals Chapter 16 bdp
Computer Fundamentals Chapter 16 bdpComputer Fundamentals Chapter 16 bdp
Computer Fundamentals Chapter 16 bdpSaumya Sahu
Ā 
Computer Fundamentals Chapter 07 pam
Computer Fundamentals Chapter  07 pamComputer Fundamentals Chapter  07 pam
Computer Fundamentals Chapter 07 pamSaumya Sahu
Ā 
Chapter 07 pam 2o-p
Chapter 07 pam 2o-pChapter 07 pam 2o-p
Chapter 07 pam 2o-pIIUI
Ā 
Chapter 07 pam 3o-p
Chapter 07 pam 3o-pChapter 07 pam 3o-p
Chapter 07 pam 3o-pIIUI
Ā 
Chapter 09 io devices
Chapter 09 io devicesChapter 09 io devices
Chapter 09 io devicessumatipuri
Ā 
Computer Fundamentals Chapter 11 pcp
Computer Fundamentals Chapter 11 pcpComputer Fundamentals Chapter 11 pcp
Computer Fundamentals Chapter 11 pcpSaumya Sahu
Ā 
Computer Fundamentals Chapter 14 os
Computer Fundamentals Chapter 14 osComputer Fundamentals Chapter 14 os
Computer Fundamentals Chapter 14 osSaumya Sahu
Ā 
Computer Fundamentals
Computer FundamentalsComputer Fundamentals
Computer FundamentalsSaumya Sahu
Ā 

What's hot (8)

Computer Fundamentals Chapter 16 bdp
Computer Fundamentals Chapter 16 bdpComputer Fundamentals Chapter 16 bdp
Computer Fundamentals Chapter 16 bdp
Ā 
Computer Fundamentals Chapter 07 pam
Computer Fundamentals Chapter  07 pamComputer Fundamentals Chapter  07 pam
Computer Fundamentals Chapter 07 pam
Ā 
Chapter 07 pam 2o-p
Chapter 07 pam 2o-pChapter 07 pam 2o-p
Chapter 07 pam 2o-p
Ā 
Chapter 07 pam 3o-p
Chapter 07 pam 3o-pChapter 07 pam 3o-p
Chapter 07 pam 3o-p
Ā 
Chapter 09 io devices
Chapter 09 io devicesChapter 09 io devices
Chapter 09 io devices
Ā 
Computer Fundamentals Chapter 11 pcp
Computer Fundamentals Chapter 11 pcpComputer Fundamentals Chapter 11 pcp
Computer Fundamentals Chapter 11 pcp
Ā 
Computer Fundamentals Chapter 14 os
Computer Fundamentals Chapter 14 osComputer Fundamentals Chapter 14 os
Computer Fundamentals Chapter 14 os
Ā 
Computer Fundamentals
Computer FundamentalsComputer Fundamentals
Computer Fundamentals
Ā 

Viewers also liked

The Tanning of America: How Hip-hop Created a Culture That Rewrote the Rules ...
The Tanning of America: How Hip-hop Created a Culture That Rewrote the Rules ...The Tanning of America: How Hip-hop Created a Culture That Rewrote the Rules ...
The Tanning of America: How Hip-hop Created a Culture That Rewrote the Rules ...Sebastiano Mereu
Ā 
Iamthe point
Iamthe pointIamthe point
Iamthe pointcandacewade
Ā 
Allen Waiters case study 2
Allen Waiters case study 2Allen Waiters case study 2
Allen Waiters case study 2Allen K. Waiters
Ā 
Legacy Software to Cloud Progression - Part 1
Legacy Software to Cloud Progression - Part 1Legacy Software to Cloud Progression - Part 1
Legacy Software to Cloud Progression - Part 1Dreamztech Solutions
Ā 
Rap and hip hop within todayā€™s popular culture
Rap and hip hop within todayā€™s popular cultureRap and hip hop within todayā€™s popular culture
Rap and hip hop within todayā€™s popular cultureSarah Keefe
Ā 
Contoh rph reka bentuk dan teknologi tahun 5 ver 1
Contoh rph reka bentuk dan teknologi tahun 5 ver 1Contoh rph reka bentuk dan teknologi tahun 5 ver 1
Contoh rph reka bentuk dan teknologi tahun 5 ver 1FADLILA
Ā 
RPH KSSR BM THN.5
RPH KSSR BM THN.5RPH KSSR BM THN.5
RPH KSSR BM THN.5Airun Pureluv
Ā 
All you need to know about Implementing and Managing Change - "The People Fac...
All you need to know about Implementing and Managing Change - "The People Fac...All you need to know about Implementing and Managing Change - "The People Fac...
All you need to know about Implementing and Managing Change - "The People Fac...George Vorster
Ā 

Viewers also liked (14)

The Tanning of America: How Hip-hop Created a Culture That Rewrote the Rules ...
The Tanning of America: How Hip-hop Created a Culture That Rewrote the Rules ...The Tanning of America: How Hip-hop Created a Culture That Rewrote the Rules ...
The Tanning of America: How Hip-hop Created a Culture That Rewrote the Rules ...
Ā 
Iamthe point
Iamthe pointIamthe point
Iamthe point
Ā 
Abstract Ma Thesis
Abstract Ma ThesisAbstract Ma Thesis
Abstract Ma Thesis
Ā 
Allen Waiters case study 2
Allen Waiters case study 2Allen Waiters case study 2
Allen Waiters case study 2
Ā 
Legacy Software to Cloud Progression - Part 1
Legacy Software to Cloud Progression - Part 1Legacy Software to Cloud Progression - Part 1
Legacy Software to Cloud Progression - Part 1
Ā 
Common Programming Errors
Common Programming ErrorsCommon Programming Errors
Common Programming Errors
Ā 
2008 Buick Lucerne Columbia South Carolina
2008 Buick Lucerne Columbia South Carolina2008 Buick Lucerne Columbia South Carolina
2008 Buick Lucerne Columbia South Carolina
Ā 
CSC Leadership Programme-Speaker
CSC Leadership Programme-SpeakerCSC Leadership Programme-Speaker
CSC Leadership Programme-Speaker
Ā 
Rap and hip hop within todayā€™s popular culture
Rap and hip hop within todayā€™s popular cultureRap and hip hop within todayā€™s popular culture
Rap and hip hop within todayā€™s popular culture
Ā 
Contoh rph reka bentuk dan teknologi tahun 5 ver 1
Contoh rph reka bentuk dan teknologi tahun 5 ver 1Contoh rph reka bentuk dan teknologi tahun 5 ver 1
Contoh rph reka bentuk dan teknologi tahun 5 ver 1
Ā 
Workshop on the Strategic Planning Model
 Workshop on the Strategic Planning Model Workshop on the Strategic Planning Model
Workshop on the Strategic Planning Model
Ā 
RPH KSSR BM THN.5
RPH KSSR BM THN.5RPH KSSR BM THN.5
RPH KSSR BM THN.5
Ā 
Methods of Gene Transfer
Methods of Gene TransferMethods of Gene Transfer
Methods of Gene Transfer
Ā 
All you need to know about Implementing and Managing Change - "The People Fac...
All you need to know about Implementing and Managing Change - "The People Fac...All you need to know about Implementing and Managing Change - "The People Fac...
All you need to know about Implementing and Managing Change - "The People Fac...
Ā 

Similar to Computer Fundamentals: Programming Languages Guide

Chapter 10 cs
Chapter 10 csChapter 10 cs
Chapter 10 csHareem Aslam
Ā 
Chapter06 computer software
Chapter06   computer softwareChapter06   computer software
Chapter06 computer softwareAinuddin Yousufzai
Ā 
Chapter 10 cs 2o-p
Chapter 10 cs 2o-pChapter 10 cs 2o-p
Chapter 10 cs 2o-pIIUI
Ā 
Programming in c
Programming in cProgramming in c
Programming in cindra Kishor
Ā 
Software
SoftwareSoftware
SoftwareIIUI
Ā 
Software Introduction
Software IntroductionSoftware Introduction
Software IntroductionIIUI
Ā 
C Course material
C Course materialC Course material
C Course materialFareed Khan
Ā 
High Level Language (HLL)
High Level Language (HLL)High Level Language (HLL)
High Level Language (HLL)Maliha Jahan
Ā 
4.LanguageProcessors and language Processing Activities.pdf
4.LanguageProcessors and language Processing Activities.pdf4.LanguageProcessors and language Processing Activities.pdf
4.LanguageProcessors and language Processing Activities.pdfSwapnaliPawar27
Ā 
Introduction to c language
Introduction to c language Introduction to c language
Introduction to c language BAKRANIYA KALPESH
Ā 
Chowtodoprogram solutions
Chowtodoprogram solutionsChowtodoprogram solutions
Chowtodoprogram solutionsMusa GĆ¼rbĆ¼z
Ā 
Fundamental of Information Technology - UNIT 7
Fundamental of Information Technology - UNIT 7Fundamental of Information Technology - UNIT 7
Fundamental of Information Technology - UNIT 7Shipra Swati
Ā 
Introduction to Computer
Introduction to ComputerIntroduction to Computer
Introduction to Computerzaheeriqbal41
Ā 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and developmentAli Raza
Ā 
A Research Study of Data Collection and Analysis of Semantics of Programming ...
A Research Study of Data Collection and Analysis of Semantics of Programming ...A Research Study of Data Collection and Analysis of Semantics of Programming ...
A Research Study of Data Collection and Analysis of Semantics of Programming ...IRJET Journal
Ā 
Trend of Visual Programming Language
Trend of Visual Programming LanguageTrend of Visual Programming Language
Trend of Visual Programming LanguageTeddy Marcus
Ā 
Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2Mohd Harris Ahmad Jaal
Ā 

Similar to Computer Fundamentals: Programming Languages Guide (20)

Chapter 10 cs
Chapter 10 csChapter 10 cs
Chapter 10 cs
Ā 
Chapter06 computer software
Chapter06   computer softwareChapter06   computer software
Chapter06 computer software
Ā 
Chapter 10 cs 2o-p
Chapter 10 cs 2o-pChapter 10 cs 2o-p
Chapter 10 cs 2o-p
Ā 
Programming in c
Programming in cProgramming in c
Programming in c
Ā 
Software
SoftwareSoftware
Software
Ā 
Software Introduction
Software IntroductionSoftware Introduction
Software Introduction
Ā 
C Course material
C Course materialC Course material
C Course material
Ā 
High Level Language (HLL)
High Level Language (HLL)High Level Language (HLL)
High Level Language (HLL)
Ā 
01-BasicConcepts__.ppt
01-BasicConcepts__.ppt01-BasicConcepts__.ppt
01-BasicConcepts__.ppt
Ā 
4.LanguageProcessors and language Processing Activities.pdf
4.LanguageProcessors and language Processing Activities.pdf4.LanguageProcessors and language Processing Activities.pdf
4.LanguageProcessors and language Processing Activities.pdf
Ā 
Introduction to c language
Introduction to c language Introduction to c language
Introduction to c language
Ā 
Chowtodoprogram solutions
Chowtodoprogram solutionsChowtodoprogram solutions
Chowtodoprogram solutions
Ā 
Fundamental of Information Technology - UNIT 7
Fundamental of Information Technology - UNIT 7Fundamental of Information Technology - UNIT 7
Fundamental of Information Technology - UNIT 7
Ā 
Introduction to Computer
Introduction to ComputerIntroduction to Computer
Introduction to Computer
Ā 
INTRO.pptx
INTRO.pptxINTRO.pptx
INTRO.pptx
Ā 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and development
Ā 
A Research Study of Data Collection and Analysis of Semantics of Programming ...
A Research Study of Data Collection and Analysis of Semantics of Programming ...A Research Study of Data Collection and Analysis of Semantics of Programming ...
A Research Study of Data Collection and Analysis of Semantics of Programming ...
Ā 
Trend of Visual Programming Language
Trend of Visual Programming LanguageTrend of Visual Programming Language
Trend of Visual Programming Language
Ā 
Introduction of C Programming
Introduction of C ProgrammingIntroduction of C Programming
Introduction of C Programming
Ā 
Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2
Ā 

More from Hareem Aslam

Chapter 1 Basic Concepts
Chapter 1 Basic ConceptsChapter 1 Basic Concepts
Chapter 1 Basic ConceptsHareem Aslam
Ā 
Solution Manual : Chapter - 07 Exponential, Logarithmic and Inverse Trigonome...
Solution Manual : Chapter - 07 Exponential, Logarithmic and Inverse Trigonome...Solution Manual : Chapter - 07 Exponential, Logarithmic and Inverse Trigonome...
Solution Manual : Chapter - 07 Exponential, Logarithmic and Inverse Trigonome...Hareem Aslam
Ā 
Solution Manual : Chapter - 06 Application of the Definite Integral in Geomet...
Solution Manual : Chapter - 06 Application of the Definite Integral in Geomet...Solution Manual : Chapter - 06 Application of the Definite Integral in Geomet...
Solution Manual : Chapter - 06 Application of the Definite Integral in Geomet...Hareem Aslam
Ā 
Solution Manual : Chapter - 05 Integration
Solution Manual : Chapter - 05 IntegrationSolution Manual : Chapter - 05 Integration
Solution Manual : Chapter - 05 IntegrationHareem Aslam
Ā 
Solution Manual : Chapter - 02 Limits and Continuity
Solution Manual : Chapter - 02 Limits and ContinuitySolution Manual : Chapter - 02 Limits and Continuity
Solution Manual : Chapter - 02 Limits and ContinuityHareem Aslam
Ā 
Solution Manual : Chapter - 01 Functions
Solution Manual : Chapter - 01 FunctionsSolution Manual : Chapter - 01 Functions
Solution Manual : Chapter - 01 FunctionsHareem Aslam
Ā 
Personality Development
Personality DevelopmentPersonality Development
Personality DevelopmentHareem Aslam
Ā 
Chapter 20 coc
Chapter 20 cocChapter 20 coc
Chapter 20 cocHareem Aslam
Ā 
Chapter 19 multimedia
Chapter 19 multimediaChapter 19 multimedia
Chapter 19 multimediaHareem Aslam
Ā 
Chapter 18 internet
Chapter 18 internetChapter 18 internet
Chapter 18 internetHareem Aslam
Ā 
Chapter 16 bdp
Chapter 16 bdpChapter 16 bdp
Chapter 16 bdpHareem Aslam
Ā 
Chapter 17 dccn
Chapter 17 dccnChapter 17 dccn
Chapter 17 dccnHareem Aslam
Ā 
Chapter 14 os
Chapter 14 osChapter 14 os
Chapter 14 osHareem Aslam
Ā 
Chapter 11 pcp
Chapter 11 pcpChapter 11 pcp
Chapter 11 pcpHareem Aslam
Ā 
Chapter 09 io devices
Chapter 09 io devicesChapter 09 io devices
Chapter 09 io devicesHareem Aslam
Ā 
Chapter 08 secondary storage
Chapter 08 secondary storageChapter 08 secondary storage
Chapter 08 secondary storageHareem Aslam
Ā 
Chapter 07 pam
Chapter 07 pamChapter 07 pam
Chapter 07 pamHareem Aslam
Ā 
Chapter 06 boolean algebra
Chapter 06 boolean algebraChapter 06 boolean algebra
Chapter 06 boolean algebraHareem Aslam
Ā 
Chapter 04 computer codes
Chapter 04 computer codesChapter 04 computer codes
Chapter 04 computer codesHareem Aslam
Ā 
Chapter 05 computer arithmetic
Chapter 05 computer arithmeticChapter 05 computer arithmetic
Chapter 05 computer arithmeticHareem Aslam
Ā 

More from Hareem Aslam (20)

Chapter 1 Basic Concepts
Chapter 1 Basic ConceptsChapter 1 Basic Concepts
Chapter 1 Basic Concepts
Ā 
Solution Manual : Chapter - 07 Exponential, Logarithmic and Inverse Trigonome...
Solution Manual : Chapter - 07 Exponential, Logarithmic and Inverse Trigonome...Solution Manual : Chapter - 07 Exponential, Logarithmic and Inverse Trigonome...
Solution Manual : Chapter - 07 Exponential, Logarithmic and Inverse Trigonome...
Ā 
Solution Manual : Chapter - 06 Application of the Definite Integral in Geomet...
Solution Manual : Chapter - 06 Application of the Definite Integral in Geomet...Solution Manual : Chapter - 06 Application of the Definite Integral in Geomet...
Solution Manual : Chapter - 06 Application of the Definite Integral in Geomet...
Ā 
Solution Manual : Chapter - 05 Integration
Solution Manual : Chapter - 05 IntegrationSolution Manual : Chapter - 05 Integration
Solution Manual : Chapter - 05 Integration
Ā 
Solution Manual : Chapter - 02 Limits and Continuity
Solution Manual : Chapter - 02 Limits and ContinuitySolution Manual : Chapter - 02 Limits and Continuity
Solution Manual : Chapter - 02 Limits and Continuity
Ā 
Solution Manual : Chapter - 01 Functions
Solution Manual : Chapter - 01 FunctionsSolution Manual : Chapter - 01 Functions
Solution Manual : Chapter - 01 Functions
Ā 
Personality Development
Personality DevelopmentPersonality Development
Personality Development
Ā 
Chapter 20 coc
Chapter 20 cocChapter 20 coc
Chapter 20 coc
Ā 
Chapter 19 multimedia
Chapter 19 multimediaChapter 19 multimedia
Chapter 19 multimedia
Ā 
Chapter 18 internet
Chapter 18 internetChapter 18 internet
Chapter 18 internet
Ā 
Chapter 16 bdp
Chapter 16 bdpChapter 16 bdp
Chapter 16 bdp
Ā 
Chapter 17 dccn
Chapter 17 dccnChapter 17 dccn
Chapter 17 dccn
Ā 
Chapter 14 os
Chapter 14 osChapter 14 os
Chapter 14 os
Ā 
Chapter 11 pcp
Chapter 11 pcpChapter 11 pcp
Chapter 11 pcp
Ā 
Chapter 09 io devices
Chapter 09 io devicesChapter 09 io devices
Chapter 09 io devices
Ā 
Chapter 08 secondary storage
Chapter 08 secondary storageChapter 08 secondary storage
Chapter 08 secondary storage
Ā 
Chapter 07 pam
Chapter 07 pamChapter 07 pam
Chapter 07 pam
Ā 
Chapter 06 boolean algebra
Chapter 06 boolean algebraChapter 06 boolean algebra
Chapter 06 boolean algebra
Ā 
Chapter 04 computer codes
Chapter 04 computer codesChapter 04 computer codes
Chapter 04 computer codes
Ā 
Chapter 05 computer arithmetic
Chapter 05 computer arithmeticChapter 05 computer arithmetic
Chapter 05 computer arithmetic
Ā 

Recently uploaded

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
Ā 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
Ā 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
Ā 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
Ā 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
Ā 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
Ā 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
Ā 
call girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
call girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļøcall girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
call girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø9953056974 Low Rate Call Girls In Saket, Delhi NCR
Ā 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
Ā 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
Ā 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
Ā 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
Ā 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
Ā 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
Ā 
18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdfssuser54595a
Ā 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
Ā 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
Ā 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
Ā 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)ā€”ā€”ā€”ā€”IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)ā€”ā€”ā€”ā€”IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)ā€”ā€”ā€”ā€”IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)ā€”ā€”ā€”ā€”IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
Ā 
ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,
ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,
ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,Virag Sontakke
Ā 

Recently uploaded (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
Ā 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
Ā 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
Ā 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
Ā 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
Ā 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
Ā 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
Ā 
call girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
call girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļøcall girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
call girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
Ā 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
Ā 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
Ā 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
Ā 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
Ā 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
Ā 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
Ā 
18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdf
Ā 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
Ā 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Ā 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
Ā 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)ā€”ā€”ā€”ā€”IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)ā€”ā€”ā€”ā€”IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)ā€”ā€”ā€”ā€”IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)ā€”ā€”ā€”ā€”IMP.OF KSHARA ...
Ā 
ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,
ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,
ą¤­ą¤¾ą¤°ą¤¤-ą¤°ą„‹ą¤® ą¤µą„ą¤Æą¤¾ą¤Ŗą¤¾ą¤°.pptx, Indo-Roman Trade,
Ā 

Computer Fundamentals: Programming Languages Guide

  • 1. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 1/59Chapter 12: Computer LanguagesRef Page
  • 2. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 2/59Chapter 12: Computer LanguagesRef Page In this chapter you will learn about: Ā§ Computer languages or programming languages Ā§ Three broad categories of programming languages ā€“ machine, assembly, and high-level languages Ā§ Commonly used programming language tools such as assembler, compiler, linker, and interpreter Ā§ Concepts of object-oriented programming languages Ā§ Some popular programming languages such as FORTRAN, COBOL, BASIC, Pascal, C, C++, C#, Java, RPG, LISP and SNOBOL Ā§ Related concepts such as Subprogram, Characteristics of a good programming language, and factors to consider while selecting a language for coding an application Learning ObjectivesLearning Objectives 208
  • 3. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 3/59Chapter 12: Computer LanguagesRef Page Broad Classification of Computer Languages Broad Classification of Computer Languages Ā§ Machine language Ā§ Assembly language Ā§ High-level language 209
  • 4. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 4/59Chapter 12: Computer LanguagesRef Page Machine LanguageMachine Language Ā§ Only language of a computer understood by it without using a translation program Ā§ Normally written as strings of binary 1s and 0s Ā§ Written using decimal digits if the circuitry of the computer being used permits this 209
  • 5. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 5/59Chapter 12: Computer LanguagesRef Page A Typical Machine Language Instruction Format A Typical Machine Language Instruction Format Ā§ OPCODE tells the computer which operation to perform from the instruction set of the computer Ā§ OPERAND tells the address of the data on which the operation is to be performed OPCODE (operation code) OPERAND (Address/Location) 210
  • 6. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 6/59Chapter 12: Computer LanguagesRef Page A Sample Machine Language ProgramA Sample Machine Language Program 10001471 14002041 30003456 50773456 00000000 001000000000001100111001 001100000000010000100001 011000000000011100101110 101000111111011100101110 000000000000000000000000 In Binary (Difficult to read and understand) In Decimal (Easier to read and understand) 210
  • 7. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 7/59Chapter 12: Computer LanguagesRef Page Advantages & Limitations of Machine Language Advantages & Limitations of Machine Language Advantage Ā§ Can be executed very fast Limitations Ā§ Machine Dependent Ā§ Difficult to program Ā§ Error prone Ā§ Difficult to modify 210
  • 8. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 8/59Chapter 12: Computer LanguagesRef Page Assembly/Symbolic LanguageAssembly/Symbolic Language Ā§ Using alphanumeric mnemonic codes instead of numeric codes for the instructions in the instruction set e.g. using ADD instead of 1110 (binary) or 14 (decimal) for instruction to add Ā§ Allowing storage locations to be represented in form of alphanumeric addresses instead of numeric addresses e.g. representing memory locations 1000, 1001, and 1002 as FRST, SCND, and ANSR respectively Ā§ Providing pseudo-instructions that are used for instructing the system how we want the program to be assembled inside the computerā€™s memory e.g. START PROGRAM AT 0000; SET ASIDE AN ADRESS FOR FRST Programming language that overcomes the limitations of machine language programming by: 211
  • 9. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 9/59Chapter 12: Computer LanguagesRef Page AssemblerAssembler Ā§ Software that translates as assembly language program into an equivalent machine language program of a computer One-to-one correspondence (Source Program) (Object Program) Assembler Assembly language program Machine language program Input Output 212
  • 10. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 10/59Chapter 12: Computer LanguagesRef Page A subset of the set of instructions supported by a computer Halt, used at the end of program to stop Clear and add into A register Add to the contents of A register Subtract from the contents of A register Store A register 00 10 14 15 30 HLT CLA ADD SUB STA MeaningOpcodeMnemonic An Example of Assembly Language Program An Example of Assembly Language Program 213
  • 11. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 11/59Chapter 12: Computer LanguagesRef Page START PROGRAM AT 0000 START DATA AT 1000 SET ASIDE AN ADDRESS FOR FRST SET ASIDE AN ADDRESS FOR SCND SET ASIDE AN ADDRESS FOR ANSR CLA FRST ADD SCND STA ANSR HLT Sample assembly language program for adding two numbers and storing the result An Example of Assembly Language Program An Example of Assembly Language Program 213
  • 12. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 12/59Chapter 12: Computer LanguagesRef Page 1000 1001 1002 FRST SCND ANSR Memory locationSymbolic name Mapping table set up by the assembler for the data items of the assembly language program An Example of Assembly Language Program An Example of Assembly Language Program 213
  • 13. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 13/59Chapter 12: Computer LanguagesRef Page An Example of Assembly Language Program An Example of Assembly Language Program Equivalent machine language program for the assembly language program AddressOpcode 1000 1001 1002 Clear and add the number stored at FRST to A register Add the number stored at SCND to the contents of A register Store the contents of A register into ANSR Halt Reserved for FRST Reserved for SCND Reserved for ANSR 10 14 30 00 0000 0001 0002 0003 - - - 1000 1001 1002 CommentsContentsMemory location 214
  • 14. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 14/59Chapter 12: Computer LanguagesRef Page Advantages of Assembly Language Over Machine Language Advantages of Assembly Language Over Machine Language Ā§ Easier to understand and use Ā§ Easier to locate and correct errors Ā§ Easier to modify Ā§ No worry about addresses Ā§ Easily relocatable Ā§ Efficiency of machine language 214
  • 15. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 15/59Chapter 12: Computer LanguagesRef Page Limitations of Assembly LanguageLimitations of Assembly Language Ā§ Machine dependent Ā§ Knowledge of hardware required Ā§ Machine level coding 215
  • 16. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 16/59Chapter 12: Computer LanguagesRef Page Ā§ Mainly used today to fine-tune important parts of programs written in a high-level language to improve the programā€™s execution efficiency Typical Uses of Assembly LanguageTypical Uses of Assembly Language 215
  • 17. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 17/59Chapter 12: Computer LanguagesRef Page Assembly Languages with Macro Instructions Assembly Languages with Macro Instructions Ā§ Any assembly language instruction that gets translated into several machine language instructions is called a macro instruction Ā§ Several assembly languages support such macro instructions to speed up the coding process Ā§ Assemblers of such assembly languages are designed to produce multiple machine language instructions for each macro instruction of the assembly language 215
  • 18. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 18/59Chapter 12: Computer LanguagesRef Page High-Level LanguagesHigh-Level Languages Ā§ Machine independent Ā§ Do not require programmers to know anything about the internal structure of computer on which high-level language programs will be executed Ā§ Deal with high-level coding, enabling the programmers to write instructions using English words and familiar mathematical symbols and expressions 216
  • 19. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 19/59Chapter 12: Computer LanguagesRef Page Ā§ Translator program (software) that translates a high- level language program into its equivalent machine language program Ā§ Compiles a set of machine language instructions for every program instruction in a high-level language CompilerCompiler 217
  • 20. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 20/59Chapter 12: Computer LanguagesRef Page One-to-many correspondence (Source Program) (Object Program) Compiler High-level language program Machine language program Input Output CompilerCompiler 217
  • 21. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 21/59Chapter 12: Computer LanguagesRef Page Illustrating the requirement of a separate compiler for each high-level language supported by a computer A computer supporting languages L1 and L2 Program P1 in high-level language L1 Program P2 in high-level language L2 Machine code for P1 Machine code for P2 Compiler for language L1 Compiler for language L2 CompilerCompiler (Continued on next slide) 218
  • 22. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 22/59Chapter 12: Computer LanguagesRef Page Illustrating the machine independence characteristic of a high-level language. Separate compilers are required for the same language on different computers Compiler for language L1 on computer A Program P1 in high- level language L1 Machine code for P1 that will run on computer A Executed on computer A Compiler for language L1 on computer B Machine code for P1 that will run on computer B Executed on computer B Same results obtained CompilerCompiler (Continued from previous slide..) 218
  • 23. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 23/59Chapter 12: Computer LanguagesRef Page Syntax ErrorsSyntax Errors In addition to doing translation job, compilers also automatically detect and indicate syntax errors Syntax errors are typically of following types: Note : A compiler cannot detect logic errors in a program Ā§ Illegal characters Ā§ Illegal combination of characters Ā§ Improper sequencing of instructions in a program Ā§ Use of undefined variable names 219
  • 24. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 24/59Chapter 12: Computer LanguagesRef Page START Edit source program Syntax errors detected? Yes Compile source program Source program Generate list of coded error messages Generate object program Object program STOP No The Process of Removing Syntax Errors From A Source Program The Process of Removing Syntax Errors From A Source Program 219
  • 25. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 25/59Chapter 12: Computer LanguagesRef Page Ā§ For a large software, storing all the lines of program code in a single source file will be: Ā§ Hence, a modular approach is generally adapted to develop large software where the software consists of multiple source program files Ā§ No need to write programs for some modules as it might be available in library offering the same functionality ā€“ Difficult to work with ā€“ Difficult to deploy multiple programmers to concurrently work towards its development ā€“ Any change in the source program would require the entire source program to be recompiled LinkerLinker (Continued on next slide) 219
  • 26. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 26/59Chapter 12: Computer LanguagesRef Page LinkerLinker Ā§ Each source program file can be independently modified and compiled to create a corresponding object program file Ā§ Linker program (software) is used to properly combine all the object program files (modules) Ā§ Creates the final executable program (load module) (Continued from previous slide..) 220
  • 27. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 27/59Chapter 12: Computer LanguagesRef Page Ā§ Interpreter is a high-level language translator Ā§ Takes one statement of a high-level language program, translates it into machine language instructions Ā§ Immediately executes the resulting machine language instructions Ā§ Compiler simply translates the entire source program into an object program and is not involved in its execution InterpreterInterpreter 220
  • 28. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 28/59Chapter 12: Computer LanguagesRef Page Interpreter (translates and executes statement-by- statement) High-level language program (Source Program) Result of program execution Input Output Role of an InterpreterRole of an Interpreter 220
  • 29. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 29/59Chapter 12: Computer LanguagesRef Page Intermediate Language Compiler & Interpreter Intermediate Language Compiler & Interpreter Ā§ New type of compiler and interpreter combines the speed, ease, and control of both compiler and interpreter Ā§ Compiler first compiles the source program to an intermediate object program Ā§ Intermediate object program is not a machine language code but written in an intermediate language that is virtually machine independent Ā§ Interpreter takes intermediate object program, converts it into machine language program and executes it 221
  • 30. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 30/59Chapter 12: Computer LanguagesRef Page Benefits of Intermediate Language Compiler & Interpreter Benefits of Intermediate Language Compiler & Interpreter Ā§ Intermediate object program is in compiled form and thus is not original source code, so safer and easier to share Ā§ Intermediate object program is based on a standard Intermediate Definition Language (IDL) Ā§ Interpreter can be written for any computer architecture and operating system providing virtual machine environment to the executing program Ā§ Newer Interpreter compiles intermediate program, in memory, into final host machine language program and executes it Ā§ This technique is called Just-In-Time (JIT) Compilation 221
  • 31. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 31/59Chapter 12: Computer LanguagesRef Page Advantages of High-Level LanguagesAdvantages of High-Level Languages Ā§ Machine independent Ā§ Easier to learn and use Ā§ Fewer errors during program development Ā§ Lower program preparation cost Ā§ Better documentation Ā§ Easier to maintain 222
  • 32. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 32/59Chapter 12: Computer LanguagesRef Page Limitations of High-Level LanguagesLimitations of High-Level Languages Ā§ Lower execution efficiency Ā§ Less flexibility to control the computerā€™s CPU, memory and registers 222
  • 33. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 33/59Chapter 12: Computer LanguagesRef Page Object-Oriented Programming LanguagesObject-Oriented Programming Languages Ā§ Programming languages are used for simulating real- world problems on computers Ā§ Much of the real world is made up of objects Ā§ Essence of OOP is to solve a problem by: Ā§ Identifying the real-world objects of the problem Ā§ Identifying processing required of them Ā§ Creating simulations of objects, processes, and their communications 223
  • 34. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 34/59Chapter 12: Computer LanguagesRef Page Ā§ Stands for FORmula TRANslation Ā§ Originally developed by John Backus and his team at IBM followed by several revisions Ā§ Standardized by ANSI as FORTRAN-77 and FORTRAN-90 Ā§ Designed for solving scientific & engineering problems Ā§ Oriented towards solving problems of a mathematical nature Ā§ Popular language amongst scientists and engineers FORTRANFORTRAN 223
  • 35. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 35/59Chapter 12: Computer LanguagesRef Page C FORTRAN PROGRAM TO COMPUTE C THE SUM OF 10 NUMBERS SUM = 0 DO 50 I = 1, 10 READ (5, 10) N SUM = SUM + N 50 CONTINUE WRITE (6, 20) SUM 10 FORMAT (F6.2) 20 FORMAT (1X, ā€™THE SUM OF GIVEN NUMBERS = ā€™, F10.2) STOP END A Sample FORTRAN ProgramA Sample FORTRAN Program 224
  • 36. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 36/59Chapter 12: Computer LanguagesRef Page Ā§ Stands for COmmon Business Oriented Language Ā§ Originally developed started under Grace Hopper followed by COnference on DAta SYstems Languages (CODASYL) Ā§ Standardized by ANSI as COBOL-74, COBOL-85, and COBOL-2002 Ā§ Designed for programming business data processing applications Ā§ Designed to have the appearance and structure of a business report written in English, hence often referred to as a self-documenting language COBOLCOBOL 224
  • 37. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 37/59Chapter 12: Computer LanguagesRef Page IDENTIFICATION DIVISION. PROGRAM_ID. SUMUP. AUTHOR. P K SINHA. * THIS PROGRAM COMPUTES AND PRINTS * THE SUM OF GIVEN NUMBERS. ENVIROMENT DIVISION. CONFIGURATION SECTION. SOURCE_COMPUTER. BURROUGHS_6700. OBJECT_COMPUTER. BURROUGHS_6700. INPUT_OUTPUT SECTION. FILE_CONTROL. SELECT DATA_FILE ASSIGN TO DISK. SELECT OUTPUT_FILE ASSIGN TO PRINTER. DATA DIVISION. FILE SECTION. A Sample COBOL ProgramA Sample COBOL Program (Continued on next slide) 226
  • 38. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 38/59Chapter 12: Computer LanguagesRef Page FD DATA_FILE RECORD CONTAINS 80 CHARACTERS LABEL RECORD IS OMITTED DATA RECORD IS INPUT_DATA_ RECORD. 01 INPUT_DATA_RECORD. 05 NPICTURE 9(6)V99. 05 FILLER PICTURE X(72). FD OUTPUT_FILE RECORD CONTAINS 132 CHARACTERS LABEL RECORD IS OMITTED DATA RECORD IS OUTPUT_RECORD. A Sample COBOL ProgramA Sample COBOL Program (Continued from previous slide..) (Continued on next slide) 226
  • 39. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 39/59Chapter 12: Computer LanguagesRef Page 01 OUTPUT_RECORD. 05 FILLER PICTURE X. 05TITLE PICTURE X(25). 05 SUM PICTURE 9(10)V99. 05 FILLER PICTURE X(94). WORKING_STORAGE SECTION. 77MESSAGE PICTURE X(25) VALUE IS ā€œTHE SUM OF GIVEN NUMBERS=ā€. PROCEDURE DIVISION. OPEN_FILES. OPEN INPUT DATA_FILE. OPEN OUTPUT OUTPUT_FILE. INITIALIZATION. MOVE SPACES TO OUTPUT_RECORD. MOVE ZERO TO SUM. A Sample COBOL ProgramA Sample COBOL Program (Continued from previous slide..) (Continued on next slide) 226
  • 40. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 40/59Chapter 12: Computer LanguagesRef Page PROCESS_LOOP. READ DATA_FILE AT END GO TO PRINT_PARA. ADD N TO SUM. GO TO PROCESS_LOOP. PRINT_PARA. MOVE MESSAGE TO TITLE. WRITE OUTPUT_RECORD. END_OF_JOB. CLOSE DATA_FILE. CLOSE OUTPUT_FILE. STOP RUN. A Sample COBOL ProgramA Sample COBOL Program (Continued from previous slide..) 226
  • 41. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 41/59Chapter 12: Computer LanguagesRef Page Ā§ Stands for Beginners All-purpose Symbolic Instruction Code Ā§ Developed by Professor John Kemeny and Thomas Kurtz at Darmouth College in the United States Ā§ Standardized by ANSI as BASIC-78 Ā§ Designed to be an interactive language and to use an interpreter instead of a compiler Ā§ Simple to implement, learn and use language. Hence, it is a widely used language on personal computers Ā§ Flexible and reasonably powerful language and can be used for both business and scientific applications BASICBASIC 227
  • 42. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 42/59Chapter 12: Computer LanguagesRef Page 5 REM PROGRAM TO COMPUTE 6 REM THE SUM OF 10 NUMBERS 10 LET S = 0 20 FOR I = 1 TO 10 30 READ N 40 LET S = S + N 50 NEXT I 60 PRINT ā€œTHE SUM OF GIVEN NUMBERS = ā€; S 70 DATA 4, 20, 15, 32, 48 80 DATA 12, 3, 9, 14, 44 90 END; A Sample BASIC ProgramA Sample BASIC Program 227
  • 43. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 43/59Chapter 12: Computer LanguagesRef Page Ā§ Named after the famous seventeenth-century French mathematician Blaise Pascal Ā§ Developed by Professor Nicklaus Wirth of Federal Institute of Technology in Zurich Ā§ Encourages programmers to write well-structured, modular programs, instills good program practices Ā§ Recognized as an educational language and is used to teach programming to beginners Ā§ Suitable for both scientific & business applications Ā§ Has features to manipulate numbers, vectors, matrices, strings, sets, records, files, and lists PascalPascal 228
  • 44. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 44/59Chapter 12: Computer LanguagesRef Page PROGRAM SUMNUMS (INPUT, OUTPUT); (* PROGRAM TO COMPUTE THE SUM OF 10 NUMBERS *) (* DECLARATION OF VARIABLES *) VAR SUM, N : REAL; VAR I : INTEGER; (* MAIN PROGRAM LOGIC STARTS HERE *) BEGIN SUM := 0; FOR I := 1 TO 10 DO BEGIN READ (N); SUM := SUM + N; END; WRITELN (ā€˜THE SUM OF GIVEN NUMBERS=ā€™, SUM); END; A Sample Pascal ProgramA Sample Pascal Program 228
  • 45. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 45/59Chapter 12: Computer LanguagesRef Page CC Ā§ Developed in 1972 at AT&Tā€™s Bell laboratories, USA by Dennis Ritchie and Brian Kernighan Ā§ Standardized by ANSI and ISO as C89, C90, C99 Ā§ High-level programming languages (mainly machine independence) with the efficiency of an assembly language Ā§ Language of choice of programmers for portable systems software and commercial software packages like OS, compiler, spreadsheet, word processor, and database management systems 229
  • 46. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 46/59Chapter 12: Computer LanguagesRef Page /* PROGRAM TO COMPUTE THE SUM OF 10 NUMBERS */ /* Directives to include standard library and header */ #include <stdlib.h> #include <stdio.h> /* Main function starts here */ void main ( ) { /* Declaration of variables */ float Sum = 0.0, N = 0.0; int Count = 0; for (Count = 0; Count < 10; Count++) { printf(ā€œnGive a number:ā€); scanf(ā€œ%fā€, N); Sum += N; } printf(ā€œTHE SUM OF GIVEN NUMBERS = %fā€, &Sum); } A Sample C ProgramA Sample C Program 230
  • 47. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 47/59Chapter 12: Computer LanguagesRef Page C++C++ Ā§ Named C++ as ++ is increment operator and C language is incremented to its next level with C++ Ā§ Developed by Bjarne Stroustrup at Bell Labs in the early 1980s Ā§ Contains all elements of the basic C language Ā§ Expanded to include numerous object-oriented programming features Ā§ Provides a collection of predefined classes, along with the capability of user-defined classes 229
  • 48. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 48/59Chapter 12: Computer LanguagesRef Page JavaJava Ā§ Development started at Sun Microsystems in 1991 by a team led by James Gosling Ā§ Developed to be similar to C++ with fewer features to keep it simple and easy to use Ā§ Compiled code is machine-independent and developed programs are simple to implement and use Ā§ Uses just-in-time compilation Ā§ Used in embedded systems such as hand-held devices, telephones and VCRs Ā§ Comes in two variants ā€“ Java Runtime Engine (JRE) and Java Software Development Kit (SDK) 231
  • 49. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 49/59Chapter 12: Computer LanguagesRef Page C# (C Sharp)C# (C Sharp) Ā§ Object-oriented programming language developed by Anders Hejlsberg and released by Microsoft as part of Microsoftā€™s .NET technology initiative Ā§ Standardized by ECMA and ISO Ā§ Syntactically and semantically very close to C++ and adopts various object-oriented features from both C++ and Java Ā§ Compilers target the Common Language Infrastructure (CLI) implemented by Common Language Runtime (CLR) of .NET Framework Ā§ CLR provides important services such as, memory management, exception handling, and security 232
  • 50. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 50/59Chapter 12: Computer LanguagesRef Page RPGRPG Ā§ Stands for Report Program Generator Ā§ Developed by IBM to meet customer requests for an easy and economic mechanism for producing reports Ā§ Designed to generate the output reports resulting from the processing of common business applications Ā§ Easier to learn and use as compared to COBOL Ā§ Programmers use very detailed coding sheets to write specifications about input, calculations, and output 232
  • 51. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 51/59Chapter 12: Computer LanguagesRef Page LISPLISP Ā§ Stands for LISt Processing Ā§ Developed in 1959 by John McCarthy of MIT Ā§ Designed to have features for manipulating non- numeric data, such as symbols and strings of text Ā§ Due to its powerful list processing capability, it is extensively used in the areas of pattern recognition, artificial intelligence, and for simulation of games Ā§ Functional programming language in which all computation is accomplished by applying functions to arguments 232
  • 52. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 52/59Chapter 12: Computer LanguagesRef Page SNOBOLSNOBOL Ā§ Stands for StriNg Oriented symBOlic Language Ā§ Used for non-numeric applications Ā§ Powerful string manipulation features Ā§ Widely used for applications in the area of text processing 233
  • 53. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 53/59Chapter 12: Computer LanguagesRef Page Characteristics of a Good Programming Language Characteristics of a Good Programming Language Ā§ Simplicity Ā§ Naturalness Ā§ Abstraction Ā§ Efficiency Ā§ Structured Programming Support Ā§ Compactness Ā§ Locality Ā§ Extensibility Ā§ Suitability to its environment 233
  • 54. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 54/59Chapter 12: Computer LanguagesRef Page Factors for Selecting a Language for Coding an Application Factors for Selecting a Language for Coding an Application Ā§ Nature of the application Ā§ Familiarity with the language Ā§ Ease of learning the language Ā§ Availability of program development tools Ā§ Execution efficiency Ā§ Features of a good programming language 234
  • 55. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 55/59Chapter 12: Computer LanguagesRef Page SubprogramSubprogram Ā§ Program written in a manner that it can be brought into use in other programs and used whenever needed without rewriting Ā§ Also referred to as subroutine, sub-procedure, or function Ā§ Subprogram call statement contains the name of the subprogram followed by a list of parameters enclosed within a pair of parentheses Ā§ Intrinsic subprograms (also called built-in-functions) are those provided with the programming language Ā§ Programmer-written subprograms are written and used as and when they are needed 235
  • 56. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 56/59Chapter 12: Computer LanguagesRef Page sqrt (x) Set of instructions that perform the intended task Subprogram name Parameter Subprogram header Subprogram body Structure of a SubprogramStructure of a Subprogram 235
  • 57. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 57/59Chapter 12: Computer LanguagesRef Page A program that calls the subprogram twice subprogram header subprogram body subprogram call statement next statement subprogram call statement next statement A subprogram Flow of control 1 3 7 2 6 4 5 8 9 Flow of Control in Case of Subprogram CallsFlow of Control in Case of Subprogram Calls 236
  • 58. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 58/59Chapter 12: Computer LanguagesRef Page Key Words/PhrasesKey Words/Phrases Ā§ Assembler Ā§ Assembly language Ā§ BASIC Ā§ Built-in function Ā§ C Ā§ C++ Ā§ C# Ā§ COBOL Ā§ Coding Ā§ Compiler Ā§ Computer language Ā§ FORTRAN Ā§ Function Ā§ High-level language Ā§ HotJava Interpreter Ā§ Intrinsic subprogram Ā§ Intermediate compiler and Interpreter Ā§ Java Ā§ Just-in-time compilation Ā§ Language processor Ā§ Linker Ā§ LISP Ā§ Load module Ā§ Logic error Ā§ Low-level language Ā§ Machine language Ā§ Macro instructions Ā§ Object program Ā§ Object-oriented programming Ā§ Opcode Ā§ Operand Ā§ Pascal Ā§ Programmer Ā§ Programming Ā§ Programming language Ā§ Pseudo instruction Ā§ RPG Ā§ Self-documenting language (Continued on next slide) 236
  • 59. Computer Fundamentals: Pradeep K. Sinha & Priti SinhaComputer Fundamentals: Pradeep K. Sinha & Priti Sinha Slide 59/59Chapter 12: Computer LanguagesRef Page Ā§ SNOBOL Ā§ Source program Ā§ Sub-procedure Ā§ Subprogram Ā§ Subroutine Ā§ Symbolic language Ā§ Syntax error Ā§ Syntax rules Ā§ Written subprograms Key Words/PhrasesKey Words/Phrases (Continued from previous slide..) 236