Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore E-LESSON-1

E-LESSON-1

Published by Teamlease Edtech Ltd (Amita Chitroda), 2020-10-24 03:21:28

Description: E-LESSON-1

Search

Read the Text Version

IDOL Institute of Distance and Online Learning ENHANCE YOUR QUALIFICATION, ADVANCE YOUR CAREER.

BCA 2 All right are reserved with CU-IDOL Computer Programming Course Code: BCA 112 Semester: First SLM Units: 1, 2 e-Lesson No.: 1 www.cuidol.in Units-1, 2 (BCA112)

Introduction to Computer & 33 Programming, and Fundamentals of C OBJECTIVES IINNTTRROODDUUCCTTIIOONN • Define computer, draw the block diagram of In this session we are going to learn about computer • Computer and its block diagram • Functioning of different components of computer • Explain functioning of different components of • Algorithm and flowcharts computer. • Structure of C program • Comments and header files • Describe algorithm, and flowcharts • C data types, Constants and variables • List the features of C language • Describe the structure of C program • Define comments and header files • Explain C data types • Differentiate constants and variables www.cuidol.in Units-1, 2 (BCA112) INASlTl ITriUgThEt OarFeDrIeSsTeArNvCeEd AwNitDh OCNUL-IIDNOE LLEARNING

TOPICS TO BE COVERED 43 • Block Diagram of Computer and Functioning INTRODUCTION • Characteristics of Computer • Algorithms and Flowchart • Features of C Language • Structure of C Program • Comments • Header Files • Data Types • Constants and Variables www.cuidol.in Units-1, 2 (BCA112) INASlTl ITriUgThEt OarFeDrIeSsTeArNvCeEd AwNitDh OCNUL-IIDNOE LLEARNING

Block Diagram of 5 Computer and Functioning • Computer is an electronic device which stores data ,process it according to a list of internally stored instructions, and gives the result consistently ,accurately at very high speed. • A computer is divided into three basic units namely: Input Unit Central Processing Unit Output Unit www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Characteristics of Computer 6 • SPEED : In general, no human being can compete to solving the complex computation, faster than computer. • ACCURACY : Since Computer is programmed, so what ever input we give it gives result with accurately. • STORAGE : Computer can store mass storage of data with appropriate format. • DILIGENCE : Computer can work for hours without any break and creating error. • VERSATILITY : We can use computer to perform completely different type of work at the same time. • POWER OF REMEMBERING : It can remember data for us. • NO IQ : Computer does not work without instruction. • NO FEELING : Computer does not have emotions, knowledge, experience, feeling. www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Algorithms and Flowchart • Algorithm is a step by step procedure, which defines a set of instructions to be executed in certain order to 7 get the desired output. • An algorithm are generally analyzed on two factors − time and space. That is, how much execution time and how much extra space required by the algorithm. • With algorithms, we can easily understand a program. • Following are the characteristics of Algorithm:  Unambiguous − Algorithm should be clear and unambiguous. Each of its steps should be clear and must lead to only one meaning.  Input − An algorithm should have 0 or more well-defined inputs.  Output − An algorithm should have 1 or more well-defined outputs, and should match the desired output.  Finiteness − Algorithms must terminate after a finite number of steps.  Effectiveness- It is measured in terms of time and space. www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Algorithms and Flowchart 8 •A flowchart is the graphical or pictorial representation of an algorithm with the help of different symbols, shapes and arrows in order to demonstrate a process or a program. •The main purpose of a flowchart is to analyze different processes. •Several standard graphics are applied in a flowchart: Connector/ Arrow www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Algorithms and Flowchart 9 Example: Convert Temperature from Fahrenheit (℉) to Celsius (℃) Algorithm: Step 1: Read temperature in Fahrenheit, Step 2: Calculate temperature with formula C=5/9*(F-32), Step 3: Print C, Flowchart: www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Features of C Language 10 •C is a powerful general-purpose programming language. It is fast, portable and available in all platforms. •C programming is highly efficient. That’s the main reason why it’s very popular despite being more than 40 years old. •Dennis Ritchie create the “C” programming language, so we call him “Father of the C programming language”. www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Features of C Language 11 C is the widely used language. It provides many features that are given below. Simple Machine Independent or Portable Mid-level programming language structured programming language Rich Library Memory Management Fast Speed Pointers Recursion Extensible www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Structure of C Program 12 •A C program can be viewed as a group of Documentation section building blocks called functions. Link section Definition section •A function is a self content block of statements Global declaration section designed to perform a specific task. main() function section { •A C program may contain some or all sections shown in Fig. Declaration part Executable part } Subprogram section Function 1 Function 2 . . Function n www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Comments 13 •Comments in C language are used to provide information about lines of code. •It is widely used for documenting code. •There are 2 types of comments in the C language. Single Line Comments // program to print hello Multi-Line Comments /* Multiline line comments */ www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Header Files 14 •A header file is a file with extension .h which contains C function declarations and macro definitions to be shared between several source files. •There are two types of header files: the files that the programmer writes and the files that comes with your compiler. •Both the user and the system header files are included using the preprocessing directive #include. It has the following two forms − #include <file> This form is used for system header files. #include \"file“ This form is used for header files of your own program. www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Data Types 15 •In C programming, data types are declarations for variables. This determines the type and size of data associated with variables. www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Data Types 16 •In C programming, data types are declarations for variables. This determines the type and size of data associated with variables. www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Constants and Variables 17 •Constants are the identifiers with fixed values that do not change during the execution of the program. •Simply constant means whose value cannot be changed. •Constant declaration syntax - const datatype variable = value; const int b = 100; www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Constants and Variables 18 •Variables are the identifiers whose values change during the execution of the program. •It is called variable because it can hold different values at a different time. •Variable declaration syntax - datatype variable = value; int count = 110; •Rules for Naming Variables The first letter of a variable name must be alphabet (underscore is also allowed). Variable can only contain letters, digits, and underscores. White space is not allowed. Keywords cannot be used as an identifier to name variables. Since C is case sensitive language variable name written in uppercase will differ from lowercase. www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Multiple Choice Questions 1. A computer is divided into how many basic units: 19 a) 2 b) 3 c) 4 d) 5 2. The flowchart provides pictorial representation of _________. a) Algorithm b) Executable code c) Pseudocode d) All of these 3. The _______ symbol is used to represent process in flowchart. a) Circle b) Diamond c) Rectangle d) None of these Answers: 1.b) 2.a) 3.c) www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

Multiple Choice Questions 20 4. Which is NOT the feature of C language? a) Simple b) Portable c) Extensible d) None of the above 5. Size of float data type is _______ bytes. a) 2 b) 4 c) 8 d) 10 Answers: 4.d) 5.b) www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

SUMMARY 21 Let us recapitulate the important concepts discussed in this session: • Computer is an electronic device which stores data ,process it according to a list of internally stored instructions, and gives the result consistently ,accurately at very high speed. • A computer is divided into three basic units namely: Input Unit, Central Processing Unit and Output Unit. • Characteristics of computer include –SPEED, ACCURACY, STORAGE, DILIGENCE, VERSATILITY, POWER OF REMEMBERING, NO IQ, NO FEELING. • Algorithm is a step by step procedure, which defines a set of instructions to be executed in certain order to get the desired output. A flowchart is the graphical or pictorial representation of an algorithm. www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

SUMMARY 22 • C is a powerful general-purpose programming language. It is fast, portable and available in all platforms. • C is the widely used language. It provides many features including – Simple, Machine Independent or Portable, Mid-level programming language, structured programming language, Rich Library, Memory Management, Fast Speed, Pointers, Recursion, Extensible. • A C program can be viewed as a group of building blocks called functions. • Comments in C language are used to provide information about lines of code. • In C programming, data types are declarations for variables. This determines the type and size of data associated with variables. • Constants are the identifiers with fixed values that do not change during the execution of the program. • Variables are the identifiers whose values change during the execution of the program. www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

FREQUENTLY ASKED QUESTION 23 Q1. Describe the three basic units of computer. Ans: A computer is divided into three basic units namely: Input Unit, Central Processing Unit and Output Unit. For Further details please refer to the subject SLM unit 1. Q2. Elaborate the features provided by C language. Ans: C provides many features including – Simple, Machine Independent or Portable, Mid-level programming language, structured programming language, Rich Library, Memory Management, Fast Speed, Pointers, Recursion, Extensible. For Further details please refer to the subject SLM unit 2. Q3. Illustrate C data types. Ans: In C programming, data types are declarations for variables. This determines the type and size of data associated with variables. For Further details please refer to the subject SLM unit 2. www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

REFERENCES 24 • CU-IDOL’s “Computer Programming” SLM • Balaguruswamy (2017).Programming in ANSI C. New Delhi: McGraw-Hill. • Kanetkar, Y. (2014), Programming in C ANSI standard.New Delhi: BPB Publications. • Gottfried (2005).Programming with C. New York: Tata McGraw Hill. • Harrow K., Jones J. (1996).Problem Solving with C. London: Pearson Education. • Jeri R., Hanly,KoffmanE.P. (2000).Problem Solving and Program Design in C. 3rd Ed. Boston: Addison Wesley. www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL

25 THANK YOU www.cuidol.in Units-1, 2 (BCA112) All right are reserved with CU-IDOL


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook