Introduction to Computer Programming - CPU1141 Faculty of Natural Sciences Department of Mathematics & Computer Science Bachelor of Science Degree

Size: px
Start display at page:

Download "Introduction to Computer Programming - CPU1141 Faculty of Natural Sciences Department of Mathematics & Computer Science Bachelor of Science Degree"

Transcription

1 Introduction to Computer Programming - CPU1141 Faculty of Natural Sciences Department of Mathematics & Computer Science Bachelor of Science Degree Computer Science: Level 3

2 Course Details Printed Materials: Introduction to Computer Programming Course Material Introduction to Computer Programming Practical Guide Day Schools Practical Sessions Practical Test Continuous Assessment Tests [NBT I & NBT II] Final Exam

3 Course content Computer Programming Introduction to Pascal Data Types & Variables Operations & Expressions Control Structures Functions & Procedures Arrays & Pointers Introduction to C Data Types & Variables Operations & Expressions Control Structures Input output functions Arrays, Strings, Pointers and Functions File Handling

4 Today s Sequence Computer Programming Introduction to Pascal Data Type & Variables Operations & Expressions Control Structures

5

6 Learning Outcome Aim: To provide a brief introduction to the computer programming You will be able to: Get an idea about programming and the level of languages

7 Introduction This chapter discuss the reasons for learning programming and level of languages What is a program? A program is a set of step by step instructions that directs the computer to do the tasks you want it to do and produce the result you want

8 Introduction Why programming? Programming helps you understand computers Writing few simple programs increases your confident level Learning programming lets you find out how you solve problems analytically.

9 Introduction Terms: Programming Language: A set of rules that provides a way of telling a computer what operations to perform

10 Levels of Languages Programming Language mainly divided into two namely Lower and Higher Lower: How close it is to the language of the computer eg: 1 s and 0 s Higher: How close it is to the language of people use eg: similar to English language

11 Levels of Languages There are five levels of language: Machine Language Assembly Language High-Level Language Very High-Level Language Natural Language

12 Levels of Languages Machine Language: The lowest level of programming language Only understood by the computer and IMPOSSIBLE for humans Each type of computer has its own machine language Represent the data and program instructions as 1s and 0s These 1s and 0s are corresponded to the ON and OFF electrical states in the computer respectively.

13 Levels of Languages Assembly Language: Used abbreviation which are easily remembered by human to replace 1s and 0s Eg: ADD, MUL Each type of computer has its own assembly language Requires a translator called Assembler to convert the assembly language program into machine language Assembly Language Translator ( Assembler) Machine Language

14 Levels of Languages High-Level Language: Began using of High-Level language in early 1960 Programs were written in similar to English Language Eg: COBOL, Fortran, Pascal, C, C++, C# Runs on any machine Benefits: Convenient More production with less effort Tend to focus on solving much complex problems

15 Levels of Languages High-Level Language: A translator called Compiler is needed to translate the symbolic statements into machine language Source Code Translator ( Compiler) Object Code Programmers write programs in a form called Source Code Compiler is used to translate source code to machine language The compiler produces an intermediary form called object code Object code is much similar to a computer s machine language

16 Levels of Languages Very High-Level Language: These are known by their generation number; fourth generation languages (4GLs) 4GL languages are programming languages closer to human languages than typical high level languages Mostly used to access databases

17 Levels of Languages Natural Language: These are used for artificial intelligence and neural networks Eg: Prolog Prolog is used to develop Expert Systems

18 PART A: PASCAL LANGUAGE

19 Learning Outcomes Aims: To provide a brief introduction to the Pascal Language You will be able to: Identify the major segments of a Pascal program Write a simple Pascal program

20 Introduction Major segments of a Pascal Program: A Pascal program has three major segments: The program identification and description segment The declaration segment The main body of the program

21 Introduction Segment 1: Program Identification & Description: The structure of the first line in the program PROGRAM example01 (INPUT, OUTPUT); Explanation: Code PROGRAM example01 (INPUT, OUTPUT) Description First word of any Pascal program Program Name To indicate whether program has any input or output ; Last character of any Pascal line

22 Introduction Segment 1: Program Identification & Description: Every Pascal line should end with a semicolon ; So, it is possible to spread one Pascal line over a no. of horizontal lines Pascal is not case sensitive language Upper case characters were used to represent keywords in examples

23 Introduction Segment 1: Program Identification & Description: Rules in Pascal for giving program name to a program: Name has to start with a letter of the alphabet a-z or an underscore _ Do not start a program name with a digit or special characters #,? The other items in a name could contain any keyboard character There should be no blank space within a name Eg: if a name contain 2 components, it can be separated using an underscore Do not include keywords used in Pascal for naming a program

24 Introduction Segment 1: Program Identification & Description: Keywords in Pascal: And Downto If Or Then Array Else In Packed To Begin End Label Procedu re Progra m Type Case File Mod Until Const For Nil Record Var Div Functi on Not Repeat While Do Goto Of Set wit h

25 Introduction Segment 2: Declaration: Define variables, constants etc. in the program All of the entities going to be used in the program must be defined For that, data types and variables will be deeply discussed in chapter 2

26 Introduction Segment 3: Main body of the program: Main body of the program is written within BEGIN-END pair This is equivalent to a set of brackets It is possible to have any no. of BEGIN-END pairs in a single program However, no. of BEGIN statements should match no. of END statements

27 Introduction Segment 3: Main body of the program: Example: PROGRAM firstprogram (OUTPUT); BEGIN WRITELN ( Hello my friend ); END

28 Introduction Displaying output : WRITELN, WRITE command To display several lines of text you need a WRITELN statement for each line Example PROGRAM lineoftext (OUTPUT); BEGIN WRITELN ( Hi there ); WRITELN ( How are you today? ); WRITELN ( Are you ready for Pascal ) END

29 Introduction Displaying output : WRITELN, WRITE command Explanation: Each statement must be separated from the next one with semicolon This is the only way the compiler can recognize the end of the statement But, you may skip the semicolon in the last statement of the program block

30 Introduction Displaying output : WRITELN, WRITE command Output: Hi there How are you today? Are you ready for Pascal The WRITELN statement displays a line of text followed by a new line Use WRITE statement, if you want to display two string on the same line

31 Introduction Displaying output : WRITELN, WRITE command Code: PROGRAM Twolines (OUTPUT); BEGIN WRITE ( Hi there ); WRITELN ( How are you today? ); WRITELN ( Are you ready for Pascal ) END Output: Hi there How are you today? Are you ready for Pascal

32 Introduction Displaying output : WRITELN, WRITE command To display the content of the variable you need a WRITELN or WRITE statement without using quotes Also WRITELN or WRITE can be used to display text and content of variables in the same statement by separating them with a coma WRITELN ( The Result is =, r);

33 Introduction Comments: Comments are enclosed with braces or bracket and a star in cases (*This is a comment*) Can be included in anywhere in the program Compiler ignores the comment Comments are useful to explain the program to a human reader

34 Introduction Indentations: It is customary to a line each BEGIN-END pair along the same vertical line Eg: five horizontal spaces should be kept from the previous block when starting a new

35 PART A: PASCAL LANGUAGE

36 Learning Outcomes Aims: To provide an overview of some significant features of the Pascal Language You will be able to: Identify the data types in Pascal Language Get an idea about declaring the variable and constant Learn how to format you numeric outputs

37 Data Types When writing program, it is necessary to store information in component form to manipulate them later For that, variables are used Every variable should have a name and a type Type mean the values that the variable can take It helps to determine the amount of memory space to store a variable

38 Data Types Variable should be declared in the declaration section There are no. of standard data types Integer Real Boolean Char

39 Data Types Integer: This type allows to represent, store and process integer numbers Contains all the integer values in the range of; -maxint,., -1, 0,+1,.,+maxint The value of maxint is on minicomputer in large computers So, outcome of any arithmetic on integer values will be correct only of they are in ± maxint Or else, the answers will be unpredictable (overflow)

40 Data Types Real: Real numbers are numbers with decimal values eg: meters, 9.2 seconds The limit of the real numbers which can be stored in a computer is very large compared to integers

41 Data Types BOOLEAN: Can only have two values True False Normal arithmetic operations cannot be performed on a boolean variable

42 Data Types Char: Can hold any single given character at a time Eg: if x is char variable, it can hold only one character at a time Blank space also considered as a character When assigning char variable, enclosed the character with single quotes Eg: A Each char requires a one byte of memory

43 Variables Variable is a location in memory referenced by a variable name (identifier) where a data can be stored Can hold only one value at a time during the program execution Values can be changed during several executions

44 Variables Variable Names: A variable must be declared before using the program Variables are the identifiers When declaring a variable, it consists with Sequence of letters and digits First character should be either a letter or underscore Keywords cannot be used

