computer programming (ce103) b.tech. semester i · library functions for string,...

76
Computer Programming (CE103) B.Tech. Semester I Dr. Vijay Ukani Email: [email protected] Contact No. 079-30642554 Office: PG312 Visiting Hours Tuesday – 9:45 am to 11:15 am & Saturday (1 st /3 rd /5 th ) – 2 pm to 4 pm

Upload: others

Post on 15-Apr-2020

17 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Computer Programming(CE103)

B.Tech. Semester I

Dr. Vijay UkaniEmail: [email protected]

Contact No. 079-30642554Office: PG312Visiting Hours

Tuesday – 9:45 am to 11:15 am & Saturday (1st/3rd/5th) – 2 pm to 4 pm

Page 2: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Outline of Today’s Discussion1. Overview of the course

2. Discussion on course policya) Credit Details, course blog & course siteb) Introduction to coursec) Course learning outcomes (CLOs)d) Syllabuse) Laboratory detailsf) Tutorial detailsg) Assessment policyh) Lesson plani) Teaching learning methodologyj) Active learning techniquesk) Course material

3. Linkages of the course with other courses and professional relevance

Page 3: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Overview of the courseØ What is Language ?Ø What is programming language ?

Page 4: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Credit DetailsØ Lectures-3, Tutorial-1, Praticals-2 Credits-5

Ø Course blogØ https://ce103vu.wordpress.com

Ø Course siteØ https://sites.google.com/a/nirmauni.ac.in/ce103-computer-

programming/

Page 5: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Introduction to courseØ Importance of the course

Ø Although numerous computer languages are used for writing computer applications, the computer programming language, C, is the most popular language worldwide.

Ø Everything from microcontrollers to operating systems is written in C since it's very flexible and versatile, allowing maximum control with minimal commands.

Ø It also helps in building logic progressively.

Ø It is not limited to Computer Science and Information Technology but it is also the language of choice for programming embedded and mechatronic systems with hardware interfaces.

Page 6: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Introduction to courseØ Objectives of the course

Ø Ability to get acquainted with basic components and capabilities of a typical computing systems.

Ø Capability to critically analyse basic problems and develop flowcharts, algorithms and write pseudo codes to solve them.

Ø Identify appropriate language constructs, its uses and approaches to computational problems

Ø Develop, execute, debug and validate the programs as per the requirements appreciate need of coding standards

Ø Inculcate technique to develop awareness of coding standards including documentation which are required to be used for the development of effective, efficient, and maintainable programs.

Page 7: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Introduction to courseØ Prerequisite

Ø The course starts with basics of computer and Internet and most fundamental aspects of programming and thereby there is no pre-requisite.

Page 8: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Course learning outcomes (CLOs)*Ø After successful completion of the course, a student will be able

to:1. recognize the importance and usefulness of C program constructs in

program development

2. analyse the problem and select the most appropriate method to solve it

3. apply C program constructs for developing program

4. evaluate the correctness of the developed solution

* under revision

Page 9: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ SyllabusØ Syllabus Teaching

hoursUnit - I

Introduction to Computers: Introduction to Computers and the Internet in Industry and Research, The Internet and World Wide Web, web Resources, Hardware and Software, Computer Organization, Programming Languages, Introduction to the C Programming Language, Typical C Program Development Environment and steps. Test-Driving a C Application in Linux, Running a C program Using GNU for debugging.

5

Unit - II

Introduction to Programming: Memory Concepts, datatypes, operators and expressions, Decision Making, Bitwise Operators, Flowchart, Algorithms, Pseudocode, Test-cases, Repetition Statement, Counter-Controlled Repetition, Sentinel-Controlled Repetition, Nested Control Statements. Introduction some Simple C Program, I/O handling.

Programming with C: keywords, syntax and library functions, datatypes, declarative, imperative and decision statements. Control structures.

9

Page 10: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ SyllabusØ Syllabus Teaching

hoursUnit - III

Functions: Math Library Functions, User defined functions, Function Call Stack and Stack frames, Passing Arguments by Value and By Reference, Scope Rules, Recursion, Recursion vs. Iteration.

Arrays: Defining Arrays, Sorting Arrays, Searching Arrays, Multidimensional Arrays, Variable-Length Arrays, Passing Arrays to Functions.

10

Unit - IV

Pointers: Pointer Variable Definitions and Initialization, Pointer Operators, Passing Arguments to Functions by Reference, Pointer Expressions and Pointer Arithmetic, Relationship between Pointers and Arrays, Arrays of Pointers, Pointers to Functions. Introduction to dynamic memory allocation.

