40 Absolute difference 42 Trying it 43 Trying it 44 Concepts covered in this chapter 0-2

Size: px
Start display at page:

Download "40 Absolute difference 42 Trying it 43 Trying it 44 Concepts covered in this chapter 0-2"

Transcription

1 List of Slides 1 Title 2 Chapter 4: Conditional execution 3 Chapter aims 4 Section 2: Example:Oldest spouse 1 5 Aim 6 Execution: conditional execution 7 Expression: boolean 8 Expression: boolean: relational operators 11 Oldest spouse 1 12 Statement: if else statement 14 Oldest spouse 1 15 Trying it 16 Coursework: MaxTwoDoubles 17 Section 3: Example:Oldest spouse 2 18 Aim 19 Statement: if else statement: nested 0-0

2 21 Oldest spouse 2 22 Oldest spouse 2 23 Trying it 24 Trying it 25 Trying it 26 Trying it 27 Coursework: DegreeCategory 28 Section 4: Example:Film certificate age checking 29 Aim 30 Statement: if statement 31 Film certificate age checking 32 Trying it 33 Trying it 34 Trying it 35 Coursework: PassFailDistinction 36 Section 5: Example:Absolute difference 37 Aim 38 Statement: compound statement 0-1

3 40 Absolute difference 42 Trying it 43 Trying it 44 Concepts covered in this chapter 0-2

4 Title Java Just in Time John Latham October 25, 2017 October 25, 2017 Java Just in Time - John Latham Page 1(0/0)

5 Chapter 4 Conditional execution October 25, 2017 Java Just in Time - John Latham Page 2(0/0)

6 Chapter aims Not every part of a program need be executed every time. Some parts only under certain conditions. We meet if statements and if else statements. October 25, 2017 Java Just in Time - John Latham Page 3(0/0)

7 Section 2 Example: Oldest spouse 1 October 25, 2017 Java Just in Time - John Latham Page 4(0/0)

8 Aim AIM: To introduce the idea of conditional execution, implemented by the if else statement, and controlled by boolean expressions based on the use of relational operators. October 25, 2017 Java Just in Time - John Latham Page 5(0/0)

9 Execution: conditional execution Not sufficient to always obey all instructions every run some problems need conditional execution execute some bits conditionally: depending on values of variables. October 25, 2017 Java Just in Time - John Latham Page 6(0/0)

10 Expression: boolean An expression which evaluates to true or false a condition also called a boolean expression. Used for controlling conditional execution. October 25, 2017 Java Just in Time - John Latham Page 7(0/0)

11 Expression: boolean: relational operators Six relational operators for comparing values to make up conditions show us relations between items in pairs of values binary infix operators... yield true or false. October 25, 2017 Java Just in Time - John Latham Page 8(0/0)

12 Expression: boolean: relational operators Operator Title Description == Equal This is the equal operator, which provides the notion of equality. a == b yields true if and only if the value of a is the same as the value of b.!= Not equal This is the not equal operator, providing the the notion of not equality. a!= b yields true if and only if the value of a is not the same as the value of b. < Less than This is the less than operator. a < b yields true if and only if the value of a is less than the value of b. October 25, 2017 Java Just in Time - John Latham Page 9(0/0)

13 Expression: boolean: relational operators Operator Title Description > Greater than This is the greater than operator. a > b yields true if and only if the value of a is greater than the value of b. <= Less than or equal This is the less than or equal operator. a <= b yields true if and only if the value of a is less than value of b, or is equal to it. >= Greater than or equal This is the greater than or equal operator. a >= b yields true if and only if the value of a is greater than value of b, or is equal to it. October 25, 2017 Java Just in Time - John Latham Page 10(0/0)

14 Oldest spouse 1 Coffee time: Which of the following conditions are true? a) 5 < 4 b) 5 < 5 c) 5 < 6 d) 5 > 4 e) 5 > 5 f) 5 > 6 g) 5 <= 4 h) 5 <= 5 i) 5 <= 6 j) 5 >= 4 k) 5 >= 5 l) 5 >= 6 m) 5 == 4 n) 5 == 5 o) 5 == 6 p) 5!= 4 q) 5!= 5 r) 5!= 6 s) 5 > 4 == 9 < 15 t) 5 < 4!= 9 > 15 Do the last two examples above suggest that == and!= have a different operator precedence from the other relational operators? If so, are they higher or lower? October 25, 2017 Java Just in Time - John Latham Page 11(0/0)

15 Statement: if else statement The if else statement allows conditional execution. Three parts condition / boolean expression true part statement for when condition is true false part statement for when condition is false Syntax: reserved word if condition in brackets true part reserved word else false part October 25, 2017 Java Just in Time - John Latham Page 12(0/0)

16 Statement: if else statement E.g. assuming variable noofpeopletoinvitetothestreetparty if (noofpeopletoinvitetothestreetparty > 100) else System.out.println("We will need a big sound system!"); System.out.println("We should be okay with a normal HiFi."); Get one message or the other depending on noofpeopletoinvitetothestreetparty never both. Notice brackets, semi-colons and indentation. October 25, 2017 Java Just in Time - John Latham Page 13(0/0)

17 Oldest spouse 1 001: public class OldestSpouse 002: { 003: public static void main(string[] args) 004: { 005: int husbandsage = Integer.parseInt(args[0]); 006: int wifesage = Integer.parseInt(args[1]); 007: 008: if (husbandsage > wifesage) 009: System.out.println("The husband is older than the wife"); 010: else 011: System.out.println("The husband is not older than the wife"); 012: } 013: } October 25, 2017 Java Just in Time - John Latham Page 14(0/0)

18 Trying it Console Input / Output $ java OldestSpouse The husband is older than the wife $ java OldestSpouse The husband is older than the wife $ java OldestSpouse The husband is not older than the wife $ java OldestSpouse The husband is not older than the wife $ java OldestSpouse The husband is not older than the wife $ _ Run October 25, 2017 Java Just in Time - John Latham Page 15(0/0)

19 Coursework: MaxTwoDoubles (Summary only) Write a program to find the maximum of two given numbers, using an if else statement. October 25, 2017 Java Just in Time - John Latham Page 16(0/0)

20 Section 3 Example: Oldest spouse 2 October 25, 2017 Java Just in Time - John Latham Page 17(0/0)

21 Aim AIM: To introduce the idea of nesting if else statements. October 25, 2017 Java Just in Time - John Latham Page 18(0/0)

22 Statement: if else statement: nested Can have if else statement nested inside another. i.e. true part and/or false part is another if else statement. E.g. Depending on noofpeopletoinvitetothestreetparty get one of three messages. if (noofpeopletoinvitetothestreetparty > 300) else System.out.println("We will need a Mega master 500 Watt amplifier!"); if (noofpeopletoinvitetothestreetparty > 100) else System.out.println("We will need a Maxi Master 150 Watt amplifier!"); System.out.println("We should be okay with a normal HiFi."); Notice indentation following usual nesting rule, but... October 25, 2017 Java Just in Time - John Latham Page 19(0/0)

23 Statement: if else statement: nested Make exception to usual rule for if else statements nested in false parts: if (noofpeopletoinvitetothestreetparty > 300) System.out.println("We will need a Mega master 500 Watt amplifier!"); else if (noofpeopletoinvitetothestreetparty > 100) else System.out.println("We will need a Maxi Master 150 Watt amplifier!"); System.out.println("We should be okay with a normal HiFi."); Reflects abstraction: is one selection offering one choice from three. Don t have to increase indentation if using many nested if else statements as long as nested in false parts. October 25, 2017 Java Just in Time - John Latham Page 20(0/0)

24 Oldest spouse 2 Coffee time: If we wanted some program code to execute one out of N choices, how many if else statements would we need? October 25, 2017 Java Just in Time - John Latham Page 21(0/0)

25 Oldest spouse 2 001: public class OldestSpouse 002: { 003: public static void main(string[] args) 004: { 005: int husbandsage = Integer.parseInt(args[0]); 006: int wifesage = Integer.parseInt(args[1]); 007: 008: if (husbandsage > wifesage) 009: System.out.println("The husband is older than the wife"); 010: else if (husbandsage == wifesage) 011: System.out.println("The husband is the same age as the wife"); 012: else 013: System.out.println("The husband is younger than the wife"); 014: } 015: } October 25, 2017 Java Just in Time - John Latham Page 22(0/0)

26 Trying it Console Input / Output $ java OldestSpouse The husband is older than the wife $ java OldestSpouse The husband is older than the wife $ java OldestSpouse The husband is the same age as the wife $ java OldestSpouse The husband is younger than the wife $ java OldestSpouse The husband is younger than the wife $ _ Run October 25, 2017 Java Just in Time - John Latham Page 23(0/0)

27 . if. if. System.out.println("The. System.out.println("The. System.out.println("The Trying it Coffee time: What do you think of the following code as an alternative to the if else statements we wrote in our program? Would it work? Is it as easy to read? (husbandsage <= wifesage) (husbandsage!= wifesage) husband is younger than the wife");. else husband is the same age as the wife");. else husband is older than the wife"); October 25, 2017 Java Just in Time - John Latham Page 24(0/0)

28 . if. System.out.println("The. else. System.out.println("The. System.out.println("The Trying it Coffee time: What about the following code instead? What makes it better than the code above? (husbandsage < wifesage) husband is younger than the wife"); if (husbandsage == wifesage) husband is the same age as the wife");. else husband is older than the wife"); October 25, 2017 Java Just in Time - John Latham Page 25(0/0)

29 . if. System.out.println("The. else. System.out.println("The. System.out.println("The Trying it Coffee time: And finally, what about the following code? What makes it less good than the one above? (husbandsage == wifesage) husband is the same age as the wife"); if (husbandsage < wifesage) husband is younger than the wife");. else husband is older than the wife"); October 25, 2017 Java Just in Time - John Latham Page 26(0/0)

30 Coursework: DegreeCategory (Summary only) Write a program to report the degree category of a given mark. October 25, 2017 Java Just in Time - John Latham Page 27(0/0)

31 Section 4 Example: Film certificate age checking October 25, 2017 Java Just in Time - John Latham Page 28(0/0)

32 Aim AIM: To introduce the if statement without a false part. October 25, 2017 Java Just in Time - John Latham Page 29(0/0)

33 Statement: if statement Sometimes want nothing done if condition is false. E.g. could have empty false part: if (noofpeopletoinvitetothestreetparty > 500) System.out.println("You may need an entertainment license!"); else ; An empty statement between else and semi-colon! Instead can use if statement has no else, nor false part. if (noofpeopletoinvitetothestreetparty > 500) System.out.println("You may need an entertainment license!"); October 25, 2017 Java Just in Time - John Latham Page 30(0/0)

34 Film certificate age checking 001: public class FilmAgeCheck 002: { 003: public static void main(string[] args) 004: { 005: int minimumage = Integer.parseInt(args[0]); 006: int ageofperson = Integer.parseInt(args[1]); 007: if (ageofperson < minimumage) 008: System.out.println("The person is too young to watch the film!"); 009: } 010: } October 25, 2017 Java Just in Time - John Latham Page 31(0/0)

35 Trying it Console Input / Output $ java FilmAgeCheck The person is too young to watch the film! $ java FilmAgeCheck The person is too young to watch the film! $ java FilmAgeCheck $ java FilmAgeCheck $ java FilmAgeCheck $ _ Run October 25, 2017 Java Just in Time - John Latham Page 32(0/0)

36 . if. System.out.println("You Trying it Coffee time: Under what condition will the following code print the message? (noofpeopletoinvitetothestreetparty > 500); may need an entertainment license!"); (Hint: count the semi-colons.) October 25, 2017 Java Just in Time - John Latham Page 33(0/0)

37 . if. if. System.out.println("You. System.out.println("It Trying it Coffee time: When do we get the quiet party message with this code? (noofpeopletoinvitetothestreetparty > 100) (noofpeopletoinvitetothestreetparty > 500) may need an entertainment license!");. else will be a fairly quiet party."); (Hint: which if does the else match?) October 25, 2017 Java Just in Time - John Latham Page 34(0/0)

38 Coursework: PassFailDistinction (Summary only) Write a program to report the pass or fail status of an exam candidate, giving a message of distinction if appropriate using an if statement. October 25, 2017 Java Just in Time - John Latham Page 35(0/0)

39 Section 5 Example: Absolute difference October 25, 2017 Java Just in Time - John Latham Page 36(0/0)

40 Aim AIM: To introduce the compound statement. October 25, 2017 Java Just in Time - John Latham Page 37(0/0)

41 Statement: compound statement The compound statement list of statements between { and }. E.g. body of a method? Semantics sequential execution. Most useful with statements containing one other statement but want more than one. E.g. conditionally get three messages: if (noofpeopletoinvitetothestreetparty > 500) { System.out.println("You may need an entertainment license!"); System.out.println("Also hire some street cleaners for the next day?"); System.out.println("You should consider a bulk discount on lemonade!"); } Note: no indent between if statement and compound, only within it. October 25, 2017 Java Just in Time - John Latham Page 38(0/0)

42 Statement: compound statement Less useful, compound can be empty: if (noofpeopletoinvitetothestreetparty > 500) { System.out.println("You may need an entertainment license!"); System.out.println("Also hire some street cleaners for the next day?"); System.out.println("You should consider a bulk discount on lemonade!"); } else {} October 25, 2017 Java Just in Time - John Latham Page 39(0/0)

43 Absolute difference 001: public class AbsoluteDifference 002: { 003: public static void main(string[] args) 004: { 005: double firstnumber = Double.parseDouble(args[0]); 006: double secondnumber = Double.parseDouble(args[1]); 007: 008: double absolutedifference; 009: 010: if (firstnumber > secondnumber) 011: { 012: System.out.println("The first number is larger than the second"); 013: absolutedifference = firstnumber - secondnumber; 014: } October 25, 2017 Java Just in Time - John Latham Page 40(0/0)

44 Absolute difference 015: else if (firstnumber == secondnumber) 016: { 017: System.out.println("The two numbers are equal"); 018: absolutedifference = 0; 019: } 020: else 021: { 022: System.out.println("The second number is larger than the first"); 023: absolutedifference = secondnumber - firstnumber; 024: } 025: System.out.println("The absolute difference is " + absolutedifference); 026: } 027: } October 25, 2017 Java Just in Time - John Latham Page 41(0/0)

45 Trying it Console Input / Output $ java AbsoluteDifference The second number is larger than the first The absolute difference is $ _ Run Coffee time: Are you surprised by the inaccuracy of the above result? Console Input / Output $ java AbsoluteDifference The two numbers are equal The absolute difference is 0.0 $ java AbsoluteDifference The first number is larger than the second The absolute difference is $ _ Run October 25, 2017 Java Just in Time - John Latham Page 42(0/0)

46 Trying it Note: equality of reals is a dangerous notion... Console Input / Output $ java AbsoluteDifference The two numbers are equal The absolute difference is 0.0 $ _ Run October 25, 2017 Java Just in Time - John Latham Page 43(0/0)

47 Concepts covered in this chapter Each book chapter ends with a list of concepts covered in it. Each concept has with it a self-test question, and a page reference to where it was covered. Please use these to check your understanding before we start the next chapter. October 25, 2017 Java Just in Time - John Latham Page 44(0/0)

Title. Java Just in Time. John Latham. October 25, October 25, 2017 Java Just in Time - John Latham Page 1(0/0)

Title. Java Just in Time. John Latham. October 25, October 25, 2017 Java Just in Time - John Latham Page 1(0/0) List of Slides 1 Title 2 Chapter 6: Control statements nested in loops 3 Chapter aims 4 Section 2: Example:Film certificate age checking the whole queue 5 Aim 6 Statement: statements can be nested within

More information

17 Statement: assignment statement: assigning an expression value 18 Age next year 19 Type: String: conversion: from int 21 Age next year 22 The full

17 Statement: assignment statement: assigning an expression value 18 Age next year 19 Type: String: conversion: from int 21 Age next year 22 The full List of Slides 1 Title 2 Chapter 3: Types, variables and expressions 3 Chapter aims 4 Section 2: Example:Age next year 5 Aim 6 Design: hard coding 7 Age next year 8 Type 9 Type: int 10 Variable 11 Variable:

More information

17 Hello world 18 Type: String: literal 19 Standard API: System: out.println() 20 Hello world 21 Statement 22 Statement: simple statements are ended w

17 Hello world 18 Type: String: literal 19 Standard API: System: out.println() 20 Hello world 21 Statement 22 Statement: simple statements are ended w List of Slides 1 Title 2 Chapter 2: Sequential execution and program errors 3 Chapter aims 4 Section 2: Example:Hello world 5 Aim 6 Class: programs are divided into classes 7 Class: public class 8 Class:

More information

List of Slides 1 Title 2 Chapter 2: Sequential execution and program errors 3 Chapter aims 4 Section 2: Example:Hello world 5 Aim 6 Class: programs ar

List of Slides 1 Title 2 Chapter 2: Sequential execution and program errors 3 Chapter aims 4 Section 2: Example:Hello world 5 Aim 6 Class: programs ar List of Slides 1 Title 2 Chapter 2: Sequential execution and program errors 3 Chapter aims 4 Section 2: Example:Hello world 5 Aim 6 Class: programs are divided into classes 7 Class: public class 8 Class:

More information

20 Minimum bit width 21 Minimum bit width 22 Design: pseudo code 24 Minimum bit width 25 Minimum bit width 26 Standard API: Math: pow() 27 Minimum bit