45 Variables Variable Declaration: The type and the name of a variable should be initiate before using a program It should be declared in the declaration part in the program Declaration part starts with the keyword VAR Eg: VAR gross_salary : REAL; n, i : INTEGER name : CHAR;

46 Variables Variable Declaration: Eg1: Following equation gives the total resistance R of three resisters r1, r2 and r3 connected in parallel The programmer should consider before writing the program for the above problem, Read the values for r1, r2 and r3 Calculate R Print the result

47 Variables Variable Declaration: Eg1: Line 1 Line 2 Line 3 Line 4 Line 5 Line 6 Line 7 Line 8 Line 9 Line 10 PROGRAM calc_of_resistance (INPUT, OUTPUT); VAR r1,r2,r3,r : REAL; BEGIN WRITE ( Enter three resisters: ); READLN ( r1,r2,r3 ); R :=1/r1+1/r2+1/r3; R := 1/R; WRITELN ( Total Resistance is, R); END.

48 Variables Variable Declaration : Explanation: Line 1: Program naming Line 2: variable naming and declaration Line 4-10 : solving the given problem Line 6: Reading the user inputs for r1, r2, and r3 Line 7: calculating the R with given r1, r2 and r3 Line 8: replacing the R with value of 1/R Line 9: printing the calculated value for R

49 Variables Variable Declaration : how practically run a program for Eg1 Enter the given program Save and compile it Compiler show if any syntax errors available Fix them until the program is free from syntax errors When the compilation is successful you are ready to run the program The computer waits until you put three values for r1, r2 and r3 when the program runs Once entered values, the total resistance will be displayed Enter three resisters: Total Resistance is : E-01

50 Variables Reading from the keyboard: READLN, READ: READLN and READ commands in Pascal program are used to read values given by user to produce results READ: is used to read a value of one variable at a time Eg: READ (variable) / READ (r1); READLN: is used to read the value of one or more variables Eg: READLN (variable_list) / READLN (r1,r2,r3);

51 Variables Formatting Output: You can format your output in a fixed notation Eg1: WRITELN ( Total Resistance is, R:8:2); The format 8:2 determines a field width of 8 positions including 2 decimal places Total Resistance is : *******0.92

52 Variables Constants : A constant remains unchanged throughout the execution of the program It is often useful to give a symbolic name (identifier) to a constant This can then be used throughout the program whenever the value of the constant is required Eg: if the program replace with pi, it would be much easier to read

53 Variables Constants : Keyword CONST is used to declare constants in the declaration segment of the program Syntax: Example: CONST identifier = constant; CONST pi = 22/7;

54 PART A: PASCAL LANGUAGE

55 Learning Outcomes Aims: To provide an overview of some important features of the Pascal Language You will be able to: Learn various operators and their precedence in Pascal

56 Types of Operators The operators define how the variables and constants in and expression will be manipulated Three operators allowed in Pascal; Arithmetic Operators Relational Operators Logical Operators

57 Types of Operators Expression: An Expression is a combination of variables, constants and operators written according to the syntax of the language Eg: a + b a + 200*w total + x/3

58 Types of Operators Arithmetic Operators: Basic arithmetic operations + : addition - : subtraction * : multiplication / : division These operators act as usual operators The entities on which the operators are applied are called as Operands Eg: o 5+3 o Here, 5 and 3 are operands and + is the operator

59 Types of Operators Arithmetic Operators: Additionally, DIV and MOD are used as operators Eg: For integer division, DIV is used [a DIV b] Divide a by b and give the divisor 10 DIV 5 = 2 MOD is used to get the remainder of integer division [a MOD b] Divide a by b and give the remainder 10 MOD 5 = 0

60 Types of Operators Relational Operators: A relational operator is used to make comparisons between two expressions Allowed relational operators in Pascal; Operator Usage = Equal to < Less than > Grater than <> Not equal to <= Less than or equal to >= Grater than or equal to

61 Types of Operators Relational Operators: Each one of the operator compares its left hand side operand with its right hand side operand Operands can be variables or expressions The whole expression involving the relational operator then evaluates to an integer

62 Types of Operators Logical Operators: Logical operators let you combine two or more relational expressions into a single expression which evaluates to either true or false Eg for Pascal logical operators; NOT AND OR

63 Types of Operators Logical Operators: AND Operator Expression 1 Expression 2 Result True True True True False False False True False False False False

64 Types of Operators Logical Operators: OR Operator Expression 1 Expression 2 Result True True True True False True False True True False False False Logical Operators: NOT Operator Expression True False Result False True

65 Operator Precedence Operators are used in a program according to their priority order (precedence) as follows; Operation Symbol Precedence Multiplication *, /, DIV, MOD 1 Addition +, - 2 Relation =, <, >, <>, <=, >= Logical NOT 4 3 AND 5 OR 6

66 Operator Precedence Brackets always have higher precedence than all the above operators If bracket used; The content inside the innermost pair of brackets will be evaluated first When several operations having same precedence; Evaluation will be done in left to right

67 Character operations In addition to the comparison statements, following are used as operators ORD SUCC PRED CHR

68 Character operations ORD: ORD function has one argument which should be a character or a character variable It will return an integer number corresponding to the internal representation If ASCII is used, then the ORD function will return the corresponding ASCII value

69 Character operations CHR: CHR function takes an integer as an input argument and returns the corresponding character Opposite of the ORD function SUCC: SUCC function takes a single character or a character variable as an argument Returns the next character

70 Character operations PRED: PRED function takes a single character or a character variable as the input argument Returns the previous character

71 PART A: PASCAL LANGUAGE

72 Learning Outcomes Aims: To provide an overview of control structures in Pascal Language You will be able to: Use the major control structures such as repetition loops conditional statements in Pascal Language

73 Control Structures For practical use of computers, selective and repetitive expressions are necessary Conditional statements: There are two main types of statements in Pascal for selective operations IF-THEN CASE

74 Conditional Statements IF-THEN: Use when we have to select a set of actions from two sets depending on a condition IF condition THEN statement ELSE statement; However, the ELSE is optional IF-THEN and IF-THEN-ELSE statements are treated as one compound statement So, a semicolon is used only at the end

75 Conditional Statements IF-THEN: The condition with IF must produce a boolean result The boolean expression is evaluated If it is true, The statements following THEN will be executed Otherwise, The statements following ELSE will be executed If there are more than one statement with IF-THEN or ELSE statements, they are grouped with BEGIN- END

76 Conditional Statements IF-THEN: Example: IF A > B THEN max := A ELSE max := B; ELSE-IF statements are used to make multi-way decision based on several conditions This is done by cascading several comparisons As soon as one of a else-if gives a true result, corresponding statements will be executed and no further comparisons will be performed

77 Conditional Statements ELSE-IF: Example: IF (result >= 75) THEN WRITELN ( Passed: Grade A ) ELSE IF (result >= 60) THEN WRITELN ( Passed: Grade B ) ELSE IF (result >= 45) THEN WRITELN ( Passed: Grade C ) ELSE WRITELN ( Failed );

78 Conditional Statements Nested IF Statements: IF statement inside the other IF statements are known as Nested IF Statement If there is a problem that involved with more than two alternatives courses of action can be coded using nested if statement In the nested if, the else statement is always associated with the nearest if statement

79 Conditional Statements Nested IF Statements: Example: IF i > 10 THEN BEGIN WRITELN ( i is more than 10 ); IF j > 3 THEN WRITELN ( j is more than 3 ); ELSE WRITELN ( j is less than or equal to 3 ); END ELSE WRITELN ( i is less than equal to 10 );

80 Conditional Statements IF Statements: Example: Write a program in Pascal to read a set of numbers and to find the maximum value. The program should be terminated when a-1 is read Refer page 22

81 Conditional Statements CASE Statements: CASE statement allows the choice of one out of several sets of action The selection is done by matching the value of the selector with a case label attached to each statement

82 Conditional Statements CASE Statements: CASE selector OF case label1: statement case label2: statement.. case labeln: statement ELSE statement END;

83 Conditional Statements CASE Statements: Depending on the selection value, the case statement will pick the appropriate action If the SELECTOR has a value for which no action has been described, then the ELSE statement is executed CASE month OF 1,3,5,7,8,10,12: no. of days := 31; 2 : no. of days := 28; 4,6,9,11 : no. of days := 30; END;

84 Conditional Statements CASE Statements: If there is value range then the CASE statement are written as follow; CASE mark OF : grade := F ; : grade := C ; : grade := B ; : grade := A ; END;

85 Conditional Statements CASE Statements: Example: Write a program to read a number between 1-7. if the number is 1 then print Monday. If it is 2 then print Tuesday and so on.

