Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)
|
|
- Imogen Lydia Mathews
- 7 years ago
- Views:
Transcription
1 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 system. C language is widely used in the development of operating systems. An Operating System(OS) is a software(collection of programs) that controls the various functions of a computer. Also it makes other programs on your computer work. For example, you cannot work with a word processor program, such as Microsoft Word, if there is no operating system installed on your computer. Windows, Unix, Linux, Solaris, and MacOS are some of the popular operating systems. Although C was designed for implementing system software, it is also widely used for developing portable application software. Powerful features, simple syntax, and portability make C a preferred language among programmers for business and industrial applications. What kind of language is C? C is a structured programming language, which means that it allows you to develop programs using welldefined control structures (you will learn about control structures in the articles to come), and provides modularity (breaking the task into multiple sub tasks that are simple enough to understand and to reuse). C is often called a middle-level language because it combines the best elements of low-level or machine language with high-level languages. History: In the early days of computers, the only programming languages available to programmers were two low level languages: machine and assembly language. Programming in these languages was tedious and time-consuming because the programmer had manage the hardware itself (memory, stack, interrupts, etc ).. When computers became increasingly available, many high level languages such as Fortran, Pascal, and Basic developed in order to make the underlying hardware invisible to the programmer and to make syntax easier; therefore making computers easier and faster to program. In 1972, the Unix Operating system was being developed. During this time, the concept of a system programming language having attributes of both low level and high level languages also developed. System programming languages have advantages of a high level language but allow the programmer to take control of the underlying hardware if desired. Brian W. Kernigahn and Dennis M. Ritchie developed C at Bell Laboratories as a system programming language. Their underlying goal was to develop a language that was simple and [Author: Gopal B. Vashistha] Page 1
2 flexible enough to be used in a variety of different processors. (Two early versions were named A and B.) In 1983, the American National Standards Institute formed a committee to produce a C programming language standard. This "ANSI C" was completed in Throughout its history, C has been closely associated with the UNIX operating system, with system programming in general, and with the challenge of writing "portable" code that can be easily transferred to any one of many target computers. Where is C useful? C s ability to communicate directly with hardware makes it a powerful choice for system programmers. In fact, popular operating systems such as Unix and Linux are written entirely in C. Additionally, even compilers and interpreters for other languages such as FORTRAN, Pascal, and BASIC are written in C. However, C s scope is not just limited to developing system programs. It is also used to develop any kind of application, including complex business ones. The following is a partial list of areas where C language is used: Ø Ø Ø Ø Ø Ø Ø Ø Embedded Systems Systems Programming Artificial Intelligence Industrial Automation Computer Graphics Space Research Image Processing Game Programming Getting equipped to write C programs The tools required for C programming are simple. All you need are: 1. A text editor: A text editor allows you to type in, modify, and save your program. Notepad in Windows, Edit in DOS, and vi and Emacs in Unix/Linux are some popular text editors. 2. A C compiler: A compiler is a program that converts the high-level language (HLL) program (referred to as source code) into machine language (object code). Borland C, GCC, and Microsoft C are some of the popular compilers. [Author: Gopal B. Vashistha] Page 2
3 Earlier text editors and compiler had to be used separately. However, today most software vendors provide them as a package called IDE (Integrated Development Environment). Popular IDE s include Turbo C from Borland Inc., and Microsoft C from Microsoft Inc. Why you should learn C? You should learn C because: C is simple. There are only 32 keywords so C is very easy to master. Keywords are words that have special meaning in C language. C programs run faster than programs written in most other languages. C enables easy communication with computer hardware making it easy to write system programs such as compilers and interpreters. Identifiers Identifiers are the names that are given to various program elements such as variables, symbolic constants and functions.variable or function identifier that is called a symbolic constant name. Identifier can be freely named, the following restrictions. Alphanumeric characters ( a ~ z, A~Z, 0~9 ) and half underscore ( _ ) can only be used. The first character of the first contain letters ( a ~ z, A~Z ) or half underscore ( _ ) can only be used. Case is distinguishable. That is, word and WORD is recognized as a separate identifier. Reserved words are not allowed. However, part of an identifier reserved words can be included. Here are the rules you need to know: 1. Identifier name must be a sequence of letter and digits, and must begin with a letter. 2. The underscore character ( _ ) is considered as letter. 3. Names shouldn't be a keyword (such as int, float, if,break, for etc) 4. Both upper-case letter and lower-case letter characters are allowed. However, they're not interchangeable. 5. No identifier may be keyword. 6. No special characters, such as semicolon,period,blank space, slash or comma are permitted Examples of legal and illegal identifiers follow, first some legal identifiers: [Author: Gopal B. Vashistha] Page 3
4 float _number; float a; int this_is_a_very_detailed_name_for_an_identifier; The following are illegal (it's your job to recognize why): float :e; float for; float 9PI; float.3.14; float 7g; Example : Keywords Keywords are standard identifiers that have standard predefined meaning in C. Keywords are all lowercase, since uppercase and lowercase characters are not equivalent it's possible to utilize an uppercase keyword as an identifier but it's not a good programming practice. [Author: Gopal B. Vashistha] Page 4
5 Points to remember 1. Keywords can be used only for their intended purpose. 2. Keywords can't be used as programmer defined identifier. 3. The keywords can't be used as names for variables. The standard keywords are given below: Data Types C offers a standard, minimal set of basic data types. Sometimes these are called "primitive" types. A lot of complex data structures can be developed from these basic data types. The C language defines 4 fundamental data types: character integer floating-point and double floating-point This data types are declared using the keywords char,int,float and double respectively. Typical memory requirements of the basic data types are given below The size and range of these data types may vary among processor types and compilers. Data type qualifiers modify the behavior of variable type to which they are applied. Data type qualifiers can be classified into two types.two types. 1. size qualifiers 2. sign qualifiers Size qualifiers: Size qualifiers alter the size of the basic data types. There are two size qualifiers that can be applied to integer: short and long. The minimum size of short int is 16 bit. The size of int must be greater than or equal to that of a short int. The size of long int must be greater than or equal to a short int. The minimum size of a long int is 32 bits. [Author: Gopal B. Vashistha] Page 5
6 Sign qualifiers: The keywords signed and unsigned are the two sign qualifiers that specify whether a variable can hold both ve and +ve numbers, or only +ve numbers. These qualifiers can be applied to the data types int and char only. Example: unsigned int I; The following table shows all valid data type combinations supported by C, along with their minimal ranges and typical memory size. INT int An integer is a whole number (a number without a fractional part). It can be positive or negative numbers like 1, -2, 3, etc., or zero. The sizes of the integer variables depend on the hardware and operating system of the computer. On a typical 16-bit system, the sizes of the integer types are as follows. TYPE Bytes Possible Values le Values int 2 or 4-32,767 to 32,767 unsigned int 2 or 4 0 to 65,535 signed int 2 or 4-32,767 to 32,767 short int 2-32,767 to 32,767 [Author: Gopal B. Vashistha] Page 6
7 unsigned short int 2 0 to 65,535 signed short int 2-32,767 to 32,767 long int 4-2,147,483,647 to 2,147,483,647 signed long int 4-2,147,483,647 to 2,147,483,647 unsigned long int 4 0 to 4,294,967,295 Example: char char is a special integer type designed for storing single characters. The integer value of a char corresponds to an ASCII character. E.g., a value of 65 corresponds to the letter A, 66 corresponds to B, 67 to C, and so on. As in the table below, unsigned char permits values from 0 to 255, and signed char permits values from -127 (or -128) to 127. The char type is signed by default on some computers, but unsigned on others the sizes of the char types are as follows. Type Bytes Minimal range [Author: Gopal B. Vashistha] Page 7
8 char to 127 unsigned char 1 0 to 255 signed char to 127 Example: Float Floating point numbers are numbers with a decimal point. The float type can take large floating point numbers with a small degree of precision (Precision is simply the number of decimal places to which a number can be calculated with accuracy. If a number can be calculated to three decimal places, it is said to have three significant digits.) Memory size : 4 bytes Minimal range : IE-38 to IE+38 with six digit of precision Example: [Author: Gopal B. Vashistha] Page 8
9 Double Double-precision floating point numbers are also numbers with a decimal point. We know that the float type can take large floating point numbers with a small degree of precision but the doubleprecision double type can hold even larger numbers with a higher degree of precision. The sizes of the double types are as follows. Type Bytes Minimal range doubleprecision 8 IE-38 to IE+38 with 10 digit of precision long double 8 IE-38 to IE+38 with 10 digit of precision Example: [Author: Gopal B. Vashistha] Page 9
10 Constants The term constant means that it does not change during the execution of program.in the language C, constant and is the data with a constant value that does not change in the program. For example, in the program "100" "3.14" "'A'" "" Hello "" and the like, if you write data directly, and constant. Moreover, also called a literal constant. Constant expression is an expression consisting only of constants. There are four basic types of constants in C. They are: 1.Integer constants 2.Floating-point constants 3.Character constants 4.String constants Integer and floating-point constants represent numbers. They are often referred to as numerictype constants. The following rule applies to all numeric type constants: Comma and blank spaces cannot be included within the constants. Constants can be preceded by a or + sign, if desired. If either sign does not precede the constant it is assumed to be positive. The value of a constant cannot exceed specified minimum and maximum bounds. For each type of constant, these bound vary from one C compiler to another. Integer constants Integer constants are whole numbers without any fractional part. Thus integer constants consist of a sequence of digits. Integer constants can be written in three different number systems: Decimal, Octal and Hexadecimal. [Author: Gopal B. Vashistha] Page 10
11 A decimal integer constant consists of any combination of digits taken from the set 0 through 9. If the decimal constant contains two or more digits, the first digit must be something other than 0. The following are valid decimal integer constants Example: The following decimal integer constants are written incorrectly for the reasons stated. 12,001 Illegal character (,) Illegal decimal point (.) Illegal character (blank space). 045 First digit cannot be zero. Example: [Author: Gopal B. Vashistha] Page 11
12 An octal integer constant can consist any combination of digits taken from the set 0 through 7. However, the first digit must be 0, in order to identify the constant as an octal number. The following are valid octal integer constants Example : The following decimal integer constants are written incorrectly for the reasons stated Does not begin with Illegal digit (8) Illegal character (.). A hexadecimal integer constant must begin with either 0x or 0X. It can then be followed by any combination of digits taken from the set 0 through 9 and A through F (either upper-case or lowercase). The following are valid hexadecimal integer constants. 0X0 0x1 0XAB125-0x555 Example: [Author: Gopal B. Vashistha] Page 12
13 The following hexadecimal integer constants are written incorrectly for the reasons stated. 0x20.10 Illegal character (.) Does not begins with 0x or 0X. 0xabcdefg Illegal character (g). Floating-point constants A floating-point constant is a base-10 number that contains either a decimal point or an exponent or both. A floating-point constant can be written in two forms: Factorial form or Exponential form. A floating-point constant in a fractional form must have at least one digit each to the left and right of the decimal point. A floating-point in exponent form consists of a mantissa and an exponent. The mantissa itself is represented as a decimal integer constant or a decimal floatingpoint constant in fractional form. The letter E or e and the exponent follow the mantissa. The exponent must be a decimal integer. The actual number of digits in the mantissa and the exponent depends on the computer being used. The following are valid floating-point constants.</ E e-4 The following floating-point constants are written incorrectly for the reasons stated.written incorrectly for the reasons stated. 1 No decimal point or exponent. 2,00.8 Illegal character (,). 2 E Exponent must be an integer. 3 E10 Illegal character (space). Example: [Author: Gopal B. Vashistha] Page 13
14 Character constants A character constant is a single character, enclosed in single quotation marks. e.g., A B 1 Characters are stored internally in computer as coded set of binary digits, which have positive decimal integer equivalents. The value of a character constant is the numeric value of the character in the machine s character set. This means that the value of a character constant can vary from one machine to the next, depending on the character set being used on the particular machine. For example, on ASCII machine the value of A is 65 and on EBCDIC machine it is 193. Example: [Author: Gopal B. Vashistha] Page 14
15 String constants A string constant consists of zero or more character enclosed in quotation marks. Several string constants are given below. Welcome to C Programming a+b\n Error\a\a\a There is a difference between the constant A and A in C, the first A is a character constant while the second A is string constant. The notation A is a constant occupying a single byte containing the ASCII code of the character A. The notation A on the other hand,is a constant that occupies two bytes one for ASCII code of A and another for the null character with the value 0,that terminates all the string. Example: Variables Variables are means for location in memory used by a program to store data. The size of that block depends upon the range over which the variable is allowed to vary. For example, on personal computer the size of an integer variable is two bytes, and that of a long integer is four bytes. A variable region is temporarily remember a number or string value, such as covered by the program. To identify the variables, you have a name unique to every single variable. This is called a variable name. Before using a variable, use variables to what is called a variable declaration that you have to reveal the [Author: Gopal B. Vashistha] Page 15
16 names and data types that can be stored in the variable variable. The format for declaring a variable in C. [Storage-class] type data variable name [= initial value]; Storage class and the initial value can be omitted. The same data type and storage class variable can be declared, separated by commas. [Storage-class] type data variable name [= initial value] variable [= initial value] variable [= initial value]; In C the size of a variable type such as an integer need not be the same on all types of machines. When we declare a variable we inform the compiler of two things, the name of the variable and the type of the variable. For example, we declare a variable of type character with the name i by writing: char i; On seeing the "char" part of this statement the compiler sets aside one bytes of memory to hold the value of the character. It also sets up a symbol table. In that table it adds the symbol i and the relative address in memory where those one byte was set aside. Thus, later if we write: i = 'x'; we expect that,at run time when this statement is executed, the value 'x' will be placed in that memory location reserved for the storage of the value of i. Following are the rules for naming the variables: 1. All variables must be declared before they can appear in executable statement. 2. A declaration consists of a data type followed by one or more variable names separated by commas. Example: int a,b,c; 3. Variables can be distributed among declarations in any fashion. The above declaration can be written as int a; int b,c; 4. Integer type variables can be declared to be short integer for smaller integer quantities or long integer for larger integer quantities. Example: short int a,b,c; long int a,b,c; [Author: Gopal B. Vashistha] Page 16
17 5. An integer variable can also be declared to be un signed by writing unsigned int. Example: Example: unsigned int; Expressions An expression is a sequence of operators and operands that specifies computation of a value. An expression may consist of single entity or some combination of such entities interconnected by one or more operators. All expression represents a logical connection that's either true or false. Thus logical type expression actually represents numerical quantities. In C every expression evaluates to a value i.e., every expression results in some value of a certain type that can be assigned to a variable. Some examples of expressions are shown in the table given below. A+b 3.14*r*r a*a+2*a*b+b*b Example: [Author: Gopal B. Vashistha] Page 17
18 Symbolic constant in c Language A symbolic constant is name that substitute for a sequence of character that cannot be changed. The character may represent a numeric constant, a character constant, or a string. When the program is compiled, each occurrence of a symbolic constant is replaced by its corresponding character sequence. They are usually defined at the beginning of the program. The symbolic constants may then appear later in the program in place of the numeric constants, character constants, etc., that the symbolic constants represent. For example, a C program consists of the following symbolic constant definitions. #define PI #define TRUE 1 #define FALSE 0 #define PI defines a symbolic constant PI whose value is When the program is preprocessed, all occurrences of the symbolic constant PI are replaced with the replacement text Note that the preprocessor statements begin with a #symbol, and are not end with a semicolon. By convention, preprocessor constants are written in UPPERCASE. Example: 1 #include<stdio.h> #include<conio.h> [Author: Gopal B. Vashistha] Page 18
19 #define TRUE 1 #define PI void main() { float a; float b; float c; float d=pi; clrscr(); if(true) { a=100; b=a*10; c=b-a; } printf("\na=%f\nb=%f\nc=%f\npi=%f",a,b,c,d); getch(); } Example: 2 [Author: Gopal B. Vashistha] Page 19
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 informationName: 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 informationPemrograman 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 informationPROGRAMMING 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 informationEmbedded 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 informationThe 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 informationChapter 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 informationInformatica 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 informationChapter 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 informationAbout 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 informationComputers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer
Computers CMPT 125: Lecture 1: Understanding the Computer Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 3, 2009 A computer performs 2 basic functions: 1.
More informationHandout 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 informationASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)
ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6) 1 COMPUTER LANGUAGES In order for a computer to be able to execute a program, the program must first be present
More informationSystems I: Computer Organization and Architecture
Systems I: Computer Organization and Architecture Lecture 2: Number Systems and Arithmetic Number Systems - Base The number system that we use is base : 734 = + 7 + 3 + 4 = x + 7x + 3x + 4x = x 3 + 7x
More informationC++ 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 informationData Storage: Each time you create a variable in memory, a certain amount of memory is allocated for that variable based on its data type (or class).
Data Storage: Computers are made of many small parts, including transistors, capacitors, resistors, magnetic materials, etc. Somehow they have to store information in these materials both temporarily (RAM,
More informationObjective-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 informationNumbering 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 informationSection 1.4 Place Value Systems of Numeration in Other Bases
Section.4 Place Value Systems of Numeration in Other Bases Other Bases The Hindu-Arabic system that is used in most of the world today is a positional value system with a base of ten. The simplest reason
More informationThe 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 information2010/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 informationIntroduction to Python
Caltech/LEAD Summer 2012 Computer Science Lecture 2: July 10, 2012 Introduction to Python The Python shell Outline Python as a calculator Arithmetic expressions Operator precedence Variables and assignment
More informationEd. v1.0 PROGRAMMING LANGUAGES WORKING PAPER DRAFT PROGRAMMING LANGUAGES. Ed. v1.0
i PROGRAMMING LANGUAGES ii Copyright 2011 Juhász István iii COLLABORATORS TITLE : PROGRAMMING LANGUAGES ACTION NAME DATE SIGNATURE WRITTEN BY István Juhász 2012. március 26. Reviewed by Ágnes Korotij 2012.
More informationThis section describes how LabVIEW stores data in memory for controls, indicators, wires, and other objects.
Application Note 154 LabVIEW Data Storage Introduction This Application Note describes the formats in which you can save data. This information is most useful to advanced users, such as those using shared
More informationThis 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));
Introduction to Embedded Microcomputer Systems Lecture 5.1 2.9. Conversions ASCII to binary n = 100*(Data[0]-0x30) + 10*(Data[1]-0x30) + (Data[2]-0x30); This 3-digit ASCII string could also be calculated
More informationBase 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 informationChapter 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 informationA single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc
Other architectures Example. Accumulator-based machines A single register, called the accumulator, stores the operand before the operation, and stores the result after the operation. Load x # into acc
More informationBinary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1
Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1
More informationLecture 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 informationplc numbers - 13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums
plc numbers - 3. Topics: Number bases; binary, octal, decimal, hexadecimal Binary calculations; s compliments, addition, subtraction and Boolean operations Encoded values; BCD and ASCII Error detection;
More informationSources: 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 informationOct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8
ECE Department Summer LECTURE #5: Number Systems EEL : Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz Decimal Number System: -Our standard number system is base, also
More information2011, The McGraw-Hill Companies, Inc. Chapter 3
Chapter 3 3.1 Decimal System The radix or base of a number system determines the total number of different symbols or digits used by that system. The decimal system has a base of 10 with the digits 0 through
More informationIntroduction 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 informationStoring Measurement Data
Storing Measurement Data File I/O records or reads data in a file. A typical file I/O operation involves the following process. 1. Create or open a file. Indicate where an existing file resides or where
More informationDigital 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 informationJava CPD (I) Frans Coenen Department of Computer Science
Java CPD (I) Frans Coenen Department of Computer Science Content Session 1, 12:45-14:30 (First Java Programme, Inheritance, Arithmetic) Session 2, 14:45-16:45 (Input and Programme Constructs) Materials
More information3 Data Properties and Validation Rules
3 Data Properties and Validation Rules 3.1 INTRODUCTION Once a database table has been created and the fields named and the type of data which is to be stored in the field chosen, you can make further
More informationSpecifications of Paradox for Windows
Specifications of Paradox for Windows Appendix A 1 Specifications of Paradox for Windows A IN THIS CHAPTER Borland Database Engine (BDE) 000 Paradox Standard Table Specifications 000 Paradox 5 Table Specifications
More informationChapter 2 Elementary Programming
Chapter 2 Elementary Programming 2.1 Introduction You will learn elementary programming using Java primitive data types and related subjects, such as variables, constants, operators, expressions, and input
More informationNumber Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi)
Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi) INTRODUCTION System- A number system defines a set of values to represent quantity. We talk about the number of people
More informationHOMEWORK # 2 SOLUTIO
HOMEWORK # 2 SOLUTIO Problem 1 (2 points) a. There are 313 characters in the Tamil language. If every character is to be encoded into a unique bit pattern, what is the minimum number of bits required to
More information1 The Java Virtual Machine
1 The Java Virtual Machine About the Spec Format This document describes the Java virtual machine and the instruction set. In this introduction, each component of the machine is briefly described. This
More informationMotorola 8- and 16-bit Embedded Application Binary Interface (M8/16EABI)
Motorola 8- and 16-bit Embedded Application Binary Interface (M8/16EABI) SYSTEM V APPLICATION BINARY INTERFACE Motorola M68HC05, M68HC08, M68HC11, M68HC12, and M68HC16 Processors Supplement Version 2.0
More informationjava.util.scanner Here are some of the many features of Scanner objects. Some Features of java.util.scanner
java.util.scanner java.util.scanner is a class in the Java API used to create a Scanner object, an extremely versatile object that you can use to input alphanumeric characters from several input sources
More informationInstruction Set Architecture (ISA)
Instruction Set Architecture (ISA) * Instruction set architecture of a machine fills the semantic gap between the user and the machine. * ISA serves as the starting point for the design of a new machine
More informationIntroduction to Java. CS 3: Computer Programming in Java
Introduction to Java CS 3: Computer Programming in Java Objectives Begin with primitive data types Create a main class with helper methods Learn how to call built-in class methods and instance methods
More informationOutline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage
Outline 1 Computer Architecture hardware components programming environments 2 Getting Started with Python installing Python executing Python code 3 Number Systems decimal and binary notations running
More informationTopics. 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 informationEE 261 Introduction to Logic Circuits. Module #2 Number Systems
EE 261 Introduction to Logic Circuits Module #2 Number Systems Topics A. Number System Formation B. Base Conversions C. Binary Arithmetic D. Signed Numbers E. Signed Arithmetic F. Binary Codes Textbook
More informationLSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology
LSN 2 Number Systems Department of Engineering Technology LSN 2 Decimal Number System Decimal number system has 10 digits (0-9) Base 10 weighting system... 10 5 10 4 10 3 10 2 10 1 10 0. 10-1 10-2 10-3
More informationUseful Number Systems
Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2
More informationMoving 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 informationCSI 333 Lecture 1 Number Systems
CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...
More informationMULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.
Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The JDK command to compile a class in the file Test.java is A) java Test.java B) java
More informationC 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 informationChapter 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 informationJavaScript: 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 informationLevent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 INTRODUCTION TO DIGITAL LOGIC
Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 1 Number Systems Representation Positive radix, positional number systems A number with radix r is represented by a string of digits: A n
More informationPL / SQL Basics. Chapter 3
PL / SQL Basics Chapter 3 PL / SQL Basics PL / SQL block Lexical units Variable declarations PL / SQL types Expressions and operators PL / SQL control structures PL / SQL style guide 2 PL / SQL Block Basic
More informationECE 0142 Computer Organization. Lecture 3 Floating Point Representations
ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floating-point arithmetic We often incur floating-point programming. Floating point greatly simplifies working with large (e.g.,
More informationNumeral 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 informationHow To Write Portable Programs In C
Writing Portable Programs COS 217 1 Goals of Today s Class Writing portable programs in C Sources of heterogeneity Data types, evaluation order, byte order, char set, Reading period and final exam Important
More information.NET Standard DateTime Format Strings
.NET Standard DateTime Format Strings Specifier Name Description d Short date pattern Represents a custom DateTime format string defined by the current ShortDatePattern property. D Long date pattern Represents
More informationDNA Data and Program Representation. Alexandre David 1.2.05 adavid@cs.aau.dk
DNA Data and Program Representation Alexandre David 1.2.05 adavid@cs.aau.dk Introduction Very important to understand how data is represented. operations limits precision Digital logic built on 2-valued
More informationThe 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 informationLecture 11: Number Systems
Lecture 11: Number Systems Numeric Data Fixed point Integers (12, 345, 20567 etc) Real fractions (23.45, 23., 0.145 etc.) Floating point such as 23. 45 e 12 Basically an exponent representation Any number
More informationMS Access: Advanced Tables and Queries. Lesson Notes Author: Pamela Schmidt
Lesson Notes Author: Pamela Schmidt Tables Text Fields (Default) Text or combinations of text and numbers, as well as numbers that don't require calculations, such as phone numbers. or the length set by
More informationData Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:
Chapter 3 Data Storage Objectives After studying this chapter, students should be able to: List five different data types used in a computer. Describe how integers are stored in a computer. Describe how
More informationChapter 1. Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705. CS-4337 Organization of Programming Languages
Chapter 1 CS-4337 Organization of Programming Languages Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705 Chapter 1 Topics Reasons for Studying Concepts of Programming
More informationInstructor Özgür ZEYDAN BEU Dept. of Enve. Eng. http://cevre.beun.edu.tr/zeydan/ CIV 112 Computer Programming Lecture Notes (1)
Instructor Özgür ZEYDAN BEU Dept. of Enve. Eng. http://cevre.beun.edu.tr/zeydan/ CIV 112 Computer Programming Lecture Notes (1) Computer Programming A computer is a programmable machine. This means it
More informationMcGraw-Hill The McGraw-Hill Companies, Inc., 20 1. 01 0
1.1 McGraw-Hill The McGraw-Hill Companies, Inc., 2000 Objectives: To describe the evolution of programming languages from machine language to high-level languages. To understand how a program in a high-level
More informationVariables, Constants, and Data Types
Variables, Constants, and Data Types Primitive Data Types Variables, Initialization, and Assignment Constants Characters Strings Reading for this class: L&L, 2.1-2.3, App C 1 Primitive Data There are eight
More informationMS ACCESS DATABASE DATA TYPES
MS ACCESS DATABASE DATA TYPES Data Type Use For Size Text Memo Number Text or combinations of text and numbers, such as addresses. Also numbers that do not require calculations, such as phone numbers,
More informationExample 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 informationMACHINE 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 informationComputer Science 281 Binary and Hexadecimal Review
Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two
More informationTo 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 informationMemory Systems. Static Random Access Memory (SRAM) Cell
Memory Systems This chapter begins the discussion of memory systems from the implementation of a single bit. The architecture of memory chips is then constructed using arrays of bit implementations coupled
More informationERserver. DB2 Universal Database for iseries SQL Programming with Host Languages. iseries. Version 5
ERserver iseries DB2 Universal Database for iseries SQL Programming with Host Languages Version 5 ERserver iseries DB2 Universal Database for iseries SQL Programming with Host Languages Version 5 Copyright
More informationIntroduction to Python
WEEK ONE Introduction to Python Python is such a simple language to learn that we can throw away the manual and start with an example. Traditionally, the first program to write in any programming language
More information6.087 Lecture 2 January 12, 2010
6.087 Lecture 2 January 12, 2010 Review Variables and data types Operators Epilogue 1 Review: C Programming language C is a fast, small,general-purpose,platform independent programming language. C is used
More informationLexical Analysis and Scanning. Honors Compilers Feb 5 th 2001 Robert Dewar
Lexical Analysis and Scanning Honors Compilers Feb 5 th 2001 Robert Dewar The Input Read string input Might be sequence of characters (Unix) Might be sequence of lines (VMS) Character set ASCII ISO Latin-1
More information6.170 Tutorial 3 - Ruby Basics
6.170 Tutorial 3 - Ruby Basics Prerequisites 1. Have Ruby installed on your computer a. If you use Mac/Linux, Ruby should already be preinstalled on your machine. b. If you have a Windows Machine, you
More informationJava Crash Course Part I
Java Crash Course Part I School of Business and Economics Institute of Information Systems HU-Berlin WS 2005 Sebastian Kolbe skolbe@wiwi.hu-berlin.de Overview (Short) introduction to the environment Linux
More informationProgramming Languages & Tools
4 Programming Languages & Tools Almost any programming language one is familiar with can be used for computational work (despite the fact that some people believe strongly that their own favorite programming
More informationC 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 informationChapter 1: Digital Systems and Binary Numbers
Chapter 1: Digital Systems and Binary Numbers Digital age and information age Digital computers general purposes many scientific, industrial and commercial applications Digital systems telephone switching
More informationOpenOffice.org 3.2 BASIC Guide
OpenOffice.org 3.2 BASIC Guide Copyright The contents of this document are subject to the Public Documentation License. You may only use this document if you comply with the terms of the license. See:
More informationComputer Science 217
Computer Science 217 Midterm Exam Fall 2009 October 29, 2009 Name: ID: Instructions: Neatly print your name and ID number in the spaces provided above. Pick the best answer for each multiple choice question.
More informationDivide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1
Divide: Paper & Pencil Computer Architecture ALU Design : Division and Floating Point 1001 Quotient Divisor 1000 1001010 Dividend 1000 10 101 1010 1000 10 (or Modulo result) See how big a number can be
More informationCh. 10 Software Development. (Computer Programming)
Ch. 10 Software Development (Computer Programming) 1 Definitions Software or Program Instructions that tell the computer what to do Programmer Someone who writes computer programs 2 Instruction Set A vocabulary
More information3 SOFTWARE AND PROGRAMMING LANGUAGES
3 SOFTWARE AND PROGRAMMING LANGUAGES 3.1 INTRODUCTION In the previous lesson we discussed about the different parts and configurations of computer. It has been mentioned that programs or instructions have
More informationThis Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers
This Unit: Floating Point Arithmetic CIS 371 Computer Organization and Design Unit 7: Floating Point App App App System software Mem CPU I/O Formats Precision and range IEEE 754 standard Operations Addition
More informationChapter 7D The Java Virtual Machine
This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly
More informationIntroduction to UNIX and SFTP
Introduction to UNIX and SFTP Introduction to UNIX 1. What is it? 2. Philosophy and issues 3. Using UNIX 4. Files & folder structure 1. What is UNIX? UNIX is an Operating System (OS) All computers require
More informationSecrets of printf. 1 Background. 2 Simple Printing. Professor Don Colton. Brigham Young University Hawaii. 2.1 Naturally Special Characters
Secrets of Professor Don Colton Brigham Young University Hawaii is the C language function to do formatted printing. The same function is also available in PERL. This paper explains how works, and how
More information