20 Minimum bit width 21 Minimum bit width 22 Design: pseudo code 24 Minimum bit width 25 Minimum bit width 26 Standard API: Math: pow() 27 Minimum bit List of Slides 1 Title 2 Chapter 5: Repeated execution 3 Chapter aims 4 Section 2: Example:Minimum tank size 5 Aim 6 Minimum tank size 7 Execution: repeated execution 8 Statement: assignment statement:

More information

Conditional Execution

Conditional Execution Unit 3, Part 3 Conditional Execution Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Simple Conditional Execution in Java if () { else {

More information

CONDITIONAL EXECUTION

CONDITIONAL EXECUTION CONDITIONAL EXECUTION yes x > y? no max = x; max = y; logical AND logical OR logical NOT &&! Fundamentals of Computer Science I Outline Conditional Execution if then if then Nested if then statements Comparisons

More information

Flow Control. Key Notion. Statement Categories. 28-Oct-10

Flow Control. Key Notion. Statement Categories. 28-Oct-10 Boaz Kantor Introduction to Computer Science, Fall semester 2010-2011 IDC Herzliya Flow Control Raistlin: This alters time. Astinus: This alters nothing...time flows on, undisturbed. Raistlin: And carries

More information

Programming: Java. Chapter Objectives. Control Structures. Chapter 4: Control Structures I. Program Design Including Data Structures

Programming: Java. Chapter Objectives. Control Structures. Chapter 4: Control Structures I. Program Design Including Data Structures Chapter 4: Control Structures I Java Programming: Program Design Including Data Structures Chapter Objectives Learn about control structures Examine relational and logical operators Explore how to form

More information

Lesson 7 Part 2 Flags

Lesson 7 Part 2 Flags Lesson 7 Part 2 Flags A Flag is a boolean variable that signals when some condition exists in a program. When a flag is set to true, it means some condition exists When a flag is set to false, it means

More information

Flow Control. Boaz Kantor Introduction to Computer Science, Fall semester IDC Herzliya

Flow Control. Boaz Kantor Introduction to Computer Science, Fall semester IDC Herzliya Boaz Kantor Introduction to Computer Science, Fall semester 2010-2011 IDC Herzliya Flow Control Raistlin: This alters time. Astinus: This alters nothing...time flows on, undisturbed. Raistlin: And carries

More information

26 Age history with a separate method 27 Method: void methods 28 Age history with a separate method 29 Age history with a separate method 33 Trying it

26 Age history with a separate method 27 Method: void methods 28 Age history with a separate method 29 Age history with a separate method 33 Trying it List of Slides 1 Title 2 Chapter 8: Separate methods and logical operators 3 Chapter aims 4 Section 2: Example:Age history with two people 5 Aim 6 Age history with two people 11 Trying it 12 Coursework:

More information

School of Computer Science CPS109 Course Notes 5 Alexander Ferworn Updated Fall 15

School of Computer Science CPS109 Course Notes 5 Alexander Ferworn Updated Fall 15 Table of Contents 1 INTRODUCTION... 1 2 IF... 1 2.1 BOOLEAN EXPRESSIONS... 3 2.2 BLOCKS... 3 2.3 IF-ELSE... 4 2.4 NESTING... 5 3 SWITCH (SOMETIMES KNOWN AS CASE )... 6 3.1 A BIT ABOUT BREAK... 7 4 CONDITIONAL

More information

In this chapter, you will:

In this chapter, you will: Java Programming: Guided Learning with Early Objects Chapter 4 Control Structures I: Selection In this chapter, you will: Make decisions with the if and if else structures Use compound statements in an

More information

Following is the general form of a typical decision making structure found in most of the programming languages:

Following is the general form of a typical decision making structure found in most of the programming languages: Decision Making Decision making structures have one or more conditions to be evaluated or tested by the program, along with a statement or statements that are to be executed if the condition is determined

More information

Java Just in Time: task questions

Java Just in Time: task questions Java Just in Time: task questions John Latham October 24, 2017 Contents 1 Chapter 1 Introduction 4 1.6 Section / task 1.6 Our first Java program..................... 4 1.7 Section / task 1.7 Our second

More information

Computer Programming, I. Laboratory Manual. Experiment #3. Selections

Computer Programming, I. Laboratory Manual. Experiment #3. Selections Think Twice Code Once The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2005 Khaleel I. Shaheen Computer Programming, I Laboratory Manual Experiment #3

More information

CONDITIONAL EXECUTION

CONDITIONAL EXECUTION CONDITIONAL EXECUTION yes x > y? no max = x; max = y; logical AND logical OR logical NOT &&! Fundamentals of Computer Science I Outline Conditional Execution if then if then Nested if then statements Comparisons

More information

class objects instances Fields Constructors Methods static

class objects instances Fields Constructors Methods static Class Structure Classes A class describes a set of objects The objects are called instances of the class A class describes: Fields (instance variables)that hold the data for each object Constructors that

More information

Accelerating Information Technology Innovation

Accelerating Information Technology Innovation Accelerating Information Technology Innovation http://aiti.mit.edu Cali, Colombia Summer 2012 Lección 03 Control Structures Agenda 1. Block Statements 2. Decision Statements 3. Loops 2 What are Control

More information

COMP-202: Foundations of Programming. Lecture 3: Boolean, Mathematical Expressions, and Flow Control Sandeep Manjanna, Summer 2015

COMP-202: Foundations of Programming. Lecture 3: Boolean, Mathematical Expressions, and Flow Control Sandeep Manjanna, Summer 2015 COMP-202: Foundations of Programming Lecture 3: Boolean, Mathematical Expressions, and Flow Control Sandeep Manjanna, Summer 2015 Announcements Slides will be posted before the class. There might be few

More information

CONDITIONAL EXECUTION: PART 2

CONDITIONAL EXECUTION: PART 2 CONDITIONAL EXECUTION: PART 2 yes x > y? no max = x; max = y; logical AND logical OR logical NOT &&! Fundamentals of Computer Science I Outline Review: The if-else statement The switch statement A look

More information

Selections. EECS1021: Object Oriented Programming: from Sensors to Actuators Winter 2019 CHEN-WEI WANG

Selections. EECS1021: Object Oriented Programming: from Sensors to Actuators Winter 2019 CHEN-WEI WANG Selections EECS1021: Object Oriented Programming: from Sensors to Actuators Winter 2019 CHEN-WEI WANG Learning Outcomes The Boolean Data Type if Statement Compound vs. Primitive Statement Common Errors

More information

COMP-202 Unit 4: Programming With Iterations. CONTENTS: The while and for statements

COMP-202 Unit 4: Programming With Iterations. CONTENTS: The while and for statements COMP-202 Unit 4: Programming With Iterations CONTENTS: The while and for statements Introduction (1) Suppose we want to write a program to be used in cash registers in stores to compute the amount of money

More information

Conditionals, Loops, and Style

Conditionals, Loops, and Style Conditionals, Loops, and Style yes x > y? no max = x; max = y; http://xkcd.com/292/ Fundamentals of Computer Science Keith Vertanen Copyright 2013 Control flow thus far public class ArgsExample public

More information

CMPT 125: Lecture 4 Conditionals and Loops

CMPT 125: Lecture 4 Conditionals and Loops CMPT 125: Lecture 4 Conditionals and Loops Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 17, 2009 1 Flow of Control The order in which statements are executed

More information

Faculty of Science COMP-202A - Introduction to Computing I (Fall 2008) Midterm Examination

Faculty of Science COMP-202A - Introduction to Computing I (Fall 2008) Midterm Examination First Name: Last Name: McGill ID: Section: Faculty of Science COMP-202A - Introduction to Computing I (Fall 2008) Midterm Examination Tuesday, November 4, 2008 Examiners: Mathieu Petitpas [Section 1] 18:30

More information

Motivating Examples (1.1) Selections. Motivating Examples (1.2) Learning Outcomes. EECS1022: Programming for Mobile Computing Winter 2018

Motivating Examples (1.1) Selections. Motivating Examples (1.2) Learning Outcomes. EECS1022: Programming for Mobile Computing Winter 2018 Motivating Examples (1.1) Selections EECS1022: Programming for Mobile Computing Winter 2018 CHEN-WEI WANG 1 import java.util.scanner; 2 public class ComputeArea { 3 public static void main(string[] args)

More information

Instance Method Development Demo

Instance Method Development Demo Instance Method Development Demo Write a class Person with a constructor that accepts a name and an age as its argument. These values should be stored in the private attributes name and age. Then, write

More information

Title. Java Just in Time. John Latham. February 8, February 8, 2018 Java Just in Time - John Latham Page 1(0/0)

Title. Java Just in Time. John Latham. February 8, February 8, 2018 Java Just in Time - John Latham Page 1(0/0) List of Slides 1 Title 2 Chapter 17: Making our own exceptions 3 Chapter aims 4 Section 2: The exception inheritance hierarchy 5 Aim 6 The exception inheritance hierarchy 7 Exception: inheritance hierarchy

More information

Variables and data types

Variables and data types Survivor: CSCI 135 Variables Variables and data types Stores information your program needs Each has a unique name Each has a specific type Java built-in type what it stores example values operations String

More information

Title. Java Just in Time. John Latham. November 5, November 5, 2018 Java Just in Time - John Latham Page 1(0/0)

Title. Java Just in Time. John Latham. November 5, November 5, 2018 Java Just in Time - John Latham Page 1(0/0) List of Slides 1 Title 2 Chapter 9: Consolidation of concepts so far 3 Chapter aims 4 Section 2: Java concepts 5 Aim 6 Java concepts 7 Type: long 8 Type: short 9 Type: byte 10 Type: char 11 Type: char:

More information

Java Loop Control. Programming languages provide various control structures that allow for more complicated execution paths.

Java Loop Control. Programming languages provide various control structures that allow for more complicated execution paths. Loop Control There may be a situation when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed first,

More information

CS 112 Introduction to Programming

CS 112 Introduction to Programming CS 112 Introduction to Programming Conditional Statements Boolean Expressions and Methods Yang (Richard) Yang Computer Science Department Yale University 308A Watson, Phone: 432-6400 Email: yry@cs.yale.edu

More information

CS 112 Introduction to Programming

CS 112 Introduction to Programming CS 112 Introduction to Programming Conditional Statements Boolean Expressions and Methods Yang (Richard) Yang Computer Science Department Yale University 308A Watson, Phone: 432-6400 Email: yry@cs.yale.edu

More information

Learning Outcomes for this week. Inf1-OP. A Foundation for Programming. A Foundation for Programming

Learning Outcomes for this week. Inf1-OP. A Foundation for Programming. A Foundation for Programming Learning Outcomes for this week Inf1-OP Conditionals and Loops 1 Perdita Stevens, adapting earlier version by Ewan Klein School of Informatics January 9, 2016 Use if and if-else statements to execute a

More information

Computational Expression

Computational Expression Computational Expression Conditionals Janyl Jumadinova 10 October, 2018 Janyl Jumadinova Computational Expression 10 October, 2018 1 / 16 Computational Thinking: a problem solving process Decomposition

More information

Chapter 4: Control Structures I

Chapter 4: Control Structures I Chapter 4: Control Structures I Java Programming: From Problem Analysis to Program Design, Second Edition Chapter Objectives Learn about control structures. Examine relational and logical operators. Explore

More information

Lecture 4. CS118 Term planner. The simple if statement. Control flow: selection. The if... else statement cont... The if... else statement.

Lecture 4. CS118 Term planner. The simple if statement. Control flow: selection. The if... else statement cont... The if... else statement. 1 Lecture 4 CS118 Term planner You should have done, or be working through, problem sheet 2; next is sheet 3 Coursework - common mistakes do while (robot.look(direction) = IRobot.WALL); if (robot.look(irobot.ahead)

More information

M105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014

M105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014 M105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014 Question One: Choose the correct answer and write it on the external answer booklet. 1. Java is. a. case

More information

Topic 11 Scanner object, conditional execution

Topic 11 Scanner object, conditional execution https://www.dignitymemorial.com/obituaries/brookline-ma/adele-koss-5237804 Topic 11 Scanner object, conditional execution Logical thinking and experience was as important as theory in using the computer

More information

Topic 11 Scanner object, conditional execution

Topic 11 Scanner object, conditional execution Topic 11 Scanner object, conditional execution "There are only two kinds of programming languages: those people always [complain] about and those nobody uses." Bjarne Stroustroup, creator of C++ Copyright

More information

CSCI 135 Exam #0 Fundamentals of Computer Science I Fall 2012

CSCI 135 Exam #0 Fundamentals of Computer Science I Fall 2012 CSCI 135 Exam #0 Fundamentals of Computer Science I Fall 2012 Name: This exam consists of 7 problems on the following 6 pages. You may use your single- side hand- written 8 ½ x 11 note sheet during the

More information

Midterm Review Session

Midterm Review Session Midterm Review Session Programming Problems For more practice: http://webster.cs.washington.edu:8080/practiceit/ Copyright 2009 by Pearson Education Midterm Logistics Bring your UW Student ID card!! Will

More information

Conditionals, Loops, and Style. Control flow thus far. if statement. Control flow. Common branching statement Evaluate a boolean expression

Conditionals, Loops, and Style. Control flow thus far. if statement. Control flow. Common branching statement Evaluate a boolean expression Conditionals, Loops, and Style Control flow thus far yes no x > y? max = x; max = y; public class ArgsExample time 0 String product = args[0]; time 1 int qty = Integer.parseInt(args[1]); time 2 double

More information

Sequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade;

Sequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade; Control Statements Control Statements All programs could be written in terms of only one of three control structures: Sequence Structure Selection Structure Repetition Structure Sequence structure The

More information

CSE 114 Computer Science I

CSE 114 Computer Science I CSE 114 Computer Science I Iteration Cape Breton, Nova Scotia What is Iteration? Repeating a set of instructions a specified number of times or until a specific result is achieved How do we repeat steps?

More information

Program Control Flow

Program Control Flow Lecture slides for: Chapter 3 Program Control Flow Java Actually: A Comprehensive Primer in Programming Khalid Azim Mughal, Torill Hamre, Rolf W. Rasmussen Cengage Learning, 2008. ISBN: 978-1-844480-933-2

More information

Program Control Flow

Program Control Flow Lecture slides for: Chapter 3 Program Control Flow Java Actually: A Comprehensive Primer in Programming Khalid Azim Mughal, Torill Hamre, Rolf W. Rasmussen Cengage Learning, 2008. ISBN: 978-1-844480-933-2

More information

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program

More information

EXAM Computer Science 1 Part 1

EXAM Computer Science 1 Part 1 Maastricht University Faculty of Humanities and Science Department of Knowledge Engineering EXAM Computer Science 1 Part 1 Block 1.1: Computer Science 1 Code: KEN1120 Examiner: Kurt Driessens Date: Januari

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 5 Lecture 5-4: do/while loops, assertions reading: 5.1, 5.5 1 The do/while loop do/while loop: Performs its test at the end of each repetition. Guarantees that the loop's

More information

CT 229 Java Syntax Continued

CT 229 Java Syntax Continued CT 229 Java Syntax Continued 29/09/2006 CT229 Lab Assignments One Week Extension for Lab Assignment 1. Due Date: Oct 8 th Before submission make sure that the name of each.java file matches the name given

More information

1007 Imperative Programming Part II

1007 Imperative Programming Part II Agenda 1007 Imperative Programming Part II We ve seen the basic ideas of sequence, iteration and selection. Now let s look at what else we need to start writing useful programs. Details now start to be

More information

5. Selection: If and Switch Controls

5. Selection: If and Switch Controls Computer Science I CS 135 5. Selection: If and Switch Controls René Doursat Department of Computer Science & Engineering University of Nevada, Reno Fall 2005 Computer Science I CS 135 0. Course Presentation

More information

CA4003 Compiler Construction Assignment Language Definition

CA4003 Compiler Construction Assignment Language Definition CA4003 Compiler Construction Assignment Language Definition David Sinclair 2017-2018 1 Overview The language is not case sensitive. A nonterminal, X, is represented by enclosing it in angle brackets, e.g.

More information

CIS 1068 Program Design and Abstraction Spring2016 Midterm Exam 1. Name SOLUTION

CIS 1068 Program Design and Abstraction Spring2016 Midterm Exam 1. Name SOLUTION CIS 1068 Program Design and Abstraction Spring2016 Midterm Exam 1 Name SOLUTION Page Points Score 2 15 3 8 4 18 5 10 6 7 7 7 8 14 9 11 10 10 Total 100 1 P age 1. Program Traces (41 points, 50 minutes)

More information

Chapter 3. Selections

Chapter 3. Selections Chapter 3 Selections 1 Outline 1. Flow of Control 2. Conditional Statements 3. The if Statement 4. The if-else Statement 5. The Conditional operator 6. The Switch Statement 7. Useful Hints 2 1. Flow of

More information

For that purpose, java provides control structures that serve to specify what has to be done by our program, when and under which circumstances.

For that purpose, java provides control structures that serve to specify what has to be done by our program, when and under which circumstances. Control Structures A program is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. For that purpose, java provides control structures

More information

More Things We Can Do With It! Overview. Circle Calculations. πr 2. π = More operators and expression types More statements

More Things We Can Do With It! Overview. Circle Calculations. πr 2. π = More operators and expression types More statements More Things We Can Do With It! More operators and expression types More s 11 October 2007 Ariel Shamir 1 Overview Variables and declaration More operators and expressions String type and getting input

More information

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017 Introduction to OOP with Java Instructor: AbuKhleif, Mohammad Noor Sep 2017 Lecture 03: Control Flow Statements: Selection Instructor: AbuKhleif, Mohammad Noor Sep 2017 Instructor AbuKhleif, Mohammad Noor

More information

1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 4, 2005

1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 4, 2005 1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 4, 2005 Name: E-mail Address: TA: Section: You have 80 minutes to complete this exam. For coding questions, you do not need to

More information

Lec 3. Compilers, Debugging, Hello World, and Variables

Lec 3. Compilers, Debugging, Hello World, and Variables Lec 3 Compilers, Debugging, Hello World, and Variables Announcements First book reading due tonight at midnight Complete 80% of all activities to get 100% HW1 due Saturday at midnight Lab hours posted

More information

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program

More information

1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi...

1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi... Contents 1 Introduction 3 1.1 Java, the beginning.......................... 3 1.2 Java Virtual Machine........................ 4 1.3 A First Program........................... 4 1.4 BlueJ.................................

More information

CIS 110 Introduction to Computer Programming. 7 May 2012 Final Exam

CIS 110 Introduction to Computer Programming. 7 May 2012 Final Exam CIS 110 Introduction to Computer Programming 7 May 2012 Final Exam Name: Recitation # (e.g. 201): Pennkey (e.g. bjbrown): My signature below certifies that I have complied with the University of Pennsylvania

More information

Tutorials. Inf1-OP. Learning Outcomes for this week. A Foundation for Programming. Conditionals and Loops 1

Tutorials. Inf1-OP. Learning Outcomes for this week. A Foundation for Programming. Conditionals and Loops 1 Tutorials Inf1-OP Conditionals and Loops 1 Volker Seeker, adapting earlier version by Perdita Stevens and Ewan Klein Start this week please let the ITO know if you need to switch tutorial groups. Labs

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 5 Lecture 5-4: do/while loops, assertions reading: 5.1, 5.5 1 The do/while loop do/while loop: Performs its test at the end of each repetition. Guarantees that the loop's

More information

AP Computer Science. if/else, return values. Copyright 2010 by Pearson Education

AP Computer Science. if/else, return values. Copyright 2010 by Pearson Education AP Computer Science if/else, return values The if statement Executes a block of statements only if a test is true statement;... statement; Example: double gpa = console.nextdouble(); if (gpa >= 2.0) {

More information

Garfield AP CS. User Input, If/Else. Most slides from Building Java Programs. Thanks, Stuart Regesand Marty Stepp!

Garfield AP CS. User Input, If/Else. Most slides from Building Java Programs. Thanks, Stuart Regesand Marty Stepp! Garfield AP CS User Input, If/Else Most slides from Building Java Programs. Thanks, Stuart Regesand Marty Stepp! Warmup Write a method add10 that takes one integer parameter. Your method should return

More information

Lesson 6A Loops. By John B. Owen All rights reserved 2011, revised 2014

Lesson 6A Loops. By John B. Owen All rights reserved 2011, revised 2014 Lesson 6A Loops By John B. Owen All rights reserved 2011, revised 2014 Topic List Objectives Loop structure 4 parts Three loop styles Example of a while loop Example of a do while loop Comparison while

More information

Computer Programming, I. Laboratory Manual. Final Exam Solution

Computer Programming, I. Laboratory Manual. Final Exam Solution Think Twice Code Once The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2005 Khaleel I. Shaheen Computer Programming, I Laboratory Manual Final Exam Solution

More information

Topics. Chapter 5. Equality Operators

Topics. Chapter 5. Equality Operators Topics Chapter 5 Flow of Control Part 1: Selection Forming Conditions if/ Statements Comparing Floating-Point Numbers Comparing Objects The equals Method String Comparison Methods The Conditional Operator

More information

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA 1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

Programming Logic and Design Sixth Edition

Programming Logic and Design Sixth Edition Objectives Programming Logic and Design Sixth Edition Chapter 4 Making Decisions In this chapter, you will learn about: Evaluating Boolean expressions to make comparisons The relational comparison operators

More information

C++ Programming: From Problem Analysis to Program Design, Third Edition

C++ Programming: From Problem Analysis to Program Design, Third Edition C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 4: Control Structures I (Selection) Control Structures A computer can proceed: In sequence Selectively (branch) - making

More information

About this exam review

About this exam review Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review

More information

About This Lecture. Selection Control Structures - if. Sequence. Outline. Selection

About This Lecture. Selection Control Structures - if. Sequence. Outline. Selection 2 About This Lecture Selection Control Structures - if Cmput 114 - Lecture 14 Department of Computing Science University of Alberta z Each of our programs consists of a sequence of statements. z Even though

More information

Control structures and logic

Control structures and logic Programming with Java Module 2 Control structures and logic Theoretical part Contents 1 Module overview 3 1.1 Commands and blocks........................... 3 2 Operators (Part II) 4 2.1 Relational Operators............................

More information

Exam Datastrukturer. DIT960 / DIT961, VT-18 Göteborgs Universitet, CSE

Exam Datastrukturer. DIT960 / DIT961, VT-18 Göteborgs Universitet, CSE Exam Datastrukturer DIT960 / DIT961, VT-18 Göteborgs Universitet, CSE Day: 2018-10-12, Time: 8:30-12.30, Place: SB Course responsible Alex Gerdes, tel. 031-772 6154. Will visit at around 9:30 and 11:00.

More information

Chapter 4 Control Structures

Chapter 4 Control Structures Chapter 4 Control Structures Foundational Java Key Elements and Practical Programming 1 if - else switch Control Structures break and continue Ternary operator while and do-while loops for loops 2 Two

More information

Data dependent execution order data dependent control flow

Data dependent execution order data dependent control flow Chapter 5 Data dependent execution order data dependent control flow The method of an object processes data using statements, e.g., for assignment of values to variables and for in- and output. The execution

More information

CIS 110 Spring 2013 Make-Up Midterm, 13 February 2013, Answer Key. Miscellaneous

CIS 110 Spring 2013 Make-Up Midterm, 13 February 2013, Answer Key. Miscellaneous CIS 110 Make-Up 1 CIS 110 Spring 2013 Make-Up Midterm, 13 February 2013, Answer Key Miscellaneous 1. (1 points) (a) Write your name, recitation number, and PennKey (username) on the front of the exam.

More information

ECOR Come to the PASS workshop with your mock exam complete. During the workshop you can work with other students to review your work.

ECOR Come to the PASS workshop with your mock exam complete. During the workshop you can work with other students to review your work. It is most beneficial to you to write this mock midterm UNDER EXAM CONDITIONS. This means: Complete the midterm in 1.5 hour(s). Work on your own. Keep your notes and textbook closed. Attempt every question.

More information

COMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette

COMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette COMP 250: Java Programming I Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette Variables and types [Downey Ch 2] Variable: temporary storage location in memory.

More information

JAVA PROGRAMMING LAB. ABSTRACT In this Lab you will learn to define and invoke void and return java methods

JAVA PROGRAMMING LAB. ABSTRACT In this Lab you will learn to define and invoke void and return java methods Islamic University of Gaza Faculty of Engineering Computer Engineering Dept. Computer Programming Lab (ECOM 2114) ABSTRACT In this Lab you will learn to define and invoke void and return java methods JAVA

More information

Flow of Control. Chapter 3 Part 3 The Switch Statement

Flow of Control. Chapter 3 Part 3 The Switch Statement Flow of Control Chapter 3 Part 3 The Switch Statement Agenda Hw 03 comments Review of Ch03 - Parts 1 & 2 Conditional operator I/O of boolean values The switch statement Random numbers Methods with arguments

More information

20 Standard API: Math: round() 21 Salary analysis 22 Standard API: System: out.printf(): string item 24 Standard API: System: out.printf(): fixed text

20 Standard API: Math: round() 21 Salary analysis 22 Standard API: System: out.printf(): string item 24 Standard API: System: out.printf(): fixed text List of Slides 1 Title 2 Chapter 14: Arrays 3 Chapter aims 4 Section 2: Example:Salary analysis 5 Aim 6 Salary analysis 7 Salary analysis 8 Array 10 Type: array type 11 Salary analysis 12 Variable: of

More information

CIS 110 Introduction to Computer Programming 8 October 2013 Midterm

CIS 110 Introduction to Computer Programming 8 October 2013 Midterm CIS 110 Introduction to Computer Programming 8 October 2013 Midterm Name: Recitation # (e.g., 201): Pennkey (e.g., eeaton): My signature below certifies that I have complied with the University of Pennsylvania

More information

CS302: Self Check Quiz 2

CS302: Self Check Quiz 2 CS302: Self Check Quiz 2 name: Part I True or False For these questions, is the statement true or false? Assume the statements are about the Java programming language. 1.) The result of an expression with

More information

Pull Lecture Materials and Open PollEv. Poll Everywhere: pollev.com/comp110. Lecture 12. else-if and while loops. Once in a while

Pull Lecture Materials and Open PollEv. Poll Everywhere: pollev.com/comp110. Lecture 12. else-if and while loops. Once in a while Pull Lecture Materials and Open PollEv Poll Everywhere: pollev.com/comp110 Lecture 12 else-if and while loops Once in a while Fall 2016 if-then-else Statements General form of an if-then-else statement:

More information

Decisions: Logic Java Programming 2 Lesson 7

Decisions: Logic Java Programming 2 Lesson 7 Decisions: Logic Java Programming 2 Lesson 7 In the Java 1 course we learned about if statements, which use booleans (true or false) to make decisions. In this lesson, we'll dig a little deeper and use

More information

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 More Flow of Control Overview 3.1 Using Boolean Expressions 3.2 Multiway Branches 3.3 More about C++ Loop Statements 3.4 Designing Loops Slide 3-3 Flow Of Control Flow of control refers to the

More information

CSE 142 Su 04 Computer Programming 1 - Java. Objects

CSE 142 Su 04 Computer Programming 1 - Java. Objects Objects Objects have state and behavior. State is maintained in instance variables which live as long as the object does. Behavior is implemented in methods, which can be called by other objects to request

More information

Key Points. COSC 123 Computer Creativity. Java Decisions and Loops. Making Decisions Performing Comparisons. Making Decisions

Key Points. COSC 123 Computer Creativity. Java Decisions and Loops. Making Decisions Performing Comparisons. Making Decisions COSC 123 Computer Creativity Java Decisions and Loops Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) A decision is made by evaluating a condition in an if/

More information

C22a: Problem Solving using Recursion

C22a: Problem Solving using Recursion CISC 3115 TY3 C22a: Problem Solving using Recursion Hui Chen Department of Computer & Information Science CUNY Brooklyn College 11/6/2018 CUNY Brooklyn College 1 Outline Characteristics of recursion Recursion

More information

Software and Programming 1

Software and Programming 1 Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 17 January 2019 SP1-Lab1-2018-19.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon

More information

Course PJL. Arithmetic Operations

Course PJL. Arithmetic Operations Outline Oman College of Management and Technology Course 503200 PJL Handout 5 Arithmetic Operations CS/MIS Department 1 // Fig. 2.9: Addition.java 2 // Addition program that displays the sum of two numbers.

More information

COS 126 Exam Review. Exams overview Example programming exam Example written exam questions (part 1)

COS 126 Exam Review. Exams overview Example programming exam Example written exam questions (part 1) COS 126 Exam Review Exams overview Example programming exam Example written exam questions (part 1) Exams overview (revisited) We have exams in the fall Two written exams. Two programming exams. Prep sessions

More information

Midterm Examination (MTA)

Midterm Examination (MTA) M105: Introduction to Programming with Java Midterm Examination (MTA) Spring 2013 / 2014 Question One: [6 marks] Choose the correct answer and write it on the external answer booklet. 1. Compilers and

More information