Programming Concepts II

Add to Favourites
Post to:

Description
The content talks about the various concepts used in most of the programming languages. It is extremely beneficial to the beginners in programming as it clears the very basic related concepts in a simple manner.

Comments
Presentation Transcript Presentation Transcript

Slide 1 : Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi PROGRAMMING CONCEPTS - II Ruchi Sharma ruchisharma1701@gmail.com

Slide 2 : Contents Quick Recall – Programming Concepts Components of a programming language Variables Constants Data types & Expressions Input & Output (I/O) Statements Conditional statements Looping constructs Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi

Slide 3 : Quick Recall - Programming Concepts Computer languages can be classified in two broad categories - Low level languages(machine friendly) and High level languages(user friendly) We usually use HLL for programming to solve a given problem. While programming, we can use either of the two approaches – procedural or object oriented. A translator program called Complier converts the HLL program to a LLL program understandable by the computer. Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi

Slide 4 : Computer & User -Who does what ? Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi

Slide 5 : Computer & User -Who does what ? (Contd.) Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi * Note : During processing, the computer also stores the intermediate results, if any, in the memory.

Slide 6 : Components of a Programming Language Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi A programming language has the following components Variables Constants Data types Expressions Input & Output statements Conditional Statements Looping Constructs

Slide 7 : Variables Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi Variables

Slide 8 : Variables (Contd.) Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi The information is stored in the memory in these cells. A variable can be understood as “a location name”. Examples The statement x = 10 will store the value 10 in a memory location(depicted by a cell in the figure) named x. The statement s = ‘ruchi’ will store the string “ruchi” in the variable s.

Slide 9 : Variables - Facts Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi A variable is allocated memory randomly. Each variable holds an information of a particular type. Variables are used in a program to refer to the location(s) where data needed by the program is/are stored. The value of a variable can be changed i.e. varied(hence the name “VARIable”) Each time the value of a variable is written into memory, the older one is washed out and the new one is retained.

Slide 10 : Constants Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi A constant is a value that remains unchanged. A constant can be a numeric constant or a character/string constant. The examples used previously contain the constants 10 (numeric constant) & “ruchi”(string constant) respectively. A constant value can be assigned to a variable whereas the reverse is not valid. E.g. – x = 10 is acceptable whereas 10 = x is not !

Slide 11 : Data Types Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi A data type is something which determines the type of data that a variable can hold. There are three basic types of data that are commonly used integer, real & string. Related data of same type can be stored in adjacent locations & is called an array. The elements of an array are denoted by the same name but different subscripts. E g - the roll numbers of the students of a class of 5 can be stored in an array named ROLL & the roll numbers can be referred to as ROLL[1], ROLL[2], ROLL[3], ROLL[4], ROLL[5].

Slide 12 : Data Types (Contd.) Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi These roll numbers can be assigned values as : ROLL[1] = 961001 ROLL[2] = 961002 ROLL[3] = 961003 ROLL[4] = 961004 ROLL[5] = 961005 These will be stored in memory in contiguous locations as :

Slide 13 : Expressions Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi An expression is a combination of some operators and operands. e.g. – In mathematics, 7 x (4 + 19 ) – 34 / 5 is an expression. (a – b) + c / 60 is an expression. In computer languages also, the expressions are similar to those in mathematics, just that some symbols are different like, we use * for a sign of multiplication. Every language specifies an order in which the operators are evaluated in an expression.

Slide 14 : Input and Output Statements Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi Input An input statement is used to take the input(s) from the user. The value(s) inputted by the user is/are stored in the designated variable(s) in memory. e.g. – an input statement in the language C is as under scanf(“%d”, &x); after execution of the above statement, the computer prompts the user to enter a value. the value entered by the user is stored in the variable x in memory.

Slide 15 : Input and Output Statements (Contd.) Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi Output An output statement is used to display an output to the user. a message to the user. e.g. – an output statement in the language C is as under printf(“%d”, x); after execution of the above statement, the value of the variable x is displayed for the user. printf(“Hello Boss !”); after execution of the above statement, the message Hello Boss ! is displayed for the user.

Slide 16 : Conditional Statements Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi In a programming language, there are statements which check for a condition and accordingly the execution flow can be changed. The most common conditional construct is of the format IF (condition) THEN ---------------------- ELSE -------------------- Here, if the condition* evaluates to be “true”, THEN part is executed (& ELSE part is skipped) & if it evaluates to “false”, ELSE part is executed ( & IF part is skipped). *NOTE - the condition should be a valid expression that can be evaluated to either true or false.

Slide 17 : Looping Constructs Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi Looping constructs are used when we need to repeat a task a number of times or till some condition is met. A looping construct should have an initial condition – which starts the loop an increment – which advances the loop a termination condition – which helps come out of the loop The loops used in C language are : do - while while for

Slide 18 : Thank You Ruchi Sharma ruchisharma1701@gmail.com http://www.wiziq.com/tutor-profile/376074-Ruchi

Want to learn?

Sign up and browse through relevant courses.

Name:
Your Email:
Password:
Country:
Contact no:


Area code Number
Subjects you are interested in:
Word verification: (Enter the text as in image)


Sign Up Already a member? Sign In
I agree to WizIQ's User Agreement & Privacy Policy
11 Members Recommend
81 Followers

Your Facebook Friends on WizIQ

Explore Similar Courses

The Art of Remembering Names and Faces

Price:$10

Special Limited Period Price

Improve Photographic Memory Power

Price:$225
$150

SAVE 33% : Special Offer

Give live classes, create & sell online courses

Try it free Plans & Pricing

Connect