Beginning Programming (Pascal) Lecture 75. Figure 1. type-declarations. simple-type. pointer-type. array-type. file-type. set-type.

Size: px
Start display at page:

Download "Beginning Programming (Pascal) Lecture 75. Figure 1. type-declarations. simple-type. pointer-type. array-type. file-type. set-type."

Transcription

1 -declarations -identifier = ; ; Figure 1. -declarations simple- pointer- array- file- set- record- Figure 2. simple- standard- subrange- enumerated- Figure 3. simple- standard- boolean char integer real Figure 4. standard- 1

2 enumerated- ( ) enumerataion-constant-identifier Figure 5. enumerated- Definition: An enumerated- defines the values of the as an ordered set of constant identifiers. Each identifier in the set is a name for a whole number. For example: color_t=(red,white,blue);, Type identifier color_t is the name of the. Enumeration constants, red, white, and blue are the values that a variable of color_t can take on. Enumeration constants red, white, and blue have ordinal values of zero, one and two respectively. 1 program p01; 7 begin{p01} 8 season:=autumn; 9 writeln('season=',ord(season)) 10 end{p01}. Figure 6. Program p01 Figure 7. Output for program p01 Program p01 notes: 1. Variable season can take on any one of the set of values defined by season_t. 2. On line 8, the enumeration constant autumn is assigned to variable season. 3. On line 9, the ordinal value of variable season is displayed. Standard procedure writeln cannot format variable season since season_t is a user-defined. 2

3 1 program p02; 7 begin{p02} 8 for season:=spring to winter do 9 writeln('season=',ord(season)) 10 end{p02}. Figure 8. Program p02 season=0 season=1 season=3 Figure 9. Output for program p02 Program p02 notes: 1. Type season_t defines a sequence. The sequence is spring, summer, autumn, and winter. The sequence makes sense to us for we recognize the order of the seasons. The sequence makes sense to Pascal in that the order we recognize is preserved in the ordinal values of the. 1 program p03; 7 begin{p03} 8 season:=spring; 9 while season <= autumn do 10 begin 11 writeln('season=',ord(season)); 12 season:=succ(season) 13 end{while} 14 end{p03}. Figure 10. Program p03 season=0 season=1 Figure 11. Output for program p03 3

4 Program p03 notes: 1. Program p03 illustrates the use of standard function succ. Standard function succ is used to increment the loop-variable season. 2. The while-statement in program p03 approximates the for-statement in program p The terminal value, winter, used in the for-statement cannot be used in the while-statement. In order for the while-statement to terminate, the expression in the while-statement must evaluate to false. The expression cannot be false until the ordinal value of season is equal five (5). Type season_t has no value whose ordinal value is equal to five (5). 1 program p04; 7 a:integer; 8 function seasonsucc(s:season_t):season_t; 9 begin{seasonsucc} 10 if s=winter then 11 seasonsucc:=spring 12 else 13 seasonsucc:=succ(s) 14 end{seasonsucc}; 15 begin{p04} 16 season:=spring; 17 writeln('a':4,' season'); 18 for a:=1 to 8 do 19 begin 20 writeln(a:4,ord(season):7); 21 season:=seasonsucc(season) 22 end{for} 23 end{p04}. Figure 12. Program p04 a season Figure 13. Output for program p04 Program p04 notes: 1. Program p04 illustrates the concept of successor amplified for repeating sequences. Spring follows winter but the ordinal value zero (0) does not logically follow three (3). Function seasonsucc makes spring follow winter. 4

5 1 program p05; 7 a:integer; 8 function seasonsucc(s:season_t):season_t; 9 begin{seasonsucc} 10 if s=winter then 11 seasonsucc:=spring 12 else 13 seasonsucc:=succ(s) 14 end{seasonsucc}; 15 procedure seasonwrite(s:season_t; var f:text); 16 begin{seasonwrite} 17 case s of 18 spring: write(f,'spring'); 19 summer: write(f,'summer'); 20 autumn: write(f,'autumn'); 21 winter: write(f,'winter') 22 end{case s} 23 end{seasonwrite}; 24 begin{p05} 25 season:=spring; 26 writeln('a':4,' season'); 27 for a:=1 to 8 do 28 begin 29 write(a:4); 30 write(' '); 31 seasonwrite(season,output); 32 writeln; 33 season:=seasonsucc(season) 34 end{for} 35 end{p05}. Figure 14. Program p05 a season 1 spring 2 summer 3 autumn 4 winter 5 spring 6 summer 7 autumn 8 winter Figure 16. Output for program p05 Program p05 notes: 1. Program p05 shows how to print the enumeration-constant-identifier. Function seasonwrite uses a case-statement to write the appropriate identifier. 2. Enumeration s and case-statements are often used in conjunction. 5

CompSci 125 Lecture 11

