Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
55 views27 pages

PF Lecture 05

The document discusses several key concepts related to computer programming and digital technology: 1) It defines digital as relating to discrete values represented by digits, and discusses how digital data can be processed and transmitted more efficiently than analog data. 2) It explains that digital computers work with bits, which represent binary digits and two discrete states, since they are based on signals represented by voltage levels. 3) It provides examples of some common programming paradigms like sequential, procedural, object-oriented, and functional programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views27 pages

PF Lecture 05

The document discusses several key concepts related to computer programming and digital technology: 1) It defines digital as relating to discrete values represented by digits, and discusses how digital data can be processed and transmitted more efficiently than analog data. 2) It explains that digital computers work with bits, which represent binary digits and two discrete states, since they are based on signals represented by voltage levels. 3) It provides examples of some common programming paradigms like sequential, procedural, object-oriented, and functional programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Computer Programming

Digital

 Discrete resolution of information.

 Relating to or using signals or information represented by discrete values


(digits) of a physical quantity.

 Involving or relating to the use of computer technology: "the digital


revolution".

2
Digital Technology

http://static.freepik.com/free-photo/digital-technology-product-icon-vector-material_34-26168.jpg
http://artofdigital.net/wp-content/uploads/2012/07/digital-technology.jpg
Advantages of Digital

 Can be processed and transmitted more efficiently and reliably than analog
data.

 Has a great advantage when storage is necessary.

 Noise (unwanted voltage fluctuations) does not affect digital data nearly as
much as it does analog signals.

4
Digital Computer

 Finite Discrete states.


 Decimal: 10 discrete states.
 Binary: 2 discrete states.
 Hexadecimal: ?
 Bit – Binary digIT.
 Digital Computer
work with Bits, since
they represent yes-
no, true-false (two
states).
 WHY?
 Works with
5
Signals
represented by
Voltage.
Activity Time

What is programming?

6
Programming Paradigm

 Sequential Programming (Von Neumann architecture)

 Procedural languages (Modular Programming)

 Object-oriented Programming

 Imperative Programming

 Functional Programming

 Logic Programming
Courtesy: Wikipedia
7
Translating Languages
English: Display the sum of A times B plus C.

C++: cout << (A * B + C);

Assembly Language: Intel Machine Language:


mov eax,A A1 00000000
mul B F7 25 00000004
add eax,C
03 05 00000008
call
WriteInt E8 00500000

8
Assemble-Link Execute Cycle

Link
Library
Step 2: Step 3: Step 4:
Source assembler Object linker Executable OS loader
Output
File File File

Listing Map
Step 1: text editor File
File

9
Activity Time

What is Interpreter?

10
Activity Time

What is Compiler?

11
http://www.pasteur.fr/formation/infobio/python/images/compiler_inte1r2preter.png
Activity Time

What is Assembler?

13
http://www.pasteur.fr/formation/infobio/python/images/bytecode.png
14
Activity Time

What is Storage?

15
http://www.centerpointaudio.com/Images/Sd-Data%20Measurements.pn16g
Exercise
Write Pseudocode or make flowchart

Ask user if they want to perform mul or div


for input int a and b

Perform dry run for div and mul, when:


a = 10 and b = 3

Calculate a/b and a*b without using divide


(/) and multiply (*) operators
(only use +, -, mod) 17
Introduction to C

 C evolved from two previous languages, BCPL and B.

 The C language was evolved from B by Dennis Ritchie at


Bell Laboratories and was originally implemented in 1972.

 Many of today’s leading operating systems are written in


C
and/or C++.
Why C

 Creates a complete easy-to-understand picture of processes in


the source code
 C is mostly hardware independent
 t’s possible to write C programs that are portable to most
computers.
 C is widely used to develop systems that demand performance,
such as operating systems, embedded systems, real-time
systems and communications systems
 Many of the backend technicalities of computers are easy to
grasp while writing a code in C.
Installation of C tools

 C Compiler
 There are many
High-Level Programming Languages

 Single statements could be written to accomplish


substantial tasks.
 Translator programs called compilers convert high-level
language programs into machine language.
 High-level languages allow you to write instructions that
look almost like everyday English and contain commonly
used mathematical notations.
 For example, here’s a section of a high-level language’s
program
grossPay = basePay + overTimePay
High-Level Programming Languages

 Some of the well-known high level programming languages


are:
 C
 C++
 Java
 Python
 Etc..
Translator Programs

 Different type of programming languages construct their


translator softwares.
 These softwares help a high-level language’s code to be
translated into machine code for the machine to execute.
 Usually, a translator software is known as a compiler,
however, there are two different types of translator
programs
 Compiler
 Interpreter
Compiler

 A tool that converts the source code written in high-level


programming language into executable machine code

 Compiler transforms code written in a high-level programming


language into the machine code, at once, into an executable
machine code before program runs
Interpreter

 The interpreter converts the source code line-by-line during RUN


Time.

 Interpreter allows evaluation and modification of the program while it


is executing.
 Interpreters work slowly when compared to Compilers
Syntax

 The grammar of a programming language is referred to as


Syntax.
 A collection of the rules which shows how to write
instructions in a particular programming language is known
as Syntax.
 If the syntax is not correct in a source code, the code will
throw an error.
 Keywords:
 The words/phrases whose meanings are pre-defined by
the programming languages.
Syntax

 Consider the following English sentences


 This is a book (grammatically correct as it follows
language’s rules)
 Booka is this (grammatically incorrect as it does not
follow language’s rules)
 Similarly, if a particular instruction in a
programming language follows the syntax (grammar)
of the language then it is said to be correct.

You might also like