Written as per the revised G Scheme syllabus prescribed by the Maharashtra State Board of Technical Education (MSBTE) w.e.f. academic year

Size: px
Start display at page:

Download "Written as per the revised G Scheme syllabus prescribed by the Maharashtra State Board of Technical Education (MSBTE) w.e.f. academic year"

Transcription

1

2 Written as per the revised G Scheme syllabus prescribed by the Maharashtra State Board of Technical Education (MSBTE) w.e.f. academic year Programming in C Computer Engineering Group First Year Diploma Semester - II First Edition: November 2015 Salient Features Concise content with complete coverage of revised G-scheme syllabus. Simple and Lucid language. Illustrative programs with detailed explanation. MSBTE Theory Questions and Programming questions from Summer-2011 to Winter MSBTE Question Papers of Summer, Winter and Three Model Question Papers for practice. Important Inclusions: Additional Theory Questions, Practice Programs. Printed at: Repro Knowledgecast Ltd., Mumbai No part of this book may be reproduced or transmitted in any form or by any means, C.D. ROM/Audio Video Cassettes or electronic, mechanical including photocopying; recording or by any information storage and retrieval system without permission in writing from the Publisher. TEID : 970

3 PREFACE In the case of good books, the point is not how many of them you can get through, but rather how many can get through to you. Target s Programming in C is a complete and thorough book critically analysed and extensively drafted to boost the students confidence. The book is prepared as per the revised scheme [G-scheme] of MSBTE curriculum effective from June Every chapter is divided into sub-topics as per the requirement of the syllabus. The arrangement of the sub-topics are such that it helps the students in easy comprehension. Each chapter includes the following features: Theory is provided point-wise. Explanatory diagrams have been provided wherever required. Definitions are in italic representation. Illustrative Programs are provided with detailed explanation and programming comments which lead to the smooth and detailed understanding of the program. MSBTE Theory Questions covered in separate section to give a clear idea of the type of questions asked. (Reference of answer to each question is provided.) MSBTE Programming Questions till latest year are included along with its answers. Additional Theory Questions help the students gain insight on the various levels of theory-based questions. Programs for Practice in every chapter for students to improve their programming skills. MSBTE Question Papers of years 2014 and 2015 are added at the end to make students familiar with the examination. Three Model Question Papers are provided to prepare students for examination. The journey to create a complete book is strewn with triumphs, failures and near misses. If you think we ve nearly missed something or want to applaud us for our triumphs, we d love to hear from you. Please write to us on : mail@targetpublications.org A book affects eternity; one can never tell where its influence stops. Best of luck to all the aspirants! From, Publisher

4 SYLLABUS Topic 1 - Basics of C Topic and Contents Hours Marks Specific objectives: State rules for declaration of variables, constants and operators. Write simple program using formatted input and formatted output. Contents: History of C, where C stands C character set, tokens, constants, variables, keywords, identifiers C operators- arithmetic, logical, assignment, relational, increment and decrement, conditional, bit wise, special, operator precedence, C expressions data types. Problem solving techniques : flowchart and algorithm. Formatted input, formatted output instructions. Topic 2 - Decision making Specific objectives: Write a simple program using decision making, branching statement, looping statement. Describe use of break and continue statement. 2.1 Decision making and branching if-statement if, if-else, else-if ladder, nested if else, switch case statement, break statement [14 M] 2.2 Decision making and looping - while, do, do- while statement, for loop, continue statement [14 M] Topic 3 - Arrays and Strings Specific objectives: Give syntax of single dimensional, multidimensional array and strings. Write a program using array and string. 3.1 Arrays Declaration and initialization of one dimensional, two Dimensional and character arrays, accessing array elements. [10 M] 3.2 Declaration and initialization of string variables, string handling functions from standard library strlen(), strcpy(), strcat(), strcmp() [8 M] 10 18

5 Topic 4 - Functions and Structures Specific objectives: State the scope of local and global variable. Understand the category of function call and function type and write program. Write and execute the program using command-line argument. Write a program using structure. 4.1 Functions: Need of functions, scope and lifetime of variables, defining functions, function call, call by value, call by reference, return values, storage classes. Category of function: No argument No return value, No argument with return value, argument with return value, recursion, command line arguments. [16 M] 4.2 Structures: Defining structure, declaring and accessing structure members, initialization of structure, arrays of structure. [8 M] Topic 5 Pointers Specific objectives: State the declaration syntax of pointer, pointer initialization Write the program using pointer arithmetic Understanding pointers, declaring pointer variable, initialization of pointer variable, accessing address of a variable, pointer expressions, pointers arithmetic TOTAL

6 Contents Chapter No. Topic Page No. 1 Basics of C 1 2 Decision Making 35 3 Arrays and Strings 78 4 Functions and Structure Pointers 151 Model Question Papers Model Question Paper I 169 Model Question Paper II 171 Model Question Paper III 174 MSBTE Question Papers Question Paper Summer Question Paper Winter Question Paper Summer Question Paper Winter Appendix ASCII Values of characters 186

7 Target Publications Pvt. Ltd. Chapter 1 Basic Physics Chapter (F.Y.Dip.Sem.-1) 01: Basics MSBTE of 'C' Basics of 'C' 1.1 History of C 1.2 The C Character Set 1.3 Tokens In C 1.3.(a) Semicolons and Comments 1.3.(b) Identifiers 1.3.(c) C Keywords 1.3.(d) Constants 1.3.(e) Type Qualifiers 1.3.(f) Variables 1.4 Basic Structure of a C Program 1.4.(a) C Header Files and Standard Library Functions 1.5 Input and Output 1.5.(a) Input Functions 1.5.(b) Output Functions 1.6 The First C Program 1.6.(a) Steps to compile and execute a C program 1.6.(b) C Instructions 1.7 C Operators 1.7.(a) Arithmetic Operators 1.7.(b) Relational Operators 1.7.(c) Logical Operators 1.7.(d) Assignment Operators 1.7.(e) Bitwise Operators 1.7.(f) Miscellaneous Operators 1.7.(g) Operators Precedence and Associativity in C 1.8 Formatted Input and Output 1.8.(a) Formatted Input 1.8.(b) Formatted Output 1.8.(c) Format Specifications 1.9 Problem Solving Techniques 1.9.(a) Algorithms 1.9.(b) Flowcharts 1

8 Target Publications Pvt. Ltd. Prog. in C (F.Y.Dip.Sem.-2) (Comp. Engg.) MSBTE 1.1 History of C What is C? C is a programming language developed at AT & T s Bell Laboratories of USA in It was designed and written by a man named Dennis Ritchie. In the late seventies C began to replace the more familiar languages of that time like PL/I, ALGOL, etc. The C language is popular because it is reliable, simple and easy to use. Historical development of C: Year Language Developed by Remarks 1960 ALGOL International Committee Too general, too abstract 1963 CPL Cambridge University Hard to learn, difficult implement BCPL Martin Richards at Could deal with only specific problems. Cambridge University 1970 B Ken Thomson at AT & T Could deal with only specific problems C Dennis Ritchie at AT & T Lost generality of BCPL and B restored. This is the C language which we are going to study. Some important features of C language are given below. a. C language has several built-in functions and operators which can be used to write any complex program. b. The programs written in C language are portable, i.e. they can be run on all the compilers with least or negligible modifications. c. The C language also supports user-defined data types and user-defined functions which can be designed as per the requirement of the programmer. Thus C has the ability to extend itself. d. The C language is essentially an assembly level language with features of high-level language. 1.2 The C Character Set A character denotes any alphabet, digit or special symbol used to represent information. The following table shows the valid alphabets, numbers and special symbols allowed in C. Alphabets A, B,.., Y, Z a, b,, y, z Digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Special symbols ~ # % ^ & * ( ) _ - + = \ { } [ ] : ; " ' < >,.? / 1.3 Tokens In C A C-program consists of various tokens. A token is a keyword, an identifier, a constant, a string literal or a symbol. For example, consider the following C statement which consists of five different tokens: printf("hello, World! \n"); The individual tokens in above statement are: printf ( "Hello, World! \n" ) ; 2

9 Target Publications Pvt. Ltd. Basic Physics Chapter (F.Y.Dip.Sem.-1) 01: Basics MSBTE of 'C' 1.3.(a) Semicolons and Comments: i. Semicolons: A semicolon is used as a statement terminator in C. This means, each individual statement must be ended with a semicolon. E.g. printf("hello, World! \n"); int a; scanf("%d",&a); ii. Comments: Comments in C program are ignored by the compiler. These statements allow other user to better understand the code. These statements also help while debugging a program. They start with /* and terminates with the characters */ E.g. /* my first program in C */ /* Declaration */ Comments cannot be written within comments. Also they do not occur between a string or character literals. 1.3.(b) Identifiers: i. Any variable, function, data definition or anything that is defined by user is referred as an identifier. ii. An identifier is a combination of letters (A-Z, a-z, underscores) and digits (0 to 9) but must begin with a letter. iii. No special characters, such as semicolon, blank space, slash or comma are allowed in C. iv. C is a case sensitive programming language. Hence Number and number are treated as two different identifiers. v. An identifier cannot be a keyword. vi. Some examples of acceptable identifiers are given below: roll_number, v1, add etc. 1.3.(c) C Keywords: i. Keywords are the words that have predefined meaning in C. ii. The keywords cannot be used as variable names. iii. The keywords are also called Reserved words. iv. There are 32 keywords available in C, which are listed below: auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void default goto sizeof volatile do if static while These keywords are used as per the requirement in a program. v. For example, the keywords int, char, float are used to define the data type of a variable, function and structure. Similarly the keywords if, else, for are used as conditional statements. 3

10 Target Publications Pvt. Ltd. Prog. in C (F.Y.Dip.Sem.-2) (Comp. Engg.) MSBTE 1.3.(d) Constants: A constant is a value that doesn t change during the execution of a program. This value can be stored at a location in the memory of a computer. Types of C Constants: C constants can be divided into two major categories: a. Primary Constants b. Secondary Constants These constants are further categorized as shown. C constants Primary constants Secondary constants We will discuss only primary constants in this chapter. The secondary constants are discussed in detail in next chapters. Primary Constants are of three types, viz., i. Integer constants ii. Real constants (Floating point constants) iii. Character constants i. Integer Constants: a. An integer constant is a sequence of digits. b. The following rules are followed, while constructing integer constants, i. It must have at least one digit and should not contain a decimal point. ii. It can be either positive or negative. If no sign precedes an integer constant it is assumed to be positive. iii. No commas or blanks are allowed within an integer constant. iv. The allowable range for integer constants is to for a 16-bit compiler. For a 32-bit compiler the range is 2,147,483,648 to 2,147,483,647. c. Some examples of integer constants are 426, +782, 8000, ii. Integer constant Real constant Character constant Array Pointer Structure Union Enum, etc. Real Constants: a. Real constants are often called Floating Point constants and are essentially numbers with decimal point. b. The real constants can be written in two forms Fractional form and Exponential form. c. The following rules are followed, while constructing real constants in fractional form, i. A real constant must have at least one digit. ii. It must have a decimal point. 4

11 Target Publications Pvt. Ltd. Basic Physics Chapter (F.Y.Dip.Sem.-1) 01: Basics MSBTE of 'C' iii. iii. It could be either positive or negative. iv. The default sign of a real constant is positive. v. No commas or blanks are allowed within a real constant. vi. Some examples of real constants in decimal form are , 426.0, 32.76, d. The following rules are followed, while constructing real constants in fractional form, i. In exponential form the real constant is expressed in two parts separated by letter e. ii. The part appearing before e is called the mantissa whereas the part following e is called the exponent. iii. The mantissa can be a real number expressed in decimal notation or it can be an integer. iv. The mantissa can have either positive or negative sign. The default sign is positive. v. The exponent is an integer with either positive or negative sign. The default sign of exponent is positive. vi. Range of real constants expressed in exponential form is 3.4e38 to 3.4e38. vii. Some examples of real constants in exponential form are +3.2e 5, 4.1e8, 0.2e+3, 3.2e 5. Character Constants: a. A character constant can be a single alphabet, a single digit or a single special symbol enclosed within single inverted commas. b. The maximum length of a character constant should be 1 character. c. Each character constant has an integer value known as ASCII value. The ASCII values of all characters are given in the table of Appendix. d. Some examples of character constants are 'a', 'A', 'B', '6', '='. 1.3.(e) Type Qualifiers: In C language, every data type can be further qualified using type qualifiers. Thus, qualifier is keyword which is applied to a data type and results in a qualified data type. There are total five categories of qualifiers. Each category has a default qualifier which is applied when name of qualifier is not mentioned along with the data type. The various qualifiers used in C language are mentioned in the table below: Qualifier Default qualifier 1. auto, register, static, auto extern, typedef auto 2. signed, unsigned signed 3. short, long not short, not long* 4. const not const* 5. volatile not volatile* 1.3.(f) Variables: A variable is an entity that may change and take different values at different times during the execution of the program. It is a name given to a memory location where a data is stored. 5

12 Target Publications Pvt. Ltd. Prog. in C (F.Y.Dip.Sem.-2) (Comp. Engg.) MSBTE The following example demonstrates the idea of a variable. Here 3 is stored in a memory location which is named as v. Then a new value 5 is assigned to the same memory location v. This would overwrite the earlier value 3, since a memory location can hold only one value at a time. This is shown below. v = 3 v = 5 v 3 v 5 Memory location of v Memory location of v (after assigning new value) i. Data types of C Variables: The data types in C, specifies what type of data can be stored in a variable. Date types are of the following three categories: 1. Primary data types 2. User-defined data types 3. Derived data types The different primary data types are as follows: a. Character (char) type: The character (char) data type can be used to define any single character. It usually takes 1 byte (8 bits) of space. They are of two types, viz. 1. signed 2. unsigned The default type is signed char type. E.g.: char a = 'A'; Here the character 'A' is assigned to the char variable a. b. Integer (int) type: The integer (int) data type is used to define a variable accepting any integer number. The int data type are of following types: 1. short int 2. int 3. long int Each of the above three int data types can be either signed or unsigned. However the default type is signed. E.g.: int a = 20; Here the integer value 20 is assigned to the int variable a. The difference between the short int and long int is given below: Short int Long int i. Stores smaller value of integers than int data type. Stores larger value of integer than int data type. ii. Range is -128 to 127 for signed short int and 0 to 255 for unsigned short int Range is -2,147,483,648 to 2,147,483,647 for signed long int and 0 to 4,294,967,295 for unsigned long int. iii. Requires lesser memory space Requires more memory space than int. than int data type. iv. Memory space required is 8 bits (1 byte) Memory space required is 32 bits (4 bytes) v. Syntax: short int a; Syntax: long int a; 6

13 Target Publications Pvt. Ltd. Basic Physics Chapter (F.Y.Dip.Sem.-1) 01: Basics MSBTE of 'C' c. Floating point (float) types: The floating point (float) data type is used while dealing with real numbers (decimals). Depending upon the accuracy of the value required, the float data type has the following types. 1. float 2. double 3. long double E.g.: float a = 1.25; Here the float or real value 1.25 is assigned to the float variable a. The different data types, the memory space required by them and their ranges are summarized in the following table. Data type Size (bits) [8 bits = 1 byte] Range char or signed char to 127 unsigned char 8 0 to 255 int or signed int 16-32,768 to 32,767 unsigned int 16 0 to short int or signed short int to 127 unsigned short int 8 0 to 255 long int or signed long int 32-2,147,483,648 to 2,147,483,647 unsigned long int 32 0 to 4,294,967,295 float E-38 to 3.4E+38 double E-308 to 1.7E+308 long double E-4932 to 1.1E+4932 ii. iii. Rules for Constructing Variable Names: a. A variable name is a combination of letters, digits or underscores. b. A variable name should be of maximum 8 characters in length. Some compilers allow variable names whose length can be up to 247 characters. c. A variable name should start with a letter or an underscore. d. No commas, blanks or special symbols are allowed within a variable name. For example, emp_sal, m, var_1 are valid variable names, whereas emp@15, var-1 are not valid. e. Keywords cannot be used as variable names. f. It is a good programming practice to give meaningful variable names. For example, if we want roll number of student then give variable name like roll_no instead of a. Variable Declaration: a. All variables must be declared before using them in a program. b. A variable declaration consists of data type, followed by variable name and ending with semicolon. Syntax for variable declaration: data_type variable_name; e.g.: int a; char ch; float b; 7

14 Target Publications Pvt. Ltd. Prog. in C (F.Y.Dip.Sem.-2) (Comp. Engg.) MSBTE 8 iv. Variable Initialization: a. Initial values are assigned to variables at the time of declaration. b. Initialization consists of data type, followed by a variable name, an equal to sign (=) and the constant of the appropriate type, ended with semicolon. e.g.: int a = 10; char ch = 'p'; float f = 1.23; v. Difference between Constant and Variable: Constant Variable 1. It is a memory location where the It is a memory location where the value saved value does not change can be changed during the program. throughout a program. 2. It requires a prefix const to be added It does not require any prefix. Its before mentioning the data_type and declaration starts directly with the constant name, in its declaration. data_type followed by variable name. 3. Syntax: const data_type name value Syntax: data_type name; 4. E.g.: const float pi 3.14 E.g.: int x; 1.4 Basic Structure of a C Program i. Documentation section: This section comprises of a set of comment lines which may include the name of the program, name of the author and other details, which the programmer can use later. ii. iii. iv. Link section: The link section consists of header files which are instructions to the compiler to link C standard library functions from the system library. The function prototype and definitions are mentioned in their respective header files. For example, to use the printf( ) function, the header file <stdio.h> has to be included. Definition section: The definition section defines all symbolic constants. Symbolic constants are generally named in CAPITAL letters and their value does not change during the entire lifetime of the program. Global declaration section: This section defines the global variables which are used in more than one user-defined function. User-defined functions are functions which are defined as per the requirement of the program and are in addition to the standard library functions which are included in the Link section. The global declaration section also declares all the user-defined functions. v. Main( ) function section: Every C program has one main function section. This section contains two parts; declaration part and executable part. All the other functions (standard library functions and user-defined functions) are called or invoked through the main( ) function. vi. Declaration part: The declaration part declares all the variables used in the executable part. Sometimes the variables are also initialised with a certain value along with their declaration.

15 Target Publications Pvt. Ltd. Basic Physics Chapter (F.Y.Dip.Sem.-1) 01: Basics MSBTE of 'C' vii. Executable part: This part consists of minimum one executable statement. The executable part uses all the global variables and local variables either directly or through the standard library functions and the user-defined functions. Both the Declaration part and the Executable parts appear between opening and closing braces { } which form the body of the main( ) function. The execution of the program begins at the opening brace and logically ends at the closing brace of the main function. viii. Subprogram section: The subprogram section consists of all the user-defined functions that are called in the main( ) function and may have been declared in the global declaration section. User-defined functions are generally placed immediately after the main( ) function, although they may appear in any order. 1.4.(a) C Header Files and Standard Library Functions: The C library consists of several pre-defined functions grouped under different header files, which can be accessed and used as per the requirement in a C-program. As discussed in the previous section, the header files are included in the link section of the program. Some of the frequently used header files and the type of functions they give access to, are mentioned below. C Header Files <stdio.h> <conio.h> <math.h> <string.h> <ctype.h> <stdlib.h> Type of functions under the header file Standard input and output functions Console input output functions Mathematics functions String functions Character handling functions General utility functions i. Functions under <stdio.h>: The header file stdio.h refers to the standard input/ output header file. It is a standard library in C which contains constants, macros definitions and declarations of functions. It includes data types required for all input and output operations. Some of the frequently used functions under <stdio.h> header file are: printf(), scanf(), getchar(), putchar(), etc. Note: The printf() and scanf() functions are discussed in section 1.5. ii. Functions under <conio.h>: Some of the frequently used functions under <conio.h> header file and their use are given below. clrscr(): Used for clearing the old data from the output window before beginning of program. getch() and getche(): Both are used for accepting a character from user. The difference between these two functions is as follows. getch() 1. It does not display the character entered by the user on screen, but accepts it and saves as per the statement. getche() The character entered by the user is displayed on screen at the cursor and also accepts and saves it as per the statement. 9

16 Target Publications Pvt. Ltd. Prog. in C (F.Y.Dip.Sem.-2) (Comp. Engg.) MSBTE iii. iv. 2. void main() { char a; printf("\nenter character: "); a = getch(); printf("\nyou entered %c", a); } 3. Output of the above program is; Enter character: You entered A void main() { char a; printf("\nenter character: "); a = getche(); printf("\nyou entered %c", a); } Output of the above program is; Enter character: A You entered A Functions under <math.h>: Some of the frequently used functions under <math.h> header file are: sqrt(), round(), log(), log10(), etc. Functions under <string.h>: Some of the frequently used functions under <string.h> header file are: strcat(str1, str2), strcpy(str1, str2), strlen(strl), strcmp(str1, str2), etc. 1.5 Input and Output C language has a collection of library functions, which includes a number of input/output functions. These functions allow the transfer of information between the computer and the input/output devices (e.g., a keyboard and a monitor). For accessing these input-output functions the header file <stdio.h> is included in the link section of the program (a) Input Functions: Data entered by user through keyboard is accepted in the program using the input functions. These functions are already defined in standard C library. Some examples of input functions are scanf( ), getchar( ), getch( ), gets( ). The most commonly used input function is the scanf( ) function. i. scanf( ) function: a. The scanf function reads input from the standard input stream stdin and scans that input according to format provided. b. This function can be used to take input which is of type number (int, long, float or double), character, string (set of characters) or of both. c. Syntax: scanf("control string", argument list); The control string consists of one or more than one group of control (or conversion) characters followed by list of arguments. The control characters depend upon the data type of the corresponding arguments where the data is to be stored. Each control character (d, c, f, etc.) must be preceded by a percent sign (%). d. The common conversion characters / format specifiers are listed in the table below: Conversion Character / Format Specifiers Meaning %c This indicates data item is a character %d This indicates data item is integer %e This indicates data item is floating point value (exponential)

17 Target Publications Pvt. Ltd. Basic Physics Chapter (F.Y.Dip.Sem.-1) 01: Basics MSBTE of 'C' %f This indicates data item is a floating point value %h This indicates data item is a short integer %o This indicates data item is a octal integer %u This indicates data item is an unsigned decimal integer %x This indicates data item is a hexadecimal integer e. The arguments are variables, whose data types should match with corresponding character group in the control string. f. Each variable name must be preceded by an ampersand (&). g. e.g.: scanf("%d", &a) Here, the conversion character %d is used to accept integer data type from the user and is then saved in the integer variable having name a. h. For accepting values for more than one variable, we can use separate scanf( ) statement for each variable as shown below. scanf("%d", &a); scanf("%d", &b); scanf("%d", &c); Alternatively, we can combine all the conversion characters and their corresponding variables in one scanf( ) statement, as follows. scanf("%d %d %d", &a, &b, &c); 1.5.(b) Output Functions: Output functions are the functions through which the output is displayed on the standard output devices like monitor. Some examples of output functions used by C programming are printf( ), putchar( ), puts( ). The most commonly used output function is the printf( ) function. i. printf( ) function: To display the data on an output device like monitor, the printf( ) function is used in C. The displayed output can be of two types, viz., a. Output without values of program variables. b. Output with values of program variables. a. To Display only Output: In this case printf() is used only to display some text as output on monitor. Syntax: printf("control string"); The text which is enclosed inside double quotes will be displayed on monitor. For example, if we want to display hello, this is my beginning of C Program, then we have to put this message in printf function in place of control string as: printf("hello, this is my beginning of C Program"); The output for above statement will be: hello, this is my beginning of C Program b. To Display values of variables: This function can be used to display values of variables of type integer, float, character or any combination of number, single character and string on monitor. 11

18 Target Publications Pvt. Ltd. Prog. in C (F.Y.Dip.Sem.-2) (Comp. Engg.) MSBTE 12 ii. Syntax: printf("control string", argument list); The control string contains a formatting information similar to scanf( ) function and list of arguments are the names of variables. Note: The arguments in printf function are not preceded by ampersand (&). Consider the following example printf ("The integer value is : %d, The floating point value is : %f ", a,b); Here, the statement between inverted commas (" " is the format string and the %d and %f will respectively print the integer and floating point values of their corresponding variables a and b. Escape sequences (Backslash character constants): Some backslash character constants are used in output functions of C so that the output is displayed in the desired format. These are also known as escape sequences. Some of the frequently used escape sequences and their meanings are given in the following table: '\a' '\b' '\f' '\n' '\r' '\t' '\v' '\'' '\" ' '\?' ' ' '\0' Constant 1.6. The First C Program Meaning audible alert (bell) back space form feed new line carriage return horizontal tab vertical tab single quote double quote question mark backslash null A basic C program can be written with different combinations of the variables, constants and keywords studied till now. The rules to be remembered before writing a C program are mentioned below. i. Every instruction in a C program is written as a separate statement. A logical series of these statements comprises of a complete C program. ii. The statements in a C program are executed in the same order as they appear in the program. Only if the logic of the problem demands a deliberate jump or transfer of control to a statement, which is out of sequence, we can do so with the help of appropriate command. iii. Blank spaces may be inserted between two words to improve the readability of the statement. However, no blank spaces are allowed within a variable, constant or keyword. iv. All statements are entered in small case letters. v. C has no specific rules for the position at which a statement is to be written. That s why it is called a free-form language. vi. Every C statement ends with a semicolon.

19 Target Publications Pvt. Ltd. Basic Physics Chapter (F.Y.Dip.Sem.-1) 01: Basics MSBTE of 'C' 1. Write a program to print Hello, World! /* Program to print "Hello, World!" */ #include<stdio.h> /* header file must be included */ int main() /* c program always starts from this function */ { printf("hello, World! \n"); /* output statement */ return 0; } Output: Hello, World! 1.6.(a) Steps to compile and execute a C program: i. Start the compiler at C> prompt. The compiler (TC.EXE is usually present in C:\TC\BIN directory). ii. Select New from the File menu. iii. Type the program. iv. Save the program using F2 under a proper name (say Program1.c). v. Use Alt + F9 to compile the program. Check for errors if any and rectify and save them using F2. vi. Use Ctrl + F9 to compile and execute the program. vii. Use Alt + F5 to view the output 1.6.(b) C Instructions: C instruction is an order given to a computer processor through the C program. There are basically three types of instructions in C: i. Type Declaration Instruction: They are used to declare the type of variable used in C program. e.g.: int a, b; ii. iii. Illustrative Program 1.7 C Operators Arithmetic Instruction: They are used to perform arithmetic operations between constants and variables. e.g.: c = a + b; Control Instruction: They are used to control the sequence of execution of various statements in a C program. e.g.: while(i < 5) In C language, an operator is a symbol which instructs the compiler to perform the specified mathematical or logical operation on the mentioned variables or constants. 13

20 Target Publications Pvt. Ltd. Prog. in C (F.Y.Dip.Sem.-2) (Comp. Engg.) MSBTE C language provides the following types of operators: a. Arithmetic Operators b. Relational Operators c. Logical Operators d. Assignment Operators e. Bitwise Operators f. Miscellaneous Operators 1.7.(a) Arithmetic Operators: These operators are used for carrying out arithmetic operations like addition, subtraction, multiplication, division, etc on variables and constants. The results of these operations are saved in variables of suitable data types. Based on the number of operands required, arithmetic operators in C are categorised into two types, viz., i. Binary operator ii. Unary operator i. Binary Operators: The arithmetic operators which require two operands (i.e. variables or constants) to operate upon are called as binary operators. Following table shows all the binary arithmetic operators supported by C language. Let variable x contain the value 40 and variable y contain the value 10, then we have the following results. Operator Operator Name Description Example + Addition operator Adds two operands x + y will give 50 Subtraction operator Subtracts second operand from the first x y will give 30 * Multiplication operator Multiplies two operands x * y will give 400 / Division operator Divides first operand by second operand x / y will give 4 % Modulo operator Calculates remainder of an integer division x % y will give 0 14 Illustrative Programs 1. Write a program to add two numbers. /* Program to add two numbers */ #include<stdio.h> void main( ) { int x = 40, y = 10, z ; /* declaration and initialization of variables */ z = x + y; /* '+' operator adds the values saved in x and y and saves in z*/ printf("addition of two numbers is: %d\n", z ); /* prints the value of addition saved in z */ } Output: Addition of two numbers is: 50

21 Target Publications Pvt. Ltd. Basic Physics Chapter (F.Y.Dip.Sem.-1) 01: Basics MSBTE of 'C' Similarly, subtraction, multiplication and division operators are used. Note: The result of division operation must be stored in a variable of data type float. 2. Write a program to find the remainder of the division of two integers. /* Program to find the remainder of the division of two integers */ ii. # include<stdio.h> void main() { int x = 43, y = 10, z; /* declaration and initialization of variables */ z = x % y; /* calculates remainder of the division of 43 and 10 */ printf("modulo of the two given numbers is: %d", z); } Output: Modulo of the two given numbers is: 3 Unary Operators: The arithmetic operators which require only one operand/ variable to operate upon are called as unary arithmetic operators. The two unary arithmetic operators supported by C language are; Operator Operator Name Description ++ Increment operator Increases (increments) the value of variable by Decrement operator Decreases (decrements) the value of variable by 1. a. Increment operator: The increment operator increases (increments) the value of the associated variable by one. The ++ operator is the increment operator. Increment operators can either be pre-increment operator or post-increment operator. i. Pre increment Operator: This operator is used to increment the value of variable before using it in the expression. The pre-increment operator first increments the value and then it is used in the expression. E.g.: y = ++ x ; Here, x is first incremented and then the new value is associated to y. ii. Post increment Operator: This operator is used to increment the value of variable after executing expression completely in which post increment is used. The post increment operator first uses the variable in the expression and then increments it. E.g.: y = x ++ ; Here, the value of x is first associated to y and then x is incremented. 15

22 Target Publications Pvt. Ltd. Prog. in C (F.Y.Dip.Sem.-2) (Comp. Engg.) MSBTE 1. Write a program to demonstrate use of pre-increment and post-increment operators. /* Program to demonstrate use of pre-increment and post-increment operators */ #include<stdio.h> void main() { int x=10,y=10,v1,v2; /* variable declaration */ clrscr(); v1 = x++; /* post-increment */ v2 = ++y; /* pre-increment */ printf("value of v1 : %d",v1); printf("value of v2 : %d",v2); } Output: Value of v1 : 10 Value of v2 : 11 From the above program the difference between pre-increment (++i) operator and postincrement (i++) operator can be summarized as follows: Pre - Increment (++i) Operator Post - Increment (i++) Operator i. It is used as prefix before the variable. It is used as postfix after the variable. ii. This operator increases the value of the variable by 1, before execution of the C statement containing it. This operator increases the value of the variable by 1, after the execution of the C statement containing it. iii. The C statement containing the operator and the following statements use the incremented value of the variable. iv. Illustrative Program void main() { int i = 10; printf("i = %d", ++i); printf("\n Later i = %d", i); } The C statement containing the operator cannot use the incremented value of variable. It is available for use from the next logical C statement. void main() { int i = 10; printf("i = %d", i++); printf("\n Later i = %d", i); } 16 Output: i = 11 Later i = 11 Output: i = 10 Later i = 11 b. Decrement operator: The decrement operator decreases (decrements) the value of the associated variable by one. The -- operator is the decrement operator.

23 Target Publications Pvt. Ltd. Basic Physics Chapter (F.Y.Dip.Sem.-1) 01: Basics MSBTE of 'C' Decrement operators can either be pre-decrement operator or post-decrement operator. i. Pre decrement Operator: This operator is used to decrement the value of variable before using it in the expression. The pre-decrement operator first decrements the value and then it is used in the expression. E.g.: y = -- x ; Here, x is first decremented and then the new value is associated to y. ii. Post decrement Operator: This operator is used to decrement the value of variable after executing expression completely in which post decrement is used. The post decrement operator first uses the operand in the expression and then decrements it. E.g.: y = x -- ; Here, the value of x is first associated to y and then x is decremented. Illustrative Program 1. Write a program to demonstrate use of pre-decrement and post-decrement operators. /* Program to demonstrate use of pre-decrement and post-decrement operators */ #include<stdio.h> void main() { int x=10,y=10,v1,v2; /* variable declaration */ clrscr(); v1 = x--; /* post-decrement */ v2 = --y; /* pre-decrement */ printf("value of v1 : %d",v1); printf("value of v2 : %d",v2); } Output: Value of v1 : 10 Value of v2 : (b) Relational Operators: These operators are used to test or check the relation between two values or variables. The results of these tests are used to execute the appropriate statement. Following table shows all the relational operators supported by C language. Let variable x contain the value 40 and variable y contain the value 10, then we have, Operator Operator name Description Example = = Is equal to Checks whether the values of two (x = = y) is not operands are equal or not. If yes then it true. returns true. Checks if the values of two operands are! = Is not equal to equal or not. If values are not equal then it returns true. (x! = y) is true 17

24 Target Publications Pvt. Ltd. Prog. in C (F.Y.Dip.Sem.-2) (Comp. Engg.) MSBTE 2. Write an algorithm to find largest among three numbers entered by the user. Ans: The algorithm to read three numbers from user and find the largest among them is given below: Step-1: Start Step-2: Declare three variables a, b and c. Step-3: Accept values for a, b and c from user. Step-4: Check as per the following: If a > b Then if a > c Display a is the largest number. Else (i.e. if c > a) Display c is the largest number. Else (i.e. if b > a) Then if b > c Display b is the largest number. Else (i.e. if c > b) Display c is the largest number. Step-5: Stop (b) Flowcharts: Flowcharts are used in C programming due to the following reasons: i. Visualizing the flow of program graphically is better than describing the same in words. ii. It helps in understanding the method of coding and improves its efficiency wherever possible. iii. It is an easy method of explaining the methodology of a C program through symbols and text to other programmers. iv. It also helps in finding errors or debugging the program. Flowcharts are usually drawn using standard symbols. However, some special symbols can also be developed when required. The standard symbols are listed below: i. Terminator: An oval flowchart shape indicates the start or end of the process, usually containing the word Start or End. ii. iii. iv. Process: A rectangular shape indicates a branch in the process flow step. For example, "c=a+b", "i=i+1" Decision: A diamond shape indicates a branch in the process flow. This symbol is used when a decision is to be made, commonly a YES/NO question or True/False test. Connector: A small, labelled, circular flowchart used to indicate a jump in the process flow. Connectors are usually used in complex or multi-sheet diagrams.

25 Target Publications Pvt. Ltd. Basic Physics Chapter (F.Y.Dip.Sem.-1) 01: Basics MSBTE of 'C' v. Data: A parallelogram that indicates data input or output (I/O) for a process. vi. vii. Delay: It is used to indicate a delay or wait in the process. Arrow: Used to indicate the flow of control in a process. Illustrative Program 1. Draw flowchart to print sum of two numbers. Start Declare variables num1, num2 and sum Read num1 and num 2 sum a+b Display sum Note: Apart from the above mentioned techniques, some other problem solving techniques are also used. Few of them are mentioned below: i. Pseudocode: It is an informal high level description of the operating principle of a computer program or other algorithm. ii. iii. iv. Solve by analogy: Analogy is just a broader application of the strategy of looking for things that are familiar. Means ends analysis: The strategy behind means and ends analysis is to define the ends and then to analyze your means of getting between them. Divide and conquer: The principle behind this is to break up a large problem into smaller pieces so that we can solve individually. v. The building block approach: It is a combination of solve by analogy and divide and conquer. The idea behind this is to see if any solutions for smaller pieces of the problem exist. vi. Stop Merging solution: The idea behind this is to combine existing solutions and merge them on a step by step basis. 29

26 Target Publications Pvt. Ltd. MSBTE Theory Questions 1. Write the C character set available in C. [S-11] [2 M] Ans: Refer List four types of qualifiers. [S-11] [2 M] Ans: Refer last page 1.3.(e) Only table 3. What is conditional operator? [S-11;W-15] [2 M] Give the syntax of conditional statement. [S-13] [2 M] Ans: Refer 1.7.(f)-iv. 4. What is the purpose of stdio.h header file? [S-11] [2 M] Ans: Refer 1.4.(a)-i. 5. State relational and logical operators with its meaning. [S-11] [4 M] List out C logical operators [W-12] [4 M] List out relational operators and state their examples. [W-12] [4 M] State the logical and relational operators available in C-language. [S-14] [2 M] Explain any two logical operators with example. [W-14] [4 M] Ans: Refer 1.7.(b) and 1.7.(c) 6. Write the rules for constructing integer constant. [S-11, W-11] [4 M] Ans: Refer 1.3(d)-i 7. What is an operator? Explain unary and binary operator. [S-11] [4 M] Ans: Refer 1.7.(a)-i and ii. 8. Define token and identifier. [W-11,15] [2 M] Ans: Refer 1.3 (Only definition) and 1.3(b)-i. Prog. in C (F.Y.Dip.Sem.-2) (Comp. Engg.) MSBTE 9. Define variable with syntax. [W-11] [2 M] Ans: Refer 1.3.(f) (Only definition) and 1.3.(f)-iii.b. 10. Enlist C keywords. [W-11] [2 M] What is keyword? List any four keywords used in C. [S-12, W-12] [2 M] List any four keywords used in C with their use. [W-13] [2 M] Ans: Refer 1.3.(c)-iv, v. 11. Explain arithmetic and logical operator. [W-11,15] [4 M] Ans: Refer 1.7.(a) and 1.7.(c) 12. Explain formatted input and output in brief. [W-11,15] [4 M] What is meant by formatted input and output. [S-12] [2 M] Explain formatted input-output. [S-14] [4 M] List the formatted input and output instructions. [W-14] [2 M] Explain formatted input and formatted output with example. [S-15] [4 M] Ans: Refer 1.8.(a) and 1.8.(b). 13. What is operator precedence and associativity? [W-11] [4 M] Write about operator precedence in C. [S-12] [4 M] What is operator precedence? [W-13] [2 M] Ans: Refer 1.7.(g) 30

27 Target Publications Pvt. Ltd. 14. Define following terms: Token Also give examples. [W-11] [4 M] What are C tokens? Give suitable examples. [W-13] [4 M] Enlist types of tokens available in C and give one example for each. [S-15] [4 M] Ans: Refer List bitwise operator used in C. [S-12] [2 M] Ans: Refer 1.7.(e) (Table of operators and its meaning) 16. What are different data types used in C? [S-12] [4 M] List out primary data types and state their size in bits. [W-12] [4 M] List all basic data types. [S-13] [2 M] State various data types along with their memory sizes. [W-13] [4 M] State different data types in C. [W-14] [2 M] Ans: Refer 1.3.(f)-i-c (Table of Data types, Size and Range) 17. Enlist relational operators used in C also write C program that makes use of relational operation. [S-12] [4 M] Ans: Refer 1.7.(b) and the Illustrative Program following it. 18. What is meant by increment and decrement operator? [S-12] [4 M] State use of increment and decrement operators with examples. [W-14] [4 M] What is meant by increment and decrement operator? Explain with example. [W - 15] [4 M] Ans: Refer 1.7.(a) - ii.a and ii.b Basic Physics Chapter (F.Y.Dip.Sem.-1) 01: Basics MSBTE of 'C' 19. What is the difference between short int and long int data types? [W-12] [2 M] Ans: Refer 1.3.(f)-i-b (Table of difference between short int and long int) 20. State examples of library functions. [W-12] [2 M] Ans: Refer 1.4.(a) 21. State various bit wise operators with examples. [W-12] [4 M] List bit wise operators and explain any two. [S-15] [2 M] Ans: Refer 1.7.(e) 22. State the operation and difference between getch(); and getche(); [W-12] [4 M] Ans: Refer1.4.(a)-ii (Table) 23. Explain formatted output statement for any eight format codes. [W-12] [4 M] Ans: Refer 1.8.(b)-i and 1.8.(c)-iii Table. 24. State arithmetic and logical operators. [S-13] [2 M] Ans: Refer 1.7.(a)-i and ii Table (for arithmetic operators) and Refer 1.7.(c) Table (for logical operators) 25. State the rules for variable declaration. [S-13] [2 M] Ans: Refer 1.3.(f)-iii 26. Give the syntax of input and output statement in C. [S-13] [2 M] Ans: Refer 1.8.(a) and 1.8.(b) syntax only. 27. Draw the structure of C program. Also give one example. [S-13] [4 M] Write and explain the structure of a C program. [W-13] [4 M] Describe generic structure of 'C' program. [S-14] [2 M] Explain structure in C with suitable example. [W-14] [4 M] Ans: Refer 1.4 and Illustrative Program after

28 Target Publications Pvt. Ltd. 28. Define the terms: [S-13] [4 M] i. Key word Ans: Refer 1.3(c) (Only definition) ii. Variable Ans: Refer 1.3.(f) (Only definition) iii. Identifier Ans: Refer 1.3(b) (Only definition) iv. Constant Ans: Refer 1.3(d) (Only definition) 29. State the use of increment and decrement operator. Give difference between i++ and ++i. [S-13, W-13] [4 M] Ans: Refer 1.7.(a) - ii.a and ii.b Refer 1.7.(a)-ii.a (Table giving difference between Pre-increment and Post-increment Operator) 30. State four arithmetic and four logical operators with their uses. [W-13] [2 M] Ans: Refer 1.7.(a) i and ii and 1.7.(c) (Table) 31. With suitable example and syntax, explain how formatted input can be obtained. [W-13] [4 M] Ans: Refer 1.8.(a) 32. State two features of C-language. [S-14] [2 M] Ans: Refer 1.1 (List of features) 33. Explain post increment-decrement operator. [S-14] [4 M] Ans: Refer 1.7.(a)-ii (a-ii) and ii (b-ii) 34. State the constants and variables with examples. [S-14] [4 M] Ans: Refer 1.3(d) (Examples on the last line of each i, ii and iii) and 1.3.(f)-i (Examples on the last line of each a, b, c) Prog. in C (F.Y.Dip.Sem.-2) (Comp. Engg.) MSBTE 35. Enlist different format specifier with its use. [S-14] [4 M] Ans: Refer 1.5(a)-i.d 36. Explain pre-increment and post increment operator. [W-14] [2 M] Ans: Refer 1.7.(a) - ii.a and ii.b 37. State the four operators in C. [W-14] [2 M] Ans: Refer Distinguish between variable and constant. [W-14] [4 M] Ans: Refer 1.3.(f)-v 39. List types of constants. [S-15] [2 M] Ans: Refer 1.3(d) 40. State four rules for choosing variable name. [S-15] [2 M] Ans: Refer 1.3.(f)-ii 41. Explain increment and decrement operator with examples. [S-15] [4 M] Ans: Refer 1.7.(a)-ii 42. State the importance of flowcharts with the symbols used for drawing flowchart. [S-15] [4 M] Ans: Refer 1.9.(b) 43. List and explain bitwise operator used in C. [W-15] [4 M] Ans: Refer 1.7.(e) 44. Explain special operator in C with example. [W-15] [4 M] Ans: Refer 1.7.(f)-i to iv. 32 MSBTE Programming Questions 1. For the following program statement, derive the output generated by printf statement. int val = 255; float num = ; printf("%d, %4d, %2.3f, %5.3", val, val, num, num); [S-11] [4 M] Ans. The output of the given program is: 255, 255, ,

29 Target Publications Pvt. Ltd. 2. Write down the output of the following program. #include <stdio.h> void main() {int X = 10, Y = 20, Z = 5, i; i = X < Y < Z; printf("\n%d", i); return 0; } Ans. The output of the given program is: 1 Basic Physics Chapter (F.Y.Dip.Sem.-1) 01: Basics MSBTE of 'C' [W-11] [4 M] 3. Write C assignment statements to evaluate the following equation. i. area = ½bh ii. torque = 2m1m2.9 m1 m2 iii. side = 2 a + b 2 2 ab cos (x) iv. Velocity Energy mass. acceleration height 2 2 Ans. The required C assignments statements are as follows: i. area = 0.5*b*h; ii. torque = ((2*m1*m2)/(m1+m2))*9 iii. side = a+b^2-2*a*b*cos(x); iv. energy = mass*((acceleration*height) + (velocity/2)*2) [S-12] [4 M] 4. Find out the errors in the following program component and state how it can be rectified. main() } int a = 5, b = 5; printf("%d", a, b) } [W-13] [4 M] Ans. The errors in the given program are mentioned below. i. main() } The main function starts with a closing brace bracket, which will give syntax error. ii. printf("%d", a, b) The printf statement is not terminated with semicolon. The corrected program code after eliminating errors is given below: main() { int a = 5, b = 5; printf("%d %d", a, b); } 33

30 Target Publications Pvt. Ltd. Prog. in C (F.Y.Dip.Sem.-2) (Comp. Engg.) MSBTE Additional Theory Questions 1. Explain printf( ) function. Ans. Refer 1.8.(b) 2. Explain scanf( ) function. Ans. Refer 1.8.(a) 3. Draw and explain any 4 flowchart symbols. Ans. Refer 1.9.(b)- Any 4 standard symbols out of i to vii 4. Write down steps for executing C program. Ans. Refer 1.6.(a) 5. Explain any two problem solving techniques. Ans. Refer 1.9.(a) and 1.9.(b) Programs for Practice 1. Write a program to multiply two numbers. 2. Write a program to print average of two numbers. 3. Write a Program to print the square of a number. 4. Write a program to find cube of a number. 5. Write a program to calculate area and perimeter of a circle. 6. Write a program to accept distance in kilometer and convert it into meter, cm, inch and feet. 7. Write a program to print hexadecimal, decimal, octal format of the entered number. 34

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T) Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

PROGRAMMING IN C PROGRAMMING IN C CONTENT AT A GLANCE

PROGRAMMING IN C PROGRAMMING IN C CONTENT AT A GLANCE PROGRAMMING IN C CONTENT AT A GLANCE 1 MODULE 1 Unit 1 : Basics of Programming Unit 2 : Fundamentals Unit 3 : C Operators MODULE 2 unit 1 : Input Output Statements unit 2 : Control Structures unit 3 :

More information

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

KITES TECHNOLOGY COURSE MODULE (C, C++, DS) KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL

More information

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

More information

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void 1. Explain C tokens Tokens are basic building blocks of a C program. A token is the smallest element of a C program that is meaningful to the compiler. The C compiler recognizes the following kinds of

More information

About The Tutorial. Audience. Prerequisites. Copyright & Disclaimer

About The Tutorial. Audience. Prerequisites. Copyright & Disclaimer About The Tutorial C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system.

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

C PROGRAMMING FOR MATHEMATICAL COMPUTING

C PROGRAMMING FOR MATHEMATICAL COMPUTING UNIVERSITY OF CALICUT SCHOOL OF DISTANCE EDUCATION BSc MATHEMATICS (2011 Admission Onwards) VI Semester Elective Course C PROGRAMMING FOR MATHEMATICAL COMPUTING QUESTION BANK Multiple Choice Questions

More information

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters The char Type ASCII Encoding The C char type stores small integers. It is usually 8 bits. char variables guaranteed to be able to hold integers 0.. +127. char variables mostly used to store characters

More information

C++ Language Tutorial

C++ Language Tutorial cplusplus.com C++ Language Tutorial Written by: Juan Soulié Last revision: June, 2007 Available online at: http://www.cplusplus.com/doc/tutorial/ The online version is constantly revised and may contain

More information

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement? 1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members

More information

Chapter 2: Elements of Java

Chapter 2: Elements of Java Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction

More information

The C Programming Language course syllabus associate level

The C Programming Language course syllabus associate level TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

More information

Chapter One Introduction to Programming

Chapter One Introduction to Programming Chapter One Introduction to Programming 1-1 Algorithm and Flowchart Algorithm is a step-by-step procedure for calculation. More precisely, algorithm is an effective method expressed as a finite list of

More information

Pemrograman Dasar. Basic Elements Of Java

Pemrograman Dasar. Basic Elements Of Java Pemrograman Dasar Basic Elements Of Java Compiling and Running a Java Application 2 Portable Java Application 3 Java Platform Platform: hardware or software environment in which a program runs. Oracle

More information

Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved.

Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved. 1 2 Introduction to Java Applications 2.2 First Program in Java: Printing a Line of Text 2 Application Executes when you use the java command to launch the Java Virtual Machine (JVM) Sample program Displays

More information

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand:

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand: Introduction to Programming and Algorithms Module 2 CS 146 Sam Houston State University Dr. Tim McGuire Introduction To Computers And Java Chapter Objectives To understand: the meaning and placement of

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming

UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming 1 2 Foreword First of all, this book isn t really for dummies. I wrote it for myself and other kids who are on the team. Everything

More information

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands C Programming for Embedded Microcontrollers Warwick A. Smith Elektor International Media BV Postbus 11 6114ZG Susteren The Netherlands 3 the Table of Contents Introduction 11 Target Audience 11 What is

More information

PROG0101 Fundamentals of Programming PROG0101 FUNDAMENTALS OF PROGRAMMING. Chapter 3 Algorithms

PROG0101 Fundamentals of Programming PROG0101 FUNDAMENTALS OF PROGRAMMING. Chapter 3 Algorithms PROG0101 FUNDAMENTALS OF PROGRAMMING Chapter 3 1 Introduction to A sequence of instructions. A procedure or formula for solving a problem. It was created mathematician, Mohammed ibn-musa al-khwarizmi.

More information

I PUC - Computer Science. Practical s Syllabus. Contents

I PUC - Computer Science. Practical s Syllabus. Contents I PUC - Computer Science Practical s Syllabus Contents Topics 1 Overview Of a Computer 1.1 Introduction 1.2 Functional Components of a computer (Working of each unit) 1.3 Evolution Of Computers 1.4 Generations

More information

JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system.

JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system. http://www.tutorialspoint.com/java/java_quick_guide.htm JAVA - QUICK GUIDE Copyright tutorialspoint.com What is Java? Java is: Object Oriented Platform independent: Simple Secure Architectural- neutral

More information

Objective-C Tutorial

Objective-C Tutorial Objective-C Tutorial OBJECTIVE-C TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Objective-c tutorial Objective-C is a general-purpose, object-oriented programming

More information

So far we have considered only numeric processing, i.e. processing of numeric data represented

So far we have considered only numeric processing, i.e. processing of numeric data represented Chapter 4 Processing Character Data So far we have considered only numeric processing, i.e. processing of numeric data represented as integer and oating point types. Humans also use computers to manipulate

More information

2 ASCII TABLE (DOS) 3 ASCII TABLE (Window)

2 ASCII TABLE (DOS) 3 ASCII TABLE (Window) 1 ASCII TABLE 2 ASCII TABLE (DOS) 3 ASCII TABLE (Window) 4 Keyboard Codes The Diagram below shows the codes that are returned when a key is pressed. For example, pressing a would return 0x61. If it is

More information

JavaScript: Control Statements I

JavaScript: Control Statements I 1 7 JavaScript: Control Statements I 7.1 Introduction 2 The techniques you will learn here are applicable to most high-level languages, including JavaScript 1 7.2 Algorithms 3 Any computable problem can

More information

VB.NET Programming Fundamentals

VB.NET Programming Fundamentals Chapter 3 Objectives Programming Fundamentals In this chapter, you will: Learn about the programming language Write a module definition Use variables and data types Compute with Write decision-making statements

More information

The programming language C. sws1 1

The programming language C. sws1 1 The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan

More information

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

More information

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java

More information

arrays C Programming Language - Arrays

arrays C Programming Language - Arrays arrays So far, we have been using only scalar variables scalar meaning a variable with a single value But many things require a set of related values coordinates or vectors require 3 (or 2, or 4, or more)

More information

Base Conversion written by Cathy Saxton

Base Conversion written by Cathy Saxton Base Conversion written by Cathy Saxton 1. Base 10 In base 10, the digits, from right to left, specify the 1 s, 10 s, 100 s, 1000 s, etc. These are powers of 10 (10 x ): 10 0 = 1, 10 1 = 10, 10 2 = 100,

More information

JavaScript: Introduction to Scripting. 2008 Pearson Education, Inc. All rights reserved.

JavaScript: Introduction to Scripting. 2008 Pearson Education, Inc. All rights reserved. 1 6 JavaScript: Introduction to Scripting 2 Comment is free, but facts are sacred. C. P. Scott The creditor hath a better memory than the debtor. James Howell When faced with a decision, I always ask,

More information

B.Sc.(Computer Science) and. B.Sc.(IT) Effective From July 2011

B.Sc.(Computer Science) and. B.Sc.(IT) Effective From July 2011 NEW Detailed Syllabus of B.Sc.(Computer Science) and B.Sc.(IT) Effective From July 2011 SEMESTER SYSTEM Scheme & Syllabus for B.Sc. (CS) Pass and Hons. Course Effective from July 2011 and onwards CLASS

More information

C++ Programming Language

C++ Programming Language C++ Programming Language Lecturer: Yuri Nefedov 7th and 8th semesters Lectures: 34 hours (7th semester); 32 hours (8th semester). Seminars: 34 hours (7th semester); 32 hours (8th semester). Course abstract

More information

Computer Programming Tutorial

Computer Programming Tutorial Computer Programming Tutorial COMPUTER PROGRAMMING TUTORIAL by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Computer Prgramming Tutorial Computer programming is the act of writing computer

More information

Java Interview Questions and Answers

Java Interview Questions and Answers 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java

More information

Molecular Dynamics Simulations with Applications in Soft Matter Handout 7 Memory Diagram of a Struct

Molecular Dynamics Simulations with Applications in Soft Matter Handout 7 Memory Diagram of a Struct Dr. Martin O. Steinhauser University of Basel Graduate Lecture Spring Semester 2014 Molecular Dynamics Simulations with Applications in Soft Matter Handout 7 Memory Diagram of a Struct Friday, 7 th March

More information

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Digital Logic II May, I before starting the today s lecture

More information

Programming Microcontrollers in C

Programming Microcontrollers in C Programming Microcontrollers in C Second Edition Ted Van Sickle A Volume in the EMBEDDED TECHNOLOGY TM Series Eagle Rock, Virginia www.llh-publishing.com Programming Microcontrollers in C 2001 by LLH Technology

More information

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint) TN203 Porting a Program to Dynamic C Introduction Dynamic C has a number of improvements and differences compared to many other C compiler systems. This application note gives instructions and suggestions

More information

Keil C51 Cross Compiler

Keil C51 Cross Compiler Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation

More information

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT COURSE CURRICULUM. Course Title: Advanced Computer Programming (Code: 3320702)

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT COURSE CURRICULUM. Course Title: Advanced Computer Programming (Code: 3320702) GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT COURSE CURRICULUM Course Title: Advanced Computer Programming (Code: 3320702) Diploma Programmes in which this course is offered Computer Engineering,

More information

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements 9 Control Statements 9.1 Introduction The normal flow of execution in a high level language is sequential, i.e., each statement is executed in the order of its appearance in the program. However, depending

More information

Number Representation

Number Representation Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data

More information

Simple C++ Programs. Engineering Problem Solving with C++, Etter/Ingber. Dev-C++ Dev-C++ Windows Friendly Exit. The C++ Programming Language

Simple C++ Programs. Engineering Problem Solving with C++, Etter/Ingber. Dev-C++ Dev-C++ Windows Friendly Exit. The C++ Programming Language Simple C++ Programs Engineering Problem Solving with C++, Etter/Ingber Chapter 2 Simple C++ Programs Program Structure Constants and Variables C++ Operators Standard Input and Output Basic Functions from

More information

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London

More information

Visual Logic Instructions and Assignments

Visual Logic Instructions and Assignments Visual Logic Instructions and Assignments Visual Logic can be installed from the CD that accompanies our textbook. It is a nifty tool for creating program flowcharts, but that is only half of the story.

More information

Numbering Systems. InThisAppendix...

Numbering Systems. InThisAppendix... G InThisAppendix... Introduction Binary Numbering System Hexadecimal Numbering System Octal Numbering System Binary Coded Decimal (BCD) Numbering System Real (Floating Point) Numbering System BCD/Binary/Decimal/Hex/Octal

More information

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share. LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.

More information

C++ Essentials. Sharam Hekmat PragSoft Corporation www.pragsoft.com

C++ Essentials. Sharam Hekmat PragSoft Corporation www.pragsoft.com C++ Essentials Sharam Hekmat PragSoft Corporation www.pragsoft.com Contents Contents Preface 1. Preliminaries 1 A Simple C++ Program 2 Compiling a Simple C++ Program 3 How C++ Compilation Works 4 Variables

More information

SECTION C [short essay] [Not to exceed 120 words, Answer any SIX questions. Each question carries FOUR marks] 6 x 4=24 marks

SECTION C [short essay] [Not to exceed 120 words, Answer any SIX questions. Each question carries FOUR marks] 6 x 4=24 marks UNIVERSITY OF KERALA First Degree Programme in Computer Applications Model Question Paper Semester I Course Code- CP 1121 Introduction to Computer Science TIME : 3 hrs Maximum Mark: 80 SECTION A [Very

More information

Module 816. File Management in C. M. Campbell 1993 Deakin University

Module 816. File Management in C. M. Campbell 1993 Deakin University M. Campbell 1993 Deakin University Aim Learning objectives Content After working through this module you should be able to create C programs that create an use both text and binary files. After working

More information

The string of digits 101101 in the binary number system represents the quantity

The string of digits 101101 in the binary number system represents the quantity Data Representation Section 3.1 Data Types Registers contain either data or control information Control information is a bit or group of bits used to specify the sequence of command signals needed for

More information

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal 2/9/9 Binary number system Computer (electronic) systems prefer binary numbers Binary number: represent a number in base-2 Binary numbers 2 3 + 7 + 5 Some terminology Bit: a binary digit ( or ) Hexadecimal

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information

The C Programming Language

The C Programming Language Chapter 1 The C Programming Language In this chapter we will learn how to write simple computer programs using the C programming language; perform basic mathematical calculations; manage data stored in

More information

5 Arrays and Pointers

5 Arrays and Pointers 5 Arrays and Pointers 5.1 One-dimensional arrays Arrays offer a convenient way to store and access blocks of data. Think of arrays as a sequential list that offers indexed access. For example, a list of

More information

Fundamentals of Programming

Fundamentals of Programming Fundamentals of Programming Introduction to the C language Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 29, 2012 G. Lipari (Scuola Superiore Sant Anna) The C language

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information

First Bytes Programming Lab 2

First Bytes Programming Lab 2 First Bytes Programming Lab 2 This lab is available online at www.cs.utexas.edu/users/scottm/firstbytes. Introduction: In this lab you will investigate the properties of colors and how they are displayed

More information

Introduction to Java

Introduction to Java Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high

More information

AQA GCSE in Computer Science Computer Science Microsoft IT Academy Mapping

AQA GCSE in Computer Science Computer Science Microsoft IT Academy Mapping AQA GCSE in Computer Science Computer Science Microsoft IT Academy Mapping 3.1.1 Constants, variables and data types Understand what is mean by terms data and information Be able to describe the difference

More information

Lecture 1 Introduction to Java

Lecture 1 Introduction to Java Programming Languages: Java Lecture 1 Introduction to Java Instructor: Omer Boyaci 1 2 Course Information History of Java Introduction First Program in Java: Printing a Line of Text Modifying Our First

More information

1 Abstract Data Types Information Hiding

1 Abstract Data Types Information Hiding 1 1 Abstract Data Types Information Hiding 1.1 Data Types Data types are an integral part of every programming language. ANSI-C has int, double and char to name just a few. Programmers are rarely content

More information

IV-1Working with Commands

IV-1Working with Commands Chapter IV-1 IV-1Working with Commands Overview... 2 Multiple Commands... 2 Comments... 2 Maximum Length of a Command... 2 Parameters... 2 Liberal Object Names... 2 Data Folders... 3 Types of Commands...

More information

Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, 2008. 1 Introduction 1. 2 Invoking Shell Scripts 2

Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, 2008. 1 Introduction 1. 2 Invoking Shell Scripts 2 Unix Shell Scripts Norman Matloff July 30, 2008 Contents 1 Introduction 1 2 Invoking Shell Scripts 2 2.1 Direct Interpretation....................................... 2 2.2 Indirect Interpretation......................................

More information

Q&As: Microsoft Excel 2013: Chapter 2

Q&As: Microsoft Excel 2013: Chapter 2 Q&As: Microsoft Excel 2013: Chapter 2 In Step 5, why did the date that was entered change from 4/5/10 to 4/5/2010? When Excel recognizes that you entered a date in mm/dd/yy format, it automatically formats

More information

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)

More information

Course Title: Software Development

Course Title: Software Development Course Title: Software Development Unit: Customer Service Content Standard(s) and Depth of 1. Analyze customer software needs and system requirements to design an information technology-based project plan.

More information

Illustration 1: Diagram of program function and data flow

Illustration 1: Diagram of program function and data flow The contract called for creation of a random access database of plumbing shops within the near perimeter of FIU Engineering school. The database features a rating number from 1-10 to offer a guideline

More information

C / C++ and Unix Programming. Materials adapted from Dan Hood and Dianna Xu

C / C++ and Unix Programming. Materials adapted from Dan Hood and Dianna Xu C / C++ and Unix Programming Materials adapted from Dan Hood and Dianna Xu 1 C and Unix Programming Today s goals ú History of C ú Basic types ú printf ú Arithmetic operations, types and casting ú Intro

More information

Tutorial on C Language Programming

Tutorial on C Language Programming Tutorial on C Language Programming Teodor Rus rus@cs.uiowa.edu The University of Iowa, Department of Computer Science Introduction to System Software p.1/64 Tutorial on C programming C program structure:

More information

Chapter 5 Names, Bindings, Type Checking, and Scopes

Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Topics Introduction Names Variables The Concept of Binding Type Checking Strong Typing Scope Scope and Lifetime Referencing Environments Named

More information

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic: Binary Numbers In computer science we deal almost exclusively with binary numbers. it will be very helpful to memorize some binary constants and their decimal and English equivalents. By English equivalents

More information

LC-3 Assembly Language

LC-3 Assembly Language LC-3 Assembly Language Programming and tips Textbook Chapter 7 CMPE12 Summer 2008 Assembly and Assembler Machine language - binary Assembly language - symbolic 0001110010000110 An assembler is a program

More information

MACHINE INSTRUCTIONS AND PROGRAMS

MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER OBJECTIVES In this chapter you will learn about: Machine instructions and program execution, including branching and subroutine call and return operations

More information

10CS35: Data Structures Using C

10CS35: Data Structures Using C CS35: Data Structures Using C QUESTION BANK REVIEW OF STRUCTURES AND POINTERS, INTRODUCTION TO SPECIAL FEATURES OF C OBJECTIVE: Learn : Usage of structures, unions - a conventional tool for handling a

More information

Chapter 4: Computer Codes

Chapter 4: Computer Codes Slide 1/30 Learning Objectives In this chapter you will learn about: Computer data Computer codes: representation of data in binary Most commonly used computer codes Collating sequence 36 Slide 2/30 Data

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

Example of a Java program

Example of a Java program Example of a Java program class SomeNumbers static int square (int x) return x*x; public static void main (String[] args) int n=20; if (args.length > 0) // change default n = Integer.parseInt(args[0]);

More information

Chapter 7 Assembly Language

Chapter 7 Assembly Language Chapter 7 Assembly Language Human-Readable Machine Language Computers like ones and zeros 0001110010000110 Humans like symbols ADD R6,R2,R6 increment index reg. Assembler is a program that turns symbols

More information

Stacks. Linear data structures

Stacks. Linear data structures Stacks Linear data structures Collection of components that can be arranged as a straight line Data structure grows or shrinks as we add or remove objects ADTs provide an abstract layer for various operations

More information

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals: Numeral Systems Which number is larger? 25 8 We need to distinguish between numbers and the symbols that represent them, called numerals. The number 25 is larger than 8, but the numeral 8 above is larger

More information

C++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 3: Input/Output

C++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 3: Input/Output C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 3: Input/Output Objectives In this chapter, you will: Learn what a stream is and examine input and output streams Explore

More information

Embedded C Programming, Linux, and Vxworks. Synopsis

Embedded C Programming, Linux, and Vxworks. Synopsis Embedded C Programming, Linux, and Vxworks. Synopsis This course is extensive and contains many advanced concepts. The range of modules covers a full introduction to C, real-time and embedded systems concepts

More information

Windows PowerShell Essentials

Windows PowerShell Essentials Windows PowerShell Essentials Windows PowerShell Essentials Edition 1.0. This ebook is provided for personal use only. Unauthorized use, reproduction and/or distribution strictly prohibited. All rights

More information

Lecture 22: C Programming 4 Embedded Systems

Lecture 22: C Programming 4 Embedded Systems Lecture 22: C Programming 4 Embedded Systems Today s Goals Basic C programming process Variables and constants in C Pointers to access addresses Using a High Level Language High-level languages More human

More information

El Dorado Union High School District Educational Services

El Dorado Union High School District Educational Services El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming II (#495) Rationale: A continuum of courses, including advanced classes in technology is needed.

More information

TIP: To access the WinRunner help system at any time, press the F1 key.

TIP: To access the WinRunner help system at any time, press the F1 key. CHAPTER 11 TEST SCRIPT LANGUAGE We will now look at the TSL language. You have already been exposed to this language at various points of this book. All the recorded scripts that WinRunner creates when

More information

MISRA-C:2012 Standards Model Summary for C / C++

MISRA-C:2012 Standards Model Summary for C / C++ MISRA-C:2012 Standards Model Summary for C / C++ The LDRA tool suite is developed and certified to BS EN ISO 9001:2000. This information is applicable to version 9.4.2 of the LDRA tool suite. It is correct

More information

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C 1 An essential part of any embedded system design Programming 2 Programming in Assembly or HLL Processor and memory-sensitive

More information

2 SYSTEM DESCRIPTION TECHNIQUES

2 SYSTEM DESCRIPTION TECHNIQUES 2 SYSTEM DESCRIPTION TECHNIQUES 2.1 INTRODUCTION Graphical representation of any process is always better and more meaningful than its representation in words. Moreover, it is very difficult to arrange

More information

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,

More information

Using Casio Graphics Calculators

Using Casio Graphics Calculators Using Casio Graphics Calculators (Some of this document is based on papers prepared by Donald Stover in January 2004.) This document summarizes calculation and programming operations with many contemporary

More information

ECDL. European Computer Driving Licence. Spreadsheet Software BCS ITQ Level 2. Syllabus Version 5.0

ECDL. European Computer Driving Licence. Spreadsheet Software BCS ITQ Level 2. Syllabus Version 5.0 European Computer Driving Licence Spreadsheet Software BCS ITQ Level 2 Using Microsoft Excel 2010 Syllabus Version 5.0 This training, which has been approved by BCS, The Chartered Institute for IT, includes

More information