CompSci 125 Lecture 11 CompSci 125 Lecture 11 switch case The? conditional operator do while for Announcements hw5 Due 10/4 p2 Due 10/5 switch case! The switch case Statement Consider a simple four-function calculator 16 buttons:

More information

520 Principles of Programming Languages. Arithmetic. Variable Declarations. 19: Pascal

520 Principles of Programming Languages. Arithmetic. Variable Declarations. 19: Pascal Structure of a Pascal Program 520 Principles of Programming Languages 19: Pascal Christian Collberg collberg@cs.arizona.edu Department of Computer Science University of Arizona PROGRAM Name (list of files);

More information

Annex A (Informative) Collected syntax The nonterminal symbols pointer-type, program, signed-number, simple-type, special-symbol, and structured-type

Annex A (Informative) Collected syntax The nonterminal symbols pointer-type, program, signed-number, simple-type, special-symbol, and structured-type Pascal ISO 7185:1990 This online copy of the unextended Pascal standard is provided only as an aid to standardization. In the case of dierences between this online version and the printed version, the

More information

Translator Design Lecture 22 CMSC 4173 factor Semantics (rules 63-70)

Translator Design Lecture 22 CMSC 4173 factor Semantics (rules 63-70) 64 factor id [ expression ] 65 factor id ( expression_list ) 66 factor ( expression ) 67 factor not factor 68 factor intlit 69 factor realit 70 factor chrlit 1. Find the symbol descriptor Sym* S in the

More information

Arrays CSCE 110. From James Tam s material J. Michael Moore

Arrays CSCE 110. From James Tam s material J. Michael Moore Arrays CSCE 110 From James Tam s material Typical (although simplified) Problem Write a program that will track student grades in a class. The grades are saved as percentages. The program should allow

More information

Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level. Published

Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level. Published Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level COMPUTER SCIENCE 9608/21 Paper 2 Written Paper MARK SCHEME Maximum Mark: 75 Published This mark

More information

Today s Topics. Team Project Introduce this year s team project. S/SL S/SL, the Syntax/Semantic Language. CISC 458 Winter J.R.

Today s Topics. Team Project Introduce this year s team project. S/SL S/SL, the Syntax/Semantic Language. CISC 458 Winter J.R. Today s Topics Team Project Introduce this year s team project S/SL S/SL, the Syntax/Semantic Language Team Project CISC / CMPE 458 - Project 2019 Implement a compiler for a new language called Mini-Turing

More information

Informatics 1 Functional Programming Lecture 9. Algebraic Data Types. Don Sannella University of Edinburgh

Informatics 1 Functional Programming Lecture 9. Algebraic Data Types. Don Sannella University of Edinburgh Informatics 1 Functional Programming Lecture 9 Algebraic Data Types Don Sannella University of Edinburgh Part I Algebraic types Everything is an algebraic type data Bool = False True data Season = Winter

More information

Topic 5: Enumerated Types and Switch Statements

Topic 5: Enumerated Types and Switch Statements Topic 5: Enumerated Types and Switch Statements Reading: JBD Sections 6.1, 6.2, 3.9 1 What's wrong with this code? if (pressure > 85.0) excesspressure = pressure - 85.0; else safetymargin = 85.0 - pressure;!

More information

ECE 122. Engineering Problem Solving with Java

ECE 122. Engineering Problem Solving with Java ECE 122 Engineering Problem Solving with Java Lecture 5 Anatomy of a Class Outline Problem: How do I build and use a class? Need to understand constructors A few more tools to add to our toolbox Formatting

More information

History. used in early Mac development notable systems in Pascal Skype TeX embedded systems

History. used in early Mac development notable systems in Pascal Skype TeX embedded systems Overview The Pascal Programming Language (with material from tutorialspoint.com) Background & History Features Hello, world! General Syntax Variables/Data Types Operators Conditional Statements Functions

More information

MARK SCHEME for the October/November 2015 series 9691 COMPUTING. 9691/23 Paper 2 (Written Paper), maximum raw mark 75

MARK SCHEME for the October/November 2015 series 9691 COMPUTING. 9691/23 Paper 2 (Written Paper), maximum raw mark 75 CAMBRIDGE INTERNATIONAL EXAMINATIONS Cambridge International Advanced Subsidiary and Advanced Level MARK SCHEME for the October/November 2015 series 9691 COMPUTING 9691/23 Paper 2 (Written Paper), maximum

More information

9691 COMPUTING. 9691/23 Paper 2 (Written Paper), maximum raw mark 75

9691 COMPUTING. 9691/23 Paper 2 (Written Paper), maximum raw mark 75 CAMBRIDGE INTERNATIONAL EXAMINATIONS Cambridge International Advanced Subsidiary and Advanced Level MARK SCHEME for the May/June 2015 series 9691 COMPUTING 9691/23 Paper 2 (Written Paper), maximum raw

More information

9691 COMPUTING. 9691/22 Paper 2 (Written Paper), maximum raw mark 75

9691 COMPUTING. 9691/22 Paper 2 (Written Paper), maximum raw mark 75 CAMBRIDGE INTERNATIONAL EXAMINATIONS Cambridge International Advanced Subsidiary and Advanced Level MARK SCHEME for the May/June 2015 series 9691 COMPUTING 9691/22 Paper 2 (Written Paper), maximum raw

More information

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level. Published

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level. Published Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level COMPUTER SCIENCE 968/2 Paper 2 Written Paper October/November 26 MARK SCHEME Maximum Mark: 75 Published

More information

Module Contact: Dr Gavin Cawley, CMP Copyright of the University of East Anglia Version 1

Module Contact: Dr Gavin Cawley, CMP Copyright of the University of East Anglia Version 1 UNIVERSITY OF EAST ANGLIA School of Computing Sciences Main Series UG Examination 2017-18 PROGRAMMING 1 CMP-4008Y Time allowed: 2 hours Answer FOUR questions. All questions carry equal weight. Notes are

More information

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level. Published

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level. Published Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level COMPUTER SCIENCE 9608/23 Paper 2 MARK SCHEME Maximum Mark: 75 Published This mark scheme is published

More information

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level. Published

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level. Published Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level COMPUTER SCIENCE 9608/43 Paper 4 Written Paper MARK SCHEME Maximum Mark: 75 Published This mark scheme

More information

Definition: Data Type A data type is a collection of values and the definition of one or more operations on those values.

Definition: Data Type A data type is a collection of values and the definition of one or more operations on those values. Data Types 1 Definition: Data Type A data type is a collection of values and the definition of one or more operations on those values. Base Data Types All the values of the type are ordered and atomic.

More information

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University G22.2110-001 Programming Languages Spring 2010 Lecture 6 Robert Grimm, New York University 1 Review Last week Function Languages Lambda Calculus SCHEME review 2 Outline Promises, promises, promises Types,

More information

Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level. Published

Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level. Published Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level COMPUTER SCIENCE 9608/23 Paper 2 Written Paper MARK SCHEME Maximum Mark: 75 Published This mark

More information

MARK SCHEME for the May/June 2011 question paper for the guidance of teachers 9691 COMPUTING. 9691/23 Paper 2 (Written Paper), maximum raw mark 75

MARK SCHEME for the May/June 2011 question paper for the guidance of teachers 9691 COMPUTING. 9691/23 Paper 2 (Written Paper), maximum raw mark 75 UNIVERSITY OF CAMBRIDGE INTERNATIONAL EXAMINATIONS GCE Advanced Subsidiary Level and GCE Advanced Level MARK SCHEME for the May/June 2011 question paper for the guidance of teachers 9691 COMPUTING 9691/23

More information

CSc 453. Semantic Analysis III. Basic Types... Basic Types. Structured Types: Arrays. Compilers and Systems Software. Christian Collberg

CSc 453. Semantic Analysis III. Basic Types... Basic Types. Structured Types: Arrays. Compilers and Systems Software. Christian Collberg Slide 11 2 Basic s... Enumeration types TYPE E1 = (white,blue,yellow,green,red); TYPE E2 = (apple=4,pear=9,kumquat=99); Pascal, Ada, Modula-2, C have some variant of enumeration types. Subrange types TYPE

More information

TABLE OF CONTENTS LIST OF ILLUSTRATIONS

TABLE OF CONTENTS LIST OF ILLUSTRATIONS CG39-28 CONTENTS TABLE OF CONTENTS SECTION AND TITLE PAGE 1.0 INTRODUCTION... 1-1 1.1 DESCRIPTION... 1-1 1.2 RELATED LITERATURE... 1-2 2.0 EXPRESSIONS... 2-1 3.0 STATEMENTS... 3-1 3.1 DECLARATION STATEMENTS...

More information

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level. Published

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level. Published Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level COMPUTER SCIENCE 9608/42 Paper 4 Written Paper MARK SCHEME Maximum Mark: 75 Published This mark scheme

More information

Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level. Published

Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level. Published Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level COMPUTER SCIENCE 9608/22 Paper 2 Written Paper MARK SCHEME Maximum Mark: 75 Published This mark

More information

MARK SCHEME for the October/November 2013 series 9691 COMPUTING. 9691/21 Paper 2 (Written Paper), maximum raw mark 75

MARK SCHEME for the October/November 2013 series 9691 COMPUTING. 9691/21 Paper 2 (Written Paper), maximum raw mark 75 CAMBRIDGE INTERNATIONAL EXAMINATIONS GCE Advanced Subsidiary Level and GCE Advanced Level MARK SCHEME for the October/November 2013 series 9691 COMPUTING 9691/21 Paper 2 (Written Paper), maximum raw mark

More information

Why C++ is much more fun than C (C++ FAQ)?

Why C++ is much more fun than C (C++ FAQ)? From C to C++ Why C++ is much more fun than C (C++ FAQ)? 1. Classes & methods - OO design 2. Generic programming - Templates allow for code reuse 3. Stricter type system (e.g. function args) 4. Some run-time

More information

UNIVERSITY OF CALIFORNIA, RIVERSIDE

UNIVERSITY OF CALIFORNIA, RIVERSIDE Final Page 1 of 7 UNIVERSITY OF CALIFORNIA, RIVERSIDE Computer Science Department CS61 Machine Organization & Assembly Language Final September 1, 2000 53 Name: Solution Key Student ID#: Please print legibly

More information

Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level. Published

Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level. Published Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level COMPUTER SCIENCE 9608/21 Paper 1 Written Paper MARK SCHEME Maximum Mark: 75 Published This mark

More information

Translator Design CRN Test 3 Revision 1 CMSC 4173 Spring 2012

Translator Design CRN Test 3 Revision 1 CMSC 4173 Spring 2012 Name: Student ID: E-Mail: Course CMSC 4173, Translator Design CRN: 24414, Spring, 2012 Date: Thursday, May 3, 2012 at 5:30 p.m. Instructions: 1. Type your name in the space provided. 2. Type your student

More information

PASCAL. PASCAL, like BASIC, is a computer language. However, PASCAL, unlike BASIC, is a Blocked Structured Language (BASIC is known as unstructured).

PASCAL. PASCAL, like BASIC, is a computer language. However, PASCAL, unlike BASIC, is a Blocked Structured Language (BASIC is known as unstructured). PASCAL 11 OVERVIEW OF PASCAL LANGUAGE PASCAL, like BASIC, is a computer language However, PASCAL, unlike BASIC, is a Blocked Structured Language (BASIC is known as unstructured) Let look at a simple {BLOCK

More information

TABLE OF CONTENTS 2 CHAPTER 1 3 CHAPTER 2 4 CHAPTER 3. Algorithm Design & Problem Solving. Programming. Databases

TABLE OF CONTENTS 2 CHAPTER 1 3 CHAPTER 2 4 CHAPTER 3. Algorithm Design & Problem Solving. Programming. Databases 2 CHAPTER 1 Algorithm Design & Problem Solving 3 CHAPTER 2 Programming 4 CHAPTER 3 Databases TABLE OF CONTENTS 1. ALGORITHM DESIGN & PROBLEM-SOLVING 1.1 Problem-solving & Design Every computer system is

More information

MARK SCHEME for the October/November 2015 series 9691 COMPUTING. 9691/22 Paper 2 (Written Paper), maximum raw mark 75

MARK SCHEME for the October/November 2015 series 9691 COMPUTING. 9691/22 Paper 2 (Written Paper), maximum raw mark 75 CAMBRIDGE INTERNATIONAL EXAMINATIONS Cambridge International Advanced Subsidiary and Advanced Level MARK SCHEME for the October/November 2015 series 9691 COMPUTING 9691/22 Paper 2 (Written Paper), maximum

More information

Introduction. Primitive Data Types: Integer. Primitive Data Types. ICOM 4036 Programming Languages

Introduction. Primitive Data Types: Integer. Primitive Data Types. ICOM 4036 Programming Languages ICOM 4036 Programming Languages Primitive Data Types Character String Types User-Defined Ordinal Types Array Types Associative Arrays Record Types Union Types Pointer and Reference Types Data Types This

More information

TYPES, VALUES AND DECLARATIONS

TYPES, VALUES AND DECLARATIONS COSC 2P90 TYPES, VALUES AND DECLARATIONS (c) S. Thompson, M. Winters 1 Names, References, Values & Types data items have a value and a type type determines set of operations variables Have an identifier

More information

Programming Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science Indian Institute of Technology, Madras

Programming Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science Indian Institute of Technology, Madras Programming Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science Indian Institute of Technology, Madras Module 12B Lecture - 41 Brief introduction to C++ Hello, welcome

More information

Beginning Programming (Pascal)

Beginning Programming (Pascal) Assignment: Program Files: Display and Keyboard Input: Program p06 sorts a list of integers. File i06.dat in the class directory ~trt/cs1513/i06.dat has a list of integers that can be used to test your

More information

Lexical Considerations

Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler

More information

Java Flow of Control

Java Flow of Control Java Flow of Control SEEM 3460 1 Flow of Control Unless specified otherwise, the order of statement execution through a method is linear: one statement after another in sequence Some programming statements

More information

Pascal Validation Suite Report

Pascal Validation Suite Report Pascal Validation Suite Report Pascal processor identification The ACK-Pascal compiler produces code for an EM machine as defined in [1]. It is up to the implementor of the EM machine whether errors like

More information

Personal SE. Arrays Pointers Strings

Personal SE. Arrays Pointers Strings Personal SE Arrays Pointers Strings Array Identifiers & Pointers char message[] = Hello ; message H e l l o \0 Array Identifiers & Pointers char message[] = Hello ; message H e l l o \0 Question: So what

More information

Professor Peter Cheung EEE, Imperial College

Professor Peter Cheung EEE, Imperial College 1/1 1/2 Professor Peter Cheung EEE, Imperial College In this lecture, we take an overview of the course, and briefly review the programming language. The rough guide is not very complete. You should use

More information

Chapter 1b Classes and Objects

Chapter 1b Classes and Objects Data Structures for Java William H. Ford William R. Topp Chapter 1b Classes and Objects Bret Ford 2005, Prentice Hall Object-Oriented Programming An object is an entity with data and operations on the

More information

9608 COMPUTER SCIENCE

9608 COMPUTER SCIENCE CAMBRIDGE INTERNATIONAL EXAMINATIONS Cambridge International Advanced Subsidiary and Advanced Level MARK SCHEME for the May/June 2015 series 9608 COMPUTER SCIENCE 9608/22 Paper 2 (Written Paper), maximum

More information

A Deep Dive Into Kotlin

A Deep Dive Into Kotlin A Deep Dive Into Kotlin By 1 About me (droidyue.com) @Flipboard China GDG 2 3 Kotlin An official language for Android recently Powered by Jetbrains 4 Why Kotlin Concise Safe interoperable tool-friendly

More information

COMPUTER SCIENCES II Spring Term 2017 Asst.Prof.Elgin KILIÇ

COMPUTER SCIENCES II Spring Term 2017 Asst.Prof.Elgin KILIÇ COMPUTER SCIENCES II Spring Term 2017 Asst.Prof.Elgin KILIÇ TURBO PASCAL WEEK 2 DECLARATION BLOCKS in DETAIL Uses There default sub pascal programs called UNITS which are already embedded in pascal editor.

More information

Software Verification for Java 5

Software Verification for Java 5 Software Verification for Java 5 KeY Symposium 2007 Mattias Ulbrich June 14, 2007 Content KeY + Java 5 Typesafe Enumeration Datatypes Enhanced For Loops Generic Classes 1. Keep pace with the progress of

More information

GCSE Computer Science Pseudocode structure

GCSE Computer Science Pseudocode structure GCSE Computer Science Pseudocode structure The pseudocode described below is a teaching aid for schools/colleges to assist in preparing their students for Unit 2 (examined component) of AQA s GCSE Computer

More information

Type Checking. Outline. General properties of type systems. Types in programming languages. Notation for type rules.

Type Checking. Outline. General properties of type systems. Types in programming languages. Notation for type rules. Outline Type Checking General properties of type systems Types in programming languages Notation for type rules Logical rules of inference Common type rules 2 Static Checking Refers to the compile-time

More information

Francesco Nidito. Programmazione Avanzata AA 2007/08

Francesco Nidito. Programmazione Avanzata AA 2007/08 Francesco Nidito in the Programmazione Avanzata AA 2007/08 Outline 1 2 3 in the in the 4 Reference: Micheal L. Scott, Programming Languages Pragmatics, Chapter 7 What is a type? in the What is a type?

More information

Introduction to Computing Lecture 05: Selection (continued)

Introduction to Computing Lecture 05: Selection (continued) Introduction to Computing Lecture 05: Selection (continued) Assist.Prof.Dr. Nükhet ÖZBEK Ege University Department of Electrical & Electronics Engineering nukhet.ozbek@ege.edu.tr Topics Type int as Boolean

More information

Outline. General properties of type systems. Types in programming languages. Notation for type rules. Common type rules. Logical rules of inference

Outline. General properties of type systems. Types in programming languages. Notation for type rules. Common type rules. Logical rules of inference Type Checking Outline General properties of type systems Types in programming languages Notation for type rules Logical rules of inference Common type rules 2 Static Checking Refers to the compile-time

More information

CSCI 2010 Principles of Computer Science. Basic Java Programming. 08/09/2013 CSCI Basic Java 1

CSCI 2010 Principles of Computer Science. Basic Java Programming. 08/09/2013 CSCI Basic Java 1 CSCI 2010 Principles of Computer Science Basic Java Programming 1 Today s Topics Using Classes and Objects object creation and object references the String class and its methods the Java standard class

More information

Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level. Published

Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level. Published Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level COMPUTER SCIENCE 9608/22 Paper 2 Written Paper MARK SCHEME Maximum Mark: 75 Published This mark

More information

Computer (Literacy) Skills. Variables, records, and pointers. Lubomír Bulej KDSS MFF UK

Computer (Literacy) Skills. Variables, records, and pointers. Lubomír Bulej KDSS MFF UK Computer (Literacy) Skills Variables, records, and pointers Lubomír Bulej KDSS MFF UK Variable = named storage location Values stored as sequences of bytes Type determines storage size and layout Also

More information

CS1004: Intro to CS in Java, Spring 2005

CS1004: Intro to CS in Java, Spring 2005 CS1004: Intro to CS in Java, Spring 2005 Lecture #13: Java OO cont d. Janak J Parekh janak@cs.columbia.edu Administrivia Homework due next week Problem #2 revisited Constructors, revisited Remember: a

More information

The University of Alabama in Huntsville Electrical and Computer Engineering CPE Example of Objective Test Questions for Test 4

The University of Alabama in Huntsville Electrical and Computer Engineering CPE Example of Objective Test Questions for Test 4 The University of Alabama in Huntsville Electrical and Computer Engineering CPE 112 02 Example of Objective Test Questions for Test 4 True or False Name: 1. The statement switch (n) case 8 : alpha++; case

More information

Informatics 1 Functional Programming Lectures 13 and 14 Monday 11 and Tuesday 12 November Type Classes. Don Sannella University of Edinburgh

Informatics 1 Functional Programming Lectures 13 and 14 Monday 11 and Tuesday 12 November Type Classes. Don Sannella University of Edinburgh Informatics 1 Functional Programming Lectures 13 and 14 Monday 11 and Tuesday 12 November 2013 Type Classes Don Sannella University of Edinburgh Mock exam Slots and rooms have now been assigned Mon 18

More information

9608 COMPUTER SCIENCE

9608 COMPUTER SCIENCE CAMBRIDGE INTERNATIONAL EXAMINATIONS Cambridge International Advanced Level MARK SCHEME for the May/June 2015 series 9608 COMPUTER SCIENCE 9608/42 Paper 4 (Written Paper), maximum raw mark 75 This mark

More information

Data Types. 9. Types. a collection of values and the definition of one or more operations that can be performed on those values

Data Types. 9. Types. a collection of values and the definition of one or more operations that can be performed on those values Data Types 1 data type: a collection of values and the definition of one or more operations that can be performed on those values C++ includes a variety of built-in or base data types: short, int, long,

More information

APPENDIX TRANSLATING BETWEEN C, FORTRAN, AND PASCAL LANGUAGES

APPENDIX TRANSLATING BETWEEN C, FORTRAN, AND PASCAL LANGUAGES APPENDIX TRANSLATING BETWEEN C, FORTRAN, AND PASCAL LANGUAGES Here, in tabular and example form, is an outline of the main differences between C, Fortran, and Pascal. It is intended to help you overcome

More information

9608 COMPUTER SCIENCE

9608 COMPUTER SCIENCE CAMBRIDGE INTERNATIONAL EXAMINATIONS Cambridge International Advanced Subsidiary and Advanced Level MARK SCHEME for the October/November 2015 series 9608 COMPUTER SCIENCE 9608/21 Paper 2 (Written Paper),

More information

Selected Java Topics

Selected Java Topics Selected Java Topics Introduction Basic Types, Objects and Pointers Modifiers Abstract Classes and Interfaces Exceptions and Runtime Exceptions Static Variables and Static Methods Type Safe Constants Swings

More information

AS COMPUTER SCIENCE 7516/1. Paper 1. Time allowed: 1 hour 45 minutes

AS COMPUTER SCIENCE 7516/1. Paper 1. Time allowed: 1 hour 45 minutes A AS COMPUTER SCIENCE Paper 1 7516/1 Monday 5 June 2017 Morning Time allowed: 1 hour 45 minutes For this paper you must have access to: a computer a printer appropriate software the Electronic Answer Document

More information

Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level

Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level COMPUTER SCIENCE 9608/21 Paper 2 Written Paper MARK SCHEME Maximum Mark: 75 Published This mark

More information

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level COMPUTER SCIENCE 9608/21 Paper 2 Fundamental Problem-solving and Programming Skills October/November

More information

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level *2720504716* COMPUTER SCIENCE 9608/22 Paper 2 Fundamental Problem-solving and Programming Skills October/November

More information

Section 5: Pascal. Evolution of Software Languages

Section 5: Pascal. Evolution of Software Languages Section 5: Pascal Evolution of Software Languages Theo D'Hondt Bachelor of Computer Science Faculty of Sciences and Bio-Engineering Sciences Vrije Universiteit Brussel Academic Year 2015-2016 Evolution

More information

Pseudocode (programmer defined identifiers preserve the Spanish words of the original cheat sheet) (date: )

Pseudocode (programmer defined identifiers preserve the Spanish words of the original cheat sheet) (date: ) Pseudocode (programmer defined identifiers preserve the Spanish words of the original cheat sheet) (date: 2013-10-30) 1. Predefined data types boolean character natural {we include 0 in Natural numbers;

More information

Contract-based Programming: a Route to Finding Bugs Earlier

Contract-based Programming: a Route to Finding Bugs Earlier Contract-based Programming: a Route to Finding Bugs Earlier JSA Research & Innovation February 2018 Subprogram Contracts Type Contracts Contract-based Programming A software development technique, used

More information

Industrial Automation course

Industrial Automation course Industrial Automation course Lesson 7 PLC Structured Text Politecnico di Milano Universidad de Monterrey, July 2015, A. L. Cologni 1 Introduction The Structured Text is the higher level IEC 61131 programming

More information

CSc 520 Principles of Programming Languages

CSc 520 Principles of Programming Languages CSc 520 Principles of Programming Languages 31: Procedures Parameters Christian Collberg collberg@cs.arizona.edu Department of Computer Science University of Arizona Copyright c 2005 Christian Collberg

More information

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level. Published

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level. Published Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level COMPUTING 9691/23 Paper 2 Written Paper May/June 2016 MARK SCHEME Maximum Mark: 75 Published This mark

More information

Pointers. In this section of notes you will learn about another type of variable that stores addresses rather than data. Memory: What You Know

Pointers. In this section of notes you will learn about another type of variable that stores addresses rather than data. Memory: What You Know Pointers In this section of notes you will learn about another of variable that stores addresses rather than data Memory: What You Know Memory is analogous to a series of slots each of which can store

More information

University of Arizona, Department of Computer Science. CSc 453 Assignment 5 Due 23:59, Dec points. Christian Collberg November 19, 2002

University of Arizona, Department of Computer Science. CSc 453 Assignment 5 Due 23:59, Dec points. Christian Collberg November 19, 2002 University of Arizona, Department of Computer Science CSc 453 Assignment 5 Due 23:59, Dec 4 100 points Christian Collberg November 19, 2002 1 Introduction Your task is to write a code generator for the

More information

Algebraic Types. Chapter 14 of Thompson

Algebraic Types. Chapter 14 of Thompson Algebraic Types Chapter 14 of Thompson Types so far Base types Int, Integer, Float, Bool, Char Composite types: tuples (t 1,t 2,,t n ) lists [t 1 ] functions (t 1 -> t 2 ) Algebraic types enumerated, product

More information

Programming Languages

Programming Languages Programming Languages Types CSCI-GA.2110-001 Summer 2011 What is a type? A type consists of a set of values The compiler/interpreter defines a mapping of these values onto the underlying hardware. 2 /

More information

Java Application Development

Java Application Development In order to learn which questions have been answered correctly: 1. Print these pages. 2. Answer the questions. 3. Send this assessment with the answers via: a. FAX to (212) 967-3498. Or b. Mail the answers

More information

9691 COMPUTING. 9691/21 Paper 2 (Written Paper), maximum raw mark 75

9691 COMPUTING. 9691/21 Paper 2 (Written Paper), maximum raw mark 75 CAMBRIDGE INTERNATIONAL EXAMINATIONS GCE Advanced Subsidiary Level and GCE Advanced Level MARK SCHEME for the May/June 2013 series 9691 COMPUTING 9691/21 Paper 2 (Written Paper), maximum raw mark 75 This

More information

OCA Java SE 7 Programmer I Certification Guide By Mela Gupta. Arrays

OCA Java SE 7 Programmer I Certification Guide By Mela Gupta. Arrays 1 OCA Java SE 7 Programmer I Certification Guide By Mela Gupta In the OCA Java SE 7 programmer exam, you ll be asked many questions on how to create, modify, and delete String, StringBuilder, arrays, and

More information

Records CSCE 110. From James Tam's material J. Michael Moore

Records CSCE 110. From James Tam's material J. Michael Moore Records CSCE 110 Example, storing information about a client: First name Last name Phone number Address Postal code Email address Tracking Information array or String array or String integer, array or

More information

TABLE OF CONTENTS 2 CHAPTER 1 3 CHAPTER 2 4 CHAPTER 3 5 CHAPTER 4. Algorithm Design & Problem Solving. Data Representation.

TABLE OF CONTENTS 2 CHAPTER 1 3 CHAPTER 2 4 CHAPTER 3 5 CHAPTER 4. Algorithm Design & Problem Solving. Data Representation. 2 CHAPTER 1 Algorithm Design & Problem Solving 3 CHAPTER 2 Data Representation 4 CHAPTER 3 Programming 5 CHAPTER 4 Software Development TABLE OF CONTENTS 1. ALGORITHM DESIGN & PROBLEM-SOLVING Algorithm:

More information

STRING Represents group of characters Each character 1 byte CIE, AB304 BOOLEAN Logical Datatype, return true or False Memory Required 1

STRING Represents group of characters Each character 1 byte CIE, AB304 BOOLEAN Logical Datatype, return true or False Memory Required 1 2.2 Data representation 2.2.1 Data types A data type is a method of interpreting a pattern of bits. There are numerous different data types but here explained ones are according to CIE syllabus: Integer

More information

Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB. Lab # 8. Conditional Processing

Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB. Lab # 8. Conditional Processing Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB Lab # 8 Conditional Processing April, 2014 1 Assembly Language LAB Unconditional Jump The

More information

Programming Languages Test 2 Revision 1 CMSC 4023 CRN Spring 2007

Programming Languages Test 2 Revision 1 CMSC 4023 CRN Spring 2007 1. Pr your name on your scantron in the space labeled NAME. 2. Pr CS 4023 in the space labeled SUBJECT. 3. Pr 4-2-2007, the date in the space labeled DATE. 4. Pr your 24290, your CRN-number in the space

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

Lecture 19: Functions, Types and Data Structures in Haskell

Lecture 19: Functions, Types and Data Structures in Haskell The University of North Carolina at Chapel Hill Spring 2002 Lecture 19: Functions, Types and Data Structures in Haskell Feb 25 1 Functions Functions are the most important kind of value in functional programming

More information

Digital Media. Seasons Assignment. 1. Copy and open the file seasonsbegin.fla from the Read folder.

Digital Media. Seasons Assignment. 1. Copy and open the file seasonsbegin.fla from the Read folder. Digital Media Seasons Assignment 1. Copy and open the file seasonsbegin.fla from the Read folder. 2. Make a new layer for buttons. Create a button that the user will click to start the interaction. (Be

More information

CS211 Spring 2005 Prelim 1 March 10, Solutions. Instructions

CS211 Spring 2005 Prelim 1 March 10, Solutions. Instructions CS211 Spring 2005 Prelim 1 March 10, 2005 Solutions Instructions Write your name and Cornell netid above. There are 6 questions on 9 numbered pages. Check now that you have all the pages. Write your answers

More information

Programming Logic & Pseudocode. Python Bootcamp, Day 1 Anna Rosen

Programming Logic & Pseudocode. Python Bootcamp, Day 1 Anna Rosen Programming Logic & Pseudocode Python Bootcamp, Day 1 Anna Rosen Programming 101 Computer programming involves having the user formulate commands that the computer can run for a specific purpose. The computer

More information

Programovací jazyky F# a OCaml. Chapter 3. Composing primitive types into data

Programovací jazyky F# a OCaml. Chapter 3. Composing primitive types into data Programovací jazyky F# a OCaml Chapter 3. Composing primitive types into data Data types» We can think of data type as a set: int = -2, -1, 0, 1, 2, More complicated with other types, but possible» Functions

More information

A Practical Approach to Programming With Assertions

A Practical Approach to Programming With Assertions A Practical Approach to Programming With Assertions Ken Bell Christian-Albrechts Universität Kiel Department of Computer Science and Applied Mathematics Real-Time Systems and Embedded Systems Group July

More information

(A) 99 ** (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution

(A) 99 ** (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution Ch 5 Arrays Multiple Choice Test 01. An array is a ** (A) data structure with one, or more, elements of the same type. (B) data structure with LIFO access. (C) data structure, which allows transfer between

More information

A First Book of ANSI C Fourth Edition. Chapter 9 Character Strings

A First Book of ANSI C Fourth Edition. Chapter 9 Character Strings A First Book of ANSI C Fourth Edition Chapter 9 Character Strings Objectives String Fundamentals Library Functions Input Data Validation Formatting Strings (Optional) Case Study: Character and Word Counting

More information

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level. Published

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level. Published Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level COMPUTER SCIENCE 9608/22 Paper 2 Written Paper October/November 2016 MARK SCHEME Maximum Mark: 75 Published

More information

Ch. 7: Control Structures

Ch. 7: Control Structures Ch. 7: Control Structures I. Introduction A. Flow of control can be at multiple levels: within expressions, among statements (discussed here), and among units. B. Computation in imperative languages uses

More information

5) (4 points) What is the value of the boolean variable equals after the following statement?

5) (4 points) What is the value of the boolean variable equals after the following statement? For problems 1-5, give a short answer to the question. (15 points, ~8 minutes) 1) (4 points) Write four Java statements that declare and initialize the following variables: A) a long integer with the value

More information

Input parameters. Function. An ideal black-box representation of a function

Input parameters. Function. An ideal black-box representation of a function 7 Functions 7. Introduction Functions are identifiable pieces of code with a defined interface. They are called from any part of a program and allow large programs to be split into more manageable tasks,

More information

Midterm CSE 131B Spring 2005

Midterm CSE 131B Spring 2005 Signature Login Name _ Name Student ID Midterm CSE 131B Spring 2005 Page 1 Page 2 Page 3 Page 4 Page 5 (20 points) (18 points) (22 points) (20 points) (20 points) Subtotal Page 6 Extra Credit (100 points)

More information