Upload
leona-watts
View
221
Download
0
Tags:
Embed Size (px)
Citation preview
Why study ProgrammingWhy study ProgrammingLanguage Concepts?Language Concepts?
Increased capacity to express programmingconcepts Improved background for choosing appropriate languagesIncreased ability to learn new languagesUnderstanding the significance of implementation Increased ability to design new languagesOverall advancement of computing
Evaluation SchemeEvaluation Scheme
The academic performance of student is based on Continuous Internal Assessment (CIA) and Semester End Examinations (SEE).
parameters of CIA Unit TestQuiz Assignments Seminar2 Internal Test SEE INCLUDE 2 HOURS PRACTICAL AND 3 HOURS
THOERY EXAM.
Reference Books:Reference Books:Text Books:
1. Farrell Joyce, Programming Logic and Design, Course Technology.
2. Behrouz Forouzan, Richard Giberg, Computer Science- A Structure Approach Using C, Cengage Learning
Question Bankhttp://www.bvpinst.edu.in/BCAStdCorner.htmutu.ac.in
1.1 Computer Components and 1.1 Computer Components and Operations Programming ParadigmOperations Programming Paradigm
Computer ComponentsComputer Components
1. Hardware Hardware is the equipment,
or the devices, associated with Computer.
for example Monitor, Keyboard, Mouse, Printer etc.
Computer ComponentsComputer Components2. Software Computer Software are programs that tell the
computer what to do given by the instructions. It is classify into two categories:
1.Systems Software : Includes the operating system and all the utilities that enable the computer to function.
2.Applications Software: Includes programs that do real work for users. For example, word processors, spreadsheets
Computer H/W & S/W Computer H/W & S/W accomplish four major accomplish four major operations:operations:
InputProcessingOutputStorage
Information Processing Information Processing cycle--1cycle--1
Processor
Control Unit/Arithmetic Logic Unit
Memory
Storage Devices
Input Devices
Output Devices
Input DevicesInput Devices
Any hardware component that allows you to enter data, programs, commands, and user responses into a computer
Input Device ExamplesKeyboardMouse
Output DevicesOutput Devices
Output devices make the information resulting from processing available for use
Output Device Examples◦Printers Impact Nonimpact Photo
◦Display Devices CRT LCD
Storage DevicesStorage Devices 1. Internal storage(Main Memory or Primary Memory) Use to store inside the machine.It is Volatile (contents are lost every
time the computer loses power)
2.External Storage Use to store outside the machine.It is Non-Volatile
Examples of external storage are: floppy-disk, hard disk or magnetic tape
Information Processing Information Processing cycle--2cycle--2
ProcessingInput
DevicesOutput Devices
Programming Languages
Machine LanguagesComplier /
Interpreter
source code for a program has been written by one or more humans in a programming language(or High level Language) (e.g., C or C++), it is compiled (i.e., converted) into machine code by a specialized program called a compiler, or by Interpreter. (converted language is known as machine language or low level language(o and 1 )This machine code is then stored as an executable file (i.e., a ready-to-run program) and can be executed (i.e., run) by the operating system.
1.2 Programming 1.2 Programming Process: Problem Process: Problem
Understanding, Planning, Understanding, Planning, Coding, Translation, Coding, Translation,
Testing and ProductionTesting and Production
Programming process broken down into six steps:Programming process broken down into six steps:Understand the problem
Plan the logic
Code the program
Translate the program
Test the program
Put the program into production
Understand the problem Analyze use needs and requirements
Plan the logic Give the instructions to the computer in specific
sequence this is called developing the logic Most common tools are: 1) Flowcharts 2) Pseudo code
Code the programTo follow certain rules for giving instruction to machine is
called syntax of the language
Translate The programHigh-Level and low-level Language
Test the program Logical and syntax errors
Put the program into production if program is tested ,the organization can use it by
putting into production.
1.3 Data Hierarchy, Flowchart 1.3 Data Hierarchy, Flowchart Symbols, Pseudo code Statements Symbols, Pseudo code Statements
and Connectorand Connector
Flowchart Symbols, Pseudo code Flowchart Symbols, Pseudo code Statements and ConnectorStatements and Connector
Flow Chart A flow chart is a pictorial representation of the
logical steps to solve a problem.
Pseudo code Pseudo code is a kind of structured English for
describing algorithms. It allows the designer to focus on the logic of the algorithm without being distracted by details of language syntax.
ConnectorConnectorA connector will be used when limited page size
forces to continue the flowchart on another page.
Start
Step -1
Step -2
1 Stop
Step -3
Step -4
1
1.4 Variables, Data Types and 1.4 Variables, Data Types and Evolution of Programming Evolution of Programming
TechniquesTechniques
VariableVariable
A variable is a value that can change any time. It is a memory location used to store a data value. A variable name should be carefully chosen by the programmer so that its use is reflected in a useful way in the entire program. Example of variable names are:
SunnumberSalaryEmp_nameaverage1
Rules of Variables
They must begin with a letter some system permit underscores as the first character.
Length of variable should not be normally more than eight characters.
Uppercase and lowercase are significant. That is the variable Total is not the same as total or TOTAL.
The variable name should not be a keywordWhite space is not allowed.
Keywords and Identifies Keywords and Identifies
Every C word is classified as either a Keyword or identifier. Keywords are the words whose meaning has already been explained to the C compiler. for example Auto ,Break ,Case ,Char,Const,Continue,Default ,Do ,Double , Enum
Identifiers refer to the names of variable, functions and arrays. These are user defined names and consist of a sequence of letter and digits
Data TypeData TypeC support three types of data
type1.Primary ( int, char etc)2.Derived (array , structure)3.User defined (enum , type def)
Data TypeData Type
Data Type Range Bytes FormatSigned char -128 to +127 1 % c
Unsigned Char 0 to 255 1 % c
Short signed intSigned int
-32768 to +32767 2 % d
Short unsigned int 0 to 65535 2 % u
Long signed int -2,14,74,83,648 to +2 14,74,83,647
4 % ld
Long unsigned int 0 to 4,29,49,67,295
4 % lu
Float -3.4e38 to +3.4e38
4 % f
Double -1.7e308 to +1.7e308
8 % lf
Long double -1.7e4932 to +1.7e4932
10 % Lf
1.5 Unstructured Spaghetti1.5 Unstructured Spaghetti Code and Code and
Recognizing StructureRecognizing Structure
Unstructured / Spaghetti CodeUnstructured / Spaghetti Code
The popular name for unstructured program organization is spaghetti code. logic is free to
jump from one place to anywhere else in the a program
The Sequence The Sequence StructureStructureA structure is a basic unit of programming logic;
each structure is a sequence, selection, or loop .here with we can perform actions in order.
A Repetition StructureA Repetition Structure
programmers refer to looping as repetition or iteration
Nesting StructureNesting StructurePlacing a structure within another structure is called nesting the structures
Understanding the Reasons for StructureUnderstanding the Reasons for Structure
Three structures(sequence, selection, and loop) is better for the following reasons:
ClarityProfessionalismEfficiency Maintenance
Case(selection)StructureCase(selection)StructureUse the Case structure when there are several
distinct possible values for a single variable being tested and each value requires different
actions