Characters and Strings: Fundamentals of Strings and Characters, Character-Handling Library Functions, String-Conversion Functions, Standard Input/output Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling Library.

11

Page 11: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ SyllabusØ

ØTopics/contents for self-study are as listed below:Ø Pointer to functions, string functions, formatted output, file processing

functions for reading/writing binary files

Ø Students are expected to study above mentioned topics on their own. These topics will not be taught in the classroom. Students should refer to books available in the library for the same.

Syllabus Teaching hours

Unit - V

Structures: Structure Definitions, Defining Variables of Structure Types, Operations That Can Be Performed on Structures, Initializing Structures, Accessing Structure Members, Using Structures with Functions

File Processing: Files and Streams, Creating a File, Reading and writing Data from a File.

10

Page 12: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ SyllabusØ References

1. Deitel and Deitel, C How to program, Pearson2. E Balagurusamy, Programming in ANSI C, McGraw Hill3. Yashwant Kanitkar, Let Us C, BPB Publications4. V Rajaraman, Fundamentals of Computers, Prentice Hall of India5. Joyce Farrell, Programming Logic and Design Comprehensive, Cenage Learning6. David Gries, The Science of Programming, Springer, New York, Hedelberg, Berlin7. Dromey R.G., How to solve it by computers, Prentice Hall of India8. Jean-Paul Tremblay, Richard B. Bunt, Introduction to Computer Science, McGraw-Hill9. Kernighan., Ritchie, ANSI C Language, Prentice Hall of India10. Sedgewick R., Algorithms in C, Addison Wesley11. Schaum Ourline Series, Programming in C, McGraw-Hill12. E Balagurusamy, Pointers in C, McGraw-Hill

Note: The latest edition of books should be referred.

Page 13: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Laboratory detailsØ Sr.

No.Week No.# List of Experiments Schedule* Mapped

CLO

1 1

E l e m e n t a r y c o m m a n d s i n LINUX/UNIX/Ubuntu and compiling simple C program

07/08/2017 to

11/08/20171

2 2

Introduction to CodeBlocks IDE. Use CodeBlock to write and compile a simple C program

14/08/2017 to

18/08/20171

3 3

Demonstrate debugging in CodeBlocks and program using various operators

21/08/2017 to

25/08/20173,4

4 4

C p r og rams t o demon s t r a t e u s e o f conditional statements

28/08/2017 to

01/09/20171,2,3,4

5 5 & 6

C programs to demonstrate use of loop constructs

04/09/2017 to

15/09/20171,2,3,4

Page 14: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Laboratory detailsØ

Sr. No. Week No.# List of Experiments Schedule* Mapped

CLO

6 8C programs based on arrays 25/09/2017

to 29/09/2017

1,2,3,4

7 9C programs to explore String manipulation 02/10/2017

to 06/10/2017

1,2,3,4

8 10C programs based on structures and unions 09/10/2017

to 13/10/2017

1,2,3,4

9 13C programs to declare, define and use user defined functions for modular programming

30/10/2017 to

03/11/20171,2,3,4

10 14C programs to demonstrate use of pointers 06/11/2017

to 10/11/2017

1,2,3,4

11 15C Programs for file processing 13/11/2017

to 17/11/2017

1,2,3,4

Page 15: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Tutorial detailsØ

Sr. No. Tutorial topics Schedule* Mapped CLO

1. Introduct i on to Computer Organization and Internet

07/08/2017 to 11/08/2017 1

2. D a t a t y p e s a n d b a s i c C programs

14/08/2017 to 18/08/2017 1

3. W r i t i n g a l g o r i t h m a n d flowchart

21/08/2017 to 25/08/2017 1,2

4. Operators, expressions and I/O handling

28/08/2017 to 01/09/2017 1,3

5. Conditional statements 04/09/2017 to 08/09/2017 1,2,3

6. Looping constructs11/09/2017 to 15/09/2017

 1,2,3

Page 16: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Tutorial detailsØ

Sr. No. Tutorial topics Schedule* Mapped CLO

7. Arrays 25/09/2017 to 29/09/2017 1,2,3

8. String manipulation 02/10/2017 to 06/10/2017 1,2,3

9. User defined functions and parameter passing

09/10/2017 to 13/10/2017 1,2,3,4

10. Grouping variables together using structures

30/10/2017 to 03/11/2017 1,2,3

11. Pointer arithmetic 06/11/2017 to 10/11/2017 1,2,3,4

12. File Processing 13/11/2017 to 17/11/2017 1,2,3,4

Page 17: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Assessment policyØ

Assessment scheme

CE (100 marks) LPW (100 marks) SEE (100 marks)

Component weightage

0.4 0.2 0.4

  Class Test30%

(Maximum 30 marks)

Sessional Exam40%

(Maximum 40 marks)

Tutorial Evaluation

30%(Maximum 30

marks)

Continuous Evaluation

75%(Maximum 75 marks)

Viva Voce25%

(Maximum 25 marks)

3 hours theory exam

(Maximum 100 marks)

Page 18: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Assessment policyØ Assessment of Continuous Evaluation comprises of three

components:1. Class Test will be conducted as per academic calendar. It will be conducted

online/ offline for the duration of 1 hour and will be of 30 marks.

2. Sessional Exam will be conducted as per academic calendar. It will be conducted offline for the duration of 1 hour and 15 minutes and will be of 40 marks.

3. There will be 12 tutorials each carrying weightage of 10 marks. At the end of the course total marks obtained out of 120 will be converted according to weightage assigned. Assessment of Tutorials will be carried out based on parameters like timely submission, neat and clean work, originality, involvement of the student, regularity, discipline etc. during the session.

Page 19: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Assessment policyØ Assessment of Laboratory and Project Work comprises of two

components.1. Continuous assessment for laboratory experiments will be conducted. There will be 11 experiments, each carrying weightage of 10 marks. At the end of the course total marks obtained out of 110 will be converted according to weightage assigned. Assessment of Experiment will be carried out based on parameters like Completion of lab work file, understanding of the experiment performed, originality, involvement of the student, regularity, discipline etc. during the session.

2. A Viva voce examination for LPW component will be conducted as per academic calendar. It will carry a weightage of 25 marks.

Page 20: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Assessment policyØ Assessment Policy for Semester End Examination (SEE)

ØA written examination of 3 hour duration will be conducted for the course as per academic calendar. It will carry 100 marks and marks obtained out of 100 will be converted as per weightage assigned.

Page 21: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Lesson planØ https://sites.google.com/a/nirmauni.ac.in/ce103-computer-

programming/home/academic-docs/Odd-2017-18/handouts

Page 22: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Teaching learning methodology

1. Lectures: Primarily Chalk and Black board will be used to conduct the course. However, where required, Power Point Presentations (PPTs), Video Lectures, Simulations / Animations etc. will be used to enhance the teaching-learning process.

2. Tutorial: Emphasis will be on one to one interaction with students for clearing their doubts and problem solving.

3. Laboratory: Explanation of Experiment to be performed along with co-relation with theory will be given. At the end of each session, assessment will be carried out based on parameters like completion of lab work that includes observations, calculations, graphs and conclusions, individuality and involvement of the student, regularity, discipline etc. Students will be quizzed to check their understanding of the experiment/exercise conducted.

Page 23: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Active learning techniques

1. Muddiest topic: ØThis technique is aimed at finding out the least understood point/topic in the

session. This is then further explained to ensure that it is understood well.

2. The "One Minute Paper": ØThe faculty will ask students to take out a blank sheet of paper, pose a question

(either specific or open-ended), and give them one (or perhaps two - but not many) minute(s) to respond.

3. Wait Time: ØRather than choosing the student who will answer the question presented, this

variation has the faculty WAITING before calling on someone to answer it. The wait time will generally be short (15 seconds or so) - but it may seem interminable in the classroom. It is important to insist that no one raise his/her hand (or shout out the answer) before you give the OK, in order to discourage the typical scenario in which the five students in the front row all immediately volunteer to answer the question, and everyone else sighs in relief.

Page 24: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Discussion on Course PolicyØ Course material

Following course material is/will be uploaded on the course website: https://sites.google.com/a/nirmauni.ac.in/ce103-computer-programming/Ø Course Policy Ø Lecture NotesØ Books / Reference Books / NPTEL video lecturesØ Assignments, Tutorials, Lab ManualsØ Question bankØ Web-links, Blogs, Video Lectures, Journals Ø Animations /Simulations, SoftwaresØ Advanced topics

Page 25: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Linkages of the Course with other Courses and Professional Relevance

Ø Linkages with other coursesØ Professional relevance

Page 26: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Outline of Today’s discussion

1.General Guidelines2.Why Computer Programming (learning objective)3.How Logic building is important to an Engineer4.Sample definitions 5.Details of Course (Resources/Syllabus)6.Related Keywords.