86 CASE Statements: Example: PROGRAM eg_case(input, OUTPUT); VAR number : INTEGER; BEGIN WRITELN( Enter a number within 1-7: ); READLN(number); END. CASE number OF 1 : WRITELN( Monday ); 2 : WRITELN( Tuesday ); 3 : WRITELN( Wednesday ); 4 : WRITELN( Thursday ); 5 : WRITELN( Friday ); 6 : WRITELN( Saturday ); 7 : WRITELN( Sunday ); ELSE WRITELN( Invalid day of the week!!! ); END;

87 Repetition There are three main types of statements for repeating certain instructions REPEAT UNTIL Loop WHILE Loop FOR Loop

88 Repetition REPEAT-UNTIL Loop: This will repeat everything that is inside this loop, as the condition given with the until statement is false When the statement becomes true, the loop is completed Any statements after UNTIL are then executed The expression supplied with the UNTIL statement must give a boolean value

89 Repetition REPEAT-UNTIL Loop: Example: REPEAT statement(s) UNTIL boolean_expression; x:=1; REPEAT WRITELN(x); x:= x +1; UNTIL x > 10;

90 Repetition REPEAT-UNTIL Loop: Example: Write a program to read a set of integer numbers and to calculate the total and the average. The end of the list of numbers is denoted by -1.

91 REPEAT-UNTIL Loop: Example PROGRAM eg_repeatuntil(input, OUTPUT); CONST endmark = -1; VAR value, total, count, avg : INTEGER; BEGIN total := 0; count := 0; avg := 0; REPEAT WRITELN( Enter a number: ); READLN(value); count := count + 1; total := total + value; avg := total DIV count; END. WRITELN( The total is:, total, and the average is:, avg); UNTIL value = endmark;

92 Repetition REPEAT-UNTIL Loop: Example: This program will add the endmark (-1) to the output. So this should be corrected as follows

93 REPEAT-UNTIL Loop: Example PROGRAM eg_repeatuntil(input, OUTPUT); CONST endmark = -1; VAR value, total, count, avg : INTEGER; BEGIN total := 0; count := 0; avg := 0; WRITELN( Enter a number: ); READLN(value); REPEAT count := count + 1; total := total + value; avg := total DIV count; WRITELN( The total is:, total, and the average is:, avg); WRITELN( Enter a number: ); READLN(value); END. UNTIL value = endmark;

94 Repetition REPEAT-UNTIL Loop: Example: This program will do the answers correctly as follows;

95 Repetition WHILE Loop: WHILE loop checks the condition at the beginning So the constants within the loop may or may not be executed WHILE loop will be executed as long as the condition is true If there are more than one statement with the WHILE statement, they can be grouped with BEGIN-END

96 Repetition WHILE Loop: Example: WHILE boolean_expression DO statement; x:=1; WHILE x <=10 DO BEGIN WRITELN(x); x:= x +1; END;

97 REPEAT-UNTIL Loop: Example using WHILE PROGRAM eg_while(input, OUTPUT); CONST endmark = -1; VAR value, total, count, avg : INTEGER; BEGIN total := 0; count := 0; avg := 0; WRITELN( Enter a number: ); READLN(value); WHILE value <> endmark DO BEGIN count := count + 1; total := total + value; avg := total DIV count; END. END; WRITELN( The total is:, total, and the average is:, avg); WRITELN( Enter a number: ); READLN(value);

98 Repetition FOR Loop: Used in repeating a loop for several times FOR a := b TO c DO a, b and c could be any data type for which it is possible to go from b to c in a finite no. of increments a,b and c are real variables Most cases they will be integers

99 Repetition FOR Loop: FOR a:=b DOWNTO c DO In this loop, the values are decreased from b to c If there are more than one statement with the FOR statement, they are grouped with BEGIN- END

100 Repetition FOR Loop: FOR control_variable:= initial TO/ DOWNTO DO statement; Example: FOR x:= 1 TO 10 DO WRITELN (x); FOR x:= 10 DOWNTO 1 DO WRITELN (x);

101 REPEAT-UNTIL Loop: Example using FOR LOOP to find the total and average of 5 numbers PROGRAM eg_for(input, OUTPUT); VAR value, total, count, avg : INTEGER; i : INTEGER; BEGIN total := 0; count := 0; avg := 0; FOR i := 1 TO 5 DO BEGIN WRITELN( Enter a number: ); READLN(value); count := count + 1; total := total + value; avg := total DIV count; END. END; WRITELN( The total is:, total, and the average is:, avg);

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

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

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

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

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

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

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)

ASSEMBLY 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 information

Java Basics: Data Types, Variables, and Loops

Java Basics: Data Types, Variables, and Loops Java Basics: Data Types, Variables, and Loops If debugging is the process of removing software bugs, then programming must be the process of putting them in. - Edsger Dijkstra Plan for the Day Variables

More information

Computer Science 281 Binary and Hexadecimal Review

Computer 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 information

Introduction to Python

Introduction 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 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

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89 by Joseph Collison Copyright 2000 by Joseph Collison All rights reserved Reproduction or translation of any part of this work beyond that permitted by Sections

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

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

1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier.

1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier. Study Group 1 Variables and Types 1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier. 2. What does the byte 00100110 represent? 3. What is the purpose of the declarations

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

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

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals 1 Recall From Last Time: Java Program import java.util.scanner; public class EggBasket { public static void main(string[]

More information

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser) High-Level Programming Languages Nell Dale & John Lewis (adaptation by Michael Goldwasser) Low-Level Languages What are disadvantages of low-level languages? (e.g., machine code or assembly code) Programming

More information

PL / SQL Basics. Chapter 3

PL / 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 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

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

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

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

EKT150 Introduction to Computer Programming. Wk1-Introduction to Computer and Computer Program

EKT150 Introduction to Computer Programming. Wk1-Introduction to Computer and Computer Program EKT150 Introduction to Computer Programming Wk1-Introduction to Computer and Computer Program A Brief Look At Computer Computer is a device that receives input, stores and processes data, and provides

More information

Lab Experience 17. Programming Language Translation

Lab Experience 17. Programming Language Translation Lab Experience 17 Programming Language Translation Objectives Gain insight into the translation process for converting one virtual machine to another See the process by which an assembler translates assembly

More information

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language Translation Translating to Java Introduction to Computer Programming The job of a programmer is to translate a problem description into a computer language. You need to be able to convert a problem description

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

MATLAB Programming. Problem 1: Sequential

MATLAB Programming. Problem 1: Sequential Division of Engineering Fundamentals, Copyright 1999 by J.C. Malzahn Kampe 1 / 21 MATLAB Programming When we use the phrase computer solution, it should be understood that a computer will only follow directions;

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

CSCI 3136 Principles of Programming Languages

CSCI 3136 Principles of Programming Languages CSCI 3136 Principles of Programming Languages Faculty of Computer Science Dalhousie University Winter 2013 CSCI 3136 Principles of Programming Languages Faculty of Computer Science Dalhousie University

More information

McGraw-Hill The McGraw-Hill Companies, Inc., 20 1. 01 0

McGraw-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 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

Writing Control Structures

Writing Control Structures Writing Control Structures Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 5-1 Objectives After completing this lesson, you should be able to do the following: Identify

More information

Introduction to Python

Introduction 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 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

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

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored? Inside the CPU how does the CPU work? what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored? some short, boring programs to illustrate the

More information

Perl in a nutshell. First CGI Script and Perl. Creating a Link to a Script. print Function. Parsing Data 4/27/2009. First CGI Script and Perl

Perl in a nutshell. First CGI Script and Perl. Creating a Link to a Script. print Function. Parsing Data 4/27/2009. First CGI Script and Perl First CGI Script and Perl Perl in a nutshell Prof. Rasley shebang line tells the operating system where the Perl interpreter is located necessary on UNIX comment line ignored by the Perl interpreter End

More information

Semantic Analysis: Types and Type Checking

Semantic Analysis: Types and Type Checking Semantic Analysis Semantic Analysis: Types and Type Checking CS 471 October 10, 2007 Source code Lexical Analysis tokens Syntactic Analysis AST Semantic Analysis AST Intermediate Code Gen lexical errors

More information

PROBLEMS (Cap. 4 - Istruzioni macchina)

PROBLEMS (Cap. 4 - Istruzioni macchina) 98 CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS PROBLEMS (Cap. 4 - Istruzioni macchina) 2.1 Represent the decimal values 5, 2, 14, 10, 26, 19, 51, and 43, as signed, 7-bit numbers in the following binary

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

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

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

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 01 / 21 / 2014 Instructor: Michael Eckmann Today s Topics Introduction Homework assignment Review the syllabus Review the policies on academic dishonesty and improper

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

Functional Programming

Functional Programming FP 2005 1.1 3 Functional Programming WOLFRAM KAHL kahl@mcmaster.ca Department of Computing and Software McMaster University FP 2005 1.2 4 What Kinds of Programming Languages are There? Imperative telling

More information

Chapter 5 Instructor's Manual

Chapter 5 Instructor's Manual The Essentials of Computer Organization and Architecture Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003 Chapter 5 Instructor's Manual Chapter Objectives Chapter 5, A Closer Look at Instruction

More information

Computational Mathematics with Python

Computational Mathematics with Python Boolean Arrays Classes Computational Mathematics with Python Basics Olivier Verdier and Claus Führer 2009-03-24 Olivier Verdier and Claus Führer Computational Mathematics with Python 2009-03-24 1 / 40

More information

A Programming Language for Mechanical Translation Victor H. Yngve, Massachusetts Institute of Technology, Cambridge, Massachusetts

A Programming Language for Mechanical Translation Victor H. Yngve, Massachusetts Institute of Technology, Cambridge, Massachusetts [Mechanical Translation, vol.5, no.1, July 1958; pp. 25-41] A Programming Language for Mechanical Translation Victor H. Yngve, Massachusetts Institute of Technology, Cambridge, Massachusetts A notational

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

The previous chapter provided a definition of the semantics of a programming

The previous chapter provided a definition of the semantics of a programming Chapter 7 TRANSLATIONAL SEMANTICS The previous chapter provided a definition of the semantics of a programming language in terms of the programming language itself. The primary example was based on a Lisp

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

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

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

Symbol Tables. Introduction

Symbol Tables. Introduction Symbol Tables Introduction A compiler needs to collect and use information about the names appearing in the source program. This information is entered into a data structure called a symbol table. The

More information

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority) Boolean Expressions, Conditions, Loops, and Enumerations Relational Operators == // true if two values are equivalent!= // true if two values are not equivalent < // true if left value is less than the

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

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

2) Write in detail the issues in the design of code generator.

2) Write in detail the issues in the design of code generator. COMPUTER SCIENCE AND ENGINEERING VI SEM CSE Principles of Compiler Design Unit-IV Question and answers UNIT IV CODE GENERATION 9 Issues in the design of code generator The target machine Runtime Storage

More information

COMPUTER SCIENCE TRIPOS

COMPUTER SCIENCE TRIPOS CST.98.5.1 COMPUTER SCIENCE TRIPOS Part IB Wednesday 3 June 1998 1.30 to 4.30 Paper 5 Answer five questions. No more than two questions from any one section are to be answered. Submit the answers in five

More information

Multiplying and Dividing Signed Numbers. Finding the Product of Two Signed Numbers. (a) (3)( 4) ( 4) ( 4) ( 4) 12 (b) (4)( 5) ( 5) ( 5) ( 5) ( 5) 20

Multiplying and Dividing Signed Numbers. Finding the Product of Two Signed Numbers. (a) (3)( 4) ( 4) ( 4) ( 4) 12 (b) (4)( 5) ( 5) ( 5) ( 5) ( 5) 20 SECTION.4 Multiplying and Dividing Signed Numbers.4 OBJECTIVES 1. Multiply signed numbers 2. Use the commutative property of multiplication 3. Use the associative property of multiplication 4. Divide signed

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

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12 C5 Solutions 1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12 To Compute 0 0 = 00000000 To Compute 1 Step 1. Convert 1 to binary 00000001 Step 2. Flip the bits 11111110

More information

1 Description of The Simpletron

1 Description of The Simpletron Simulating The Simpletron Computer 50 points 1 Description of The Simpletron In this assignment you will write a program to simulate a fictional computer that we will call the Simpletron. As its name implies

More information

Computational Mathematics with Python

Computational Mathematics with Python Computational Mathematics with Python Basics Claus Führer, Jan Erik Solem, Olivier Verdier Spring 2010 Claus Führer, Jan Erik Solem, Olivier Verdier Computational Mathematics with Python Spring 2010 1

More information

13 Classes & Objects with Constructors/Destructors

13 Classes & Objects with Constructors/Destructors 13 Classes & Objects with Constructors/Destructors 13.1 Introduction In object oriented programming, the emphasis is on data rather than function. Class is a way that binds the data & function together.

More information

Exercise 1: Python Language Basics

Exercise 1: Python Language Basics Exercise 1: Python Language Basics In this exercise we will cover the basic principles of the Python language. All languages have a standard set of functionality including the ability to comment code,

More information

Levels of Programming Languages. Gerald Penn CSC 324

Levels of Programming Languages. Gerald Penn CSC 324 Levels of Programming Languages Gerald Penn CSC 324 Levels of Programming Language Microcode Machine code Assembly Language Low-level Programming Language High-level Programming Language Levels of Programming

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

MICROPROCESSOR AND MICROCOMPUTER BASICS

MICROPROCESSOR AND MICROCOMPUTER BASICS Introduction MICROPROCESSOR AND MICROCOMPUTER BASICS At present there are many types and sizes of computers available. These computers are designed and constructed based on digital and Integrated Circuit

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

Selection Statements

Selection Statements Chapter 5 Selection Statements 1 Statements So far, we ve used return statements and expression ess statements. e ts. Most of C s remaining statements fall into three categories: Selection statements:

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

MATHEMATICS: REPEATING AND GROWING PATTERNS First Grade. Kelsey McMahan. Winter 2012 Creative Learning Experiences

MATHEMATICS: REPEATING AND GROWING PATTERNS First Grade. Kelsey McMahan. Winter 2012 Creative Learning Experiences MATHEMATICS: REPEATING AND GROWING PATTERNS Kelsey McMahan Winter 2012 Creative Learning Experiences Without the arts, education is ineffective. Students learn more and remember it longer when they are

More information

3.GETTING STARTED WITH ORACLE8i

3.GETTING STARTED WITH ORACLE8i Oracle For Beginners Page : 1 3.GETTING STARTED WITH ORACLE8i Creating a table Datatypes Displaying table definition using DESCRIBE Inserting rows into a table Selecting rows from a table Editing SQL buffer

More information

The software described is supplied under license and must be used and copied in accordance with the enclosed license terms and conditions.

The software described is supplied under license and must be used and copied in accordance with the enclosed license terms and conditions. C/AL Programming C/AL Programming NOTICE This material is for informational purposes only. Navision a/s disclaims all warranties and conditions with regard to use of the material for other purposes. Navision

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

Algorithm & Flowchart & Pseudo code. Staff Incharge: S.Sasirekha

Algorithm & Flowchart & Pseudo code. Staff Incharge: S.Sasirekha Algorithm & Flowchart & Pseudo code Staff Incharge: S.Sasirekha Computer Programming and Languages Computers work on a set of instructions called computer program, which clearly specify the ways to carry

More information

Computer Programming. Course Details An Introduction to Computational Tools. Prof. Mauro Gaspari: mauro.gaspari@unibo.it

Computer Programming. Course Details An Introduction to Computational Tools. Prof. Mauro Gaspari: mauro.gaspari@unibo.it Computer Programming Course Details An Introduction to Computational Tools Prof. Mauro Gaspari: mauro.gaspari@unibo.it Road map for today The skills that we would like you to acquire: to think like a computer

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

Chapter 6: Programming Languages

Chapter 6: Programming Languages Chapter 6: Programming Languages Computer Science: An Overview Eleventh Edition by J. Glenn Brookshear Copyright 2012 Pearson Education, Inc. Chapter 6: Programming Languages 6.1 Historical Perspective

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

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine 7 Objectives After completing this lab you will: know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine Introduction Branches and jumps provide ways to change

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

26 Integers: Multiplication, Division, and Order

26 Integers: Multiplication, Division, and Order 26 Integers: Multiplication, Division, and Order Integer multiplication and division are extensions of whole number multiplication and division. In multiplying and dividing integers, the one new issue

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

Compiler Construction

Compiler Construction Compiler Construction Lecture 1 - An Overview 2003 Robert M. Siegfried All rights reserved A few basic definitions Translate - v, a.to turn into one s own language or another. b. to transform or turn from

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

Python Programming: An Introduction to Computer Science

Python Programming: An Introduction to Computer Science Python Programming: An Introduction to Computer Science Chapter 1 Computers and Programs 1 Objectives To understand the respective roles of hardware and software in a computing system. To learn what computer

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

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0 VISUAL GUIDE to RX Scripting for Roulette Xtreme - System Designer 2.0 UX Software - 2009 TABLE OF CONTENTS INTRODUCTION... ii What is this book about?... iii How to use this book... iii Time to start...

More information

Java CPD (I) Frans Coenen Department of Computer Science

Java 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 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

Math Workshop October 2010 Fractions and Repeating Decimals

Math Workshop October 2010 Fractions and Repeating Decimals Math Workshop October 2010 Fractions and Repeating Decimals This evening we will investigate the patterns that arise when converting fractions to decimals. As an example of what we will be looking at,

More information