Page 27: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Computer

• It is an electronic device which accepts data from our outside world (standard input devices) and manipulates or process it according to instruction given at high speed.

• It has memory to store large amount of data and can process it in accurate form.

• Computer is also called data processor because it can store, process and retrieve data whenever required.

• A computer follows a series of instructions, programmed into its memory by its user and outputs the information.

• Difference between data and information?

Page 28: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Computer System Characteristics

• Speed and accuracy• Diligence and maintainence• Vast storage media• Time factor• Permanent• Versatility

Page 29: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Applications of computer system

• There are various areas where computer can be used:• Reservation system (air, railway, bus)• Banking system• Library management• Hospital management• Hotel management• Space technology• Weather forecasting

Page 30: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Hardware

• Computer hardware is the collection of physical elements that constitutes a computer system.

• Computer hardware refers to the physical parts or components of a computer such as the monitor, mouse, keyboard, computer data storage, hard drive disk (HDD), system unit (graphic cards, sound cards, memory, motherboard and chips), etc. all of which are physical objects that can be touched

Page 31: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Software

• Computer software, or simply software, also known as computer programs, is the non-tangible component of computers.

• It represents the set of programs that govern the operation of a computer system and make the hardware run.

• Computer software contrasts with computer hardware, which is the physical component of computers.

• Computer hardware and software require each other and neither can be realistically used without the other.

• To help the computer to perform specific functions for itself. One major example is operating system. All computers require an operating system. E.g. OS ( Disk operating System, Windows, Linux, UNIX, Mac etc.)

Page 32: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Types of Software

• System Software• To control operation and extend the processing capabilities of computer

system.• e.g. Operating System, Compiler, Assembler, etc.

• Application Software• Designed for user specific need.• General purpose

• e.g. MS Office, Excel etc.• Specific purpose

• Custom built according to requirement of user.

Page 33: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

System Software

• Operating System• Compiler : translates high level language to machine level language• Assembler : translates assembly or low level language to machine language• Loader : which loads OS part and object program into main memory for

execution purpose. E.g. bootstrap loader.• Linker : which binds code of source and library file to make executable programs.• Editor : used to write a program.• Translator : which converts one language into other. (Compiler, Assembler,

Interpreter)• Macro processor : Replace symbolic meaning into equivalent code. Also, called

pre-processor.• Interpreter : translates line by line high level language into machine language.

Page 34: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

System software vs. Application softwareSr. No. Particular System software Application software

1. Purpose Comprises of those programs which directs the computer.

It is the software developed for solving business problems.

2. Varying nature

Varies from computer to computer. Varies from organization to organization.

3. Language Written in low-level language. Written in high level language.

4. Knowledge Detai l knowledge of hardware i s required.

Re q u i re s d e ta i l e d k n o w l e d g e o f organization.

5. Use Use to improve the performance and m a x i m u m u t i l i z a t i o n o f sy s t e m resources.

Use to improve speed and quality of a business activity.

6. Developed by The manufactures along with the hardware usua l l y supp ly system software.

Developed by individuals or supplied by sof t ware vendors as genera l i ze d application software.

Page 35: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Block Diagram

of Computer

Page 36: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Block Diagram

of Computer

Page 37: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Register

• Hardware register, a placeholder for information about some hardware condition

• Processor register, a component inside a central processing unit for storing information

• e.g. Program Counter (PC)

Page 38: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Central Processing Unit (CPU)• A central processing unit (CPU) is the hardware within a computer that

carries out the instructions of a computer program by performing the basic arithmetical, logical, and input/output operations of the system.

• CPU is a combination of ALU (arithmetic logic unit) and CU (Control Unit).• ALU

• Here actual execution instruction takes place during processing operation.• It performs all arithmetic calculations and takes logical decision.• It can compare, count, shift or other logical activities. All such calculations and

comparisons are done in this unit.• It takes data from memory unit and return information (processed data) to memory

unit if storage requires.

Page 39: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Central Processing Unit (CPU)• CU

• It manages and coordinates operations of all other components of computer system. It also performs following functions:

• It retrieves instruction or data from memory.• It decodes instruction.• It coordinates time sequence of instruction among various component

of system.• It determines requirement of storage and take action according to it.• It also fetches instruction from main memory.

Page 40: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Bus and System Bus

• In computer architecture, a bus is a communication system that transfers data between components inside a computer, or between computers.

• It covers all related hardware components (wire, optical fiber, etc.) and software, including communication protocols.

• Can be parallel or serial.

Page 41: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Bus and System Bus

Page 42: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Memory Unit

• Storage unit for processing data and information.• Holds instructions and data needed for programs that are currently running• Two types of storage:

• Primary/Main storage• Secondary storage

Page 43: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Classification of Main Memory1. Random Access Memory (RAM)

1. Stores current program or data.2. Stores temporary data of current program.3. Less space in comparison to secondary storage.4. Volatile (data losses on power off)5. Comparatively more expensive.6. Fast in operation.

2. Read Only Memory (ROM)

Page 44: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Random-Access Memory (RAM)• Static RAM (SRAM)

• Each cell stores bit with a six-transistor circuit.• Retains data, as long as it is kept powered.• Relatively insensitive to disturbances such as electrical noise.• Faster (8-16 times faster) and more expensive (8-16 times more expensive as well)

than DRAM.• Used in cache of the processor.

• Dynamic RAM (DRAM)• Each cell stores bit with a capacitor and transistor.• Data must be refreshed every 10-100 ms.• Sensitive to disturbances.• Slower and cheaper than SRAM.• Used in smartphones, tablets, laptops etc.

Page 45: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Read only Memory(ROM)

• ROM is used for storing programs that are PERMANTLY resident in the computer and for tables of constants that do not change in value once the production of the computer is completed

• The ROM portion of main memory is needed for storing an initial program called bootstrap loader, witch is to start the computer software operating when power is turned on

Page 46: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Types of Read only Memory (ROM)§ PROM

§ PROM stands for Programmable Read Only Memory. This form of ROM is initially blank. The user or manufacturer can write data/program on it by using special devices. However, once the program or data is written in PROM chip, it cannot be changed. If there is an error in writing instructions or data in PROM, the error cannot be erased. PROM chip becomes unusable.

§ EPROM§ EPROM stands for Erasable Programmable Read Only Memory. This form of ROM is also initially

blank. The user or manufacturer can write program or data on it by using special devices. Unlike PROM, the data written in EPROM chip can be erased by using special devices and ultraviolet rays. So program or data written in EPROM chip can be changed and new data can also be added. When EPROM is in use, its contents can only be read.

§ EEPROM§ EEPROM stands for Electrically Erasable Programmable Read Only Memory. This kind of ROM

can be written or changed with the help of electrical devices. So data stored in this type of ROM chip can be easily modified.

Page 47: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Secondary Memory• A nonvolatile storage medium• Contents retained while power is off• Hard disk drives are most common

• Records data magnetically on a circular disk• Provides fast access to large amounts of data

• USB flash memory devices• High capacity device plugs into USB port• Portable, reliable, and fits easily in a pocket

• e.g. Hard disk (HDD), CD, DVD, Pen Drive, Removable hard disk

Page 48: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Input Devices

• Accept data and instructions from the user or from another computer system

48

Keyboard Mouse

Page 49: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Scanner49

Joy Stick

Page 50: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Light Pen

50

Web Camera

Page 51: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Touch Screen

51

Mike

Page 52: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Output Devices

Return Processed data back to the user or other computer system

52

Dot Matrix Printer Line Printer

Page 53: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Speakers

53

Monitor

Page 54: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Classification of programming languages

• Machine or Low level language• Assembly language• High level language

• Note: Refer any Computer fundamental book for details.

Page 55: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Summary of characteristics of languages

Sr. No Language Characteristics

1. Machine Language 1. Machine dependent2. Uses special codes and assignment of storage address

2. Assembly Language 1. Machine dependent2. Uses mnemonics3. 1 to 1 language i.e. for assembly language instruction

generated3. High-level Language 1. Machine independent

2. Uses instructions which seem English – like.3. 1 to many language i.e. for high level instruction, many

machine language generated (OS specific).

Page 56: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Summary of characteristics of languages

High-level (ex. C) Assembly Machine Language

int varY;int varX = (varY + 14) * 13;

mov edx, varYadd edx,14mov ecx,13imul ecxmov varX,edx

328A 1234 00013200 1234 000E328A 1222 000D310C 1222328A 0005 1234

Assembly language mnemonics to machine code is just for illustration. It varies for different machine architecture

Page 57: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Compiler• Compiler is a computer program (or set of programs) that transforms source

code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code). The most common reason for wanting to transform source code is to create an executable program.

• The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language or machine code).

• If the compiled program can run on a computer whose CPU or operating system is different from the one on which the compiler runs, the compiler is known as a cross-compiler.

• A program that translates from a low level language to a higher level one is a decompiler.

• A program that translates between high-level languages is usually called a source-to-source compiler.

Page 58: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Interpreter

A translating program that translates and executes the statements in sequence

• Assembler or compiler produce machine code as output, which is then executed in a separate step i.e. translates line by line conversion of high level language into low level programs.

• An interpreter translates a statement and then immediately executes the statement

• Interpreters can be viewed as simulators

58

Page 59: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Compilers

59

How does this differ fromthe assembly process?

Page 60: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Assembler• An assembler is a program that takes basic computer instructions (assembly

language) and converts them into a pattern of bits (machine language) that the computer's processor can use to perform its basic operations.

• e.g. Microprocessor 8085, 8088.• Instruction: ADD A, R2• Converted to : 29

• Note: Refer any computer fundamentals book for details.

Page 61: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Compiler vs. InterpreterSr. No. Particular Compiler Interpreter

1. Scheme C o m p i l e r s c a n s t h e w h o l e program at a time and lists out error if any.

Interpreter scans the program line by line and stop scanning whenever error occurs.

2. Manner Compiler converts the whole source code into object code at a time.

Interpreter converts the source programs.

3. Source Code

After compilation, source code is not required.

For every execution run, source is required.

4. Speed Execution is faster Execution is slower.

5. Object Code The object code is generated when the program is error free.

Generates object code for each line immediately if it is error free.

6. Memory Requires more memory. Requires less memory.

7. Examples C, C++ Python, Ruby

Page 62: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Compiler vs. Interpreter

Page 63: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Operating System(OS)

• Operating System is a software, which makes a computer to actually work.• It is the software the enables all the programs we use.• The OS organizes and controls the hardware.• OS acts as an interface between the application programs and the machine

hardware.• Examples: Windows, Linux, Unix and Mac OS, etc.,

Page 64: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

What OS does?

An operating system performs basic tasks such as, • controlling and allocating memory, • prioritizing system requests, • controlling input and output devices, • facilitating networking and • managing file systems.

Page 65: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Structure of Computer Software System

Application Programs

System Programs

Software (Operating System)

HARDWARE

Page 66: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

The structure of OS consists of 4 layers:1. Hardware Hardware consists of CPU, Main memory, I/O Devices, etc,

2. Software (Operating System) Software includes process management routines, memory management routines, I/O

control routines, file management routines.

3. System programs This layer consists of compilers, Assemblers, linker etc.

4. Application programs This is dependent on users need. Ex. Railway reservation system, Bank database

management etc.

Structure of Computer Software System

Page 67: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Computer Architecture

Page 68: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Program Execution

Translation: The entire high level program is translated into an equivalent machine language program. Then the machine language program is executed.Interpretation: Another program reads the high level program instructions one-by-one and executes a equivalent series of machine language instructions.Program translation uses a collection of tools to perform the translation: Compiler: Translates high level language programs into a lower level language often called object code. Assembler: Translates assembly language instructions into object code. Linker: Combines collections of object code into a single executable machine language program.

Page 69: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling
Page 70: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

From Theory to Practice

In theory, computer can compute anything that’s possible to compute• given enough memory and timeIn practice, solving problems involves computing under constraints.• time

• weather forecast, next frame of animation, ...• cost

• cell phone, automotive engine controller, ...• power

• cell phone, handheld video game, ...

Page 71: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling
Page 72: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling
Page 73: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Diff. Between CO and CA• Computer Architecture refers to those attributes of a system visible to a

programmer, the other way those attributes that have direct impact on the logical execution of the program.

• Computer Organization refers to the Operational Units and there interconnections that realize or recognize the specifications of Computer Architecture.

• Examples of the Architectural attributes include the instruction set, the no of bits used to represent the data types, Input Output mechanism and technique for addressing memories.

• Examples of Organizational attributes includes Hardware details transparent to the programmer such as control signals, Interface between computers and peripherals and the memory technology used.

• Many computer manufacturers offer the family of computer models, all of the same architecture but with differences in organization. Computer Architecture may remain for several years but organization changes with changing technology.

Page 74: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Computer Architecture

Page 75: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Summary

Fundamentals aspects such as- Inputs, Outputs, Assembler, Complier, Loader, Linker, OS, Buses, CO, CA etc

Page 76: Computer Programming (CE103) B.Tech. Semester I · Library Functions for string, String-Manipulation Functions of the String-Handling Library, Comparison Functions of the String-Handling

Thank You!!