Assessment - Unit 3 lessons 16-21

Size: px
Start display at page:

Download "Assessment - Unit 3 lessons 16-21"

Transcription

1 Name(s) Period Date Assessment - Unit 3 lessons Which of the following statements about strings in JavaScript is FALSE? a. Strings consist of a sequence of concatenated ASCII characters. b. Strings are indicated by quotation marks. c. Strings cannot include numerical digits. d. A string can be empty, meaning that it contains nothing. e. Strings sometimes include spaces. 2. Which of the following JavaScript statements will result in the following output being displayed to the console? Hello! How are you? a. console.log( Hello! \t How are you? ); b. console.log( Hello! \b How are you? ); c. console.log( Hello! \newline How are you? ); d. console.log( Hello! \n How are you? ); e. console.log( Hello! \nl How are you? ); 3. What is the output of the following JavaScript code segment? var num = 5; var str = hello ; var result = num + str; console.log(result); a. 5hello b. 5 + hello c. error on num + str : type mismatch d. result 4. What is the output of the following JavaScript code segment? var str1 = 5 ; var str2 = 5 ; var result = str1 + str2; console.log(result); a. 10 b. error on str1 + str2 : type mismatch c. 55

2 d. result 5. Short answer: When should a programmer create a global variable instead of a local variable? 6. A Boolean expression is an expression that evaluates to which of the of the following? a. Yes/Maybe/No b. True/False c. Any Integer d. Integers between 1 and 10 e. Any single character 7. The following JavaScript code segment from App Lab has an error! Trace the code to determine which line the error is on and what the error is. 1 var time = promptnum( What time is it? ); 2 if (time < 10){ 3 settext("textbox", "It is before 10"); 4 else { 5 settext("textbox", It is after 10); 6 a. Line 1 time should be written in quotation marks like this time. b. Line 2 The symbol used should be > instead of < c. Line 4 else must always be followed by another conditional statement d. Line 5 It is after 10pm must be written in quotations. e. Line 5 The settext on line 5 will override the settext on line Short Answer: In the previous class periods, you developed a digital assistant that is able to intelligently respond to a limited set of questions and statements. Assume you have created a much more robust digital assistant with capabilities similar to those of Siri. Describe two possible user inputs: one question that a digital assistant could intelligently answer easily, and another that it could not. Explain what makes the first easy and the second difficult for a digital assistant. (Consider the code used to develop your digital assistant.) 9. The following statements are true about event handlers, if statements, or both in App Lab. Place the letter next to each statement into the appropriate area of the table below.

3 Statements. A. Runs code in response to a user action B. Runs code in response to statement being evaluated to True. C. Evaluated sequentially once execution is inside the statement D. Can be triggered at any time E. Used to run a block of code True for Event Handlers True for if Statements True for Both Event Handlers and if Statements 10. The human question below has a yes/no answer. Create a flowchart that shows the logical progression of the questions that need to be answered to arrive at yes or no. Your diagram should consider the day of the week, time of day, and account for both possible outcomes. Question Flowchart Should I be at school right now?

4 11. What is the expected output of the given pseudo code segment? A reference for the pseudo code can be found immediately below the question age < 35 IF (age < 35){ DISPLAY (You are not old enough to be President.) ELSE { DISPLAY (You are old enough to be President!) a. 35 b. true c. false d. You are not old enough to be President. e. You are old enough to be President! Pseudo Code Reference Instruction a < expression IF (condition) { <first block of statements> ELSE{ <second block of statements> DISPLAY (expression) INPUT () condition1 AND condition2 Explanation Evaluates expression and assigns the result to the variable a. The code in first block of statements is executed if the Boolean expression condition evaluates to true; otherwise the code in second block of statements is executed. Displays the value of expression, followed by a space. Accepts a value from the user and returns it. Evaluates to true if both condition1 and condition2 are true; otherwise evaluates to false. 12. Consider the following segment given in pseudo code (see reference from previous question): 1. IF (grade >= 70) 2. { 3. DISPLAY( You passed! ); ELSE 6. { 7. IF(grade < 70){

5 8. DISPLAY( Time to start studying again! ); 9. What will be displayed if grade is set to 70? a. You passed! b. Time to start studying again! c. You passed! and Time to start studying again! d. Nothing will be displayed e. An error will occur on line 7; you can t have an else inside an if statement 13. Consider the JavaScript code segment below. Which statement should be used in place of <missing code> such that the alarm is set to 9:00 am on weekends, and 6:30 am on weekdays. var day = prompt("what day is it tomorrow?"); if ( <missing code> ){ setalarm = 9:00am ; else { setalarm = 6:30am ; a. day == Saturday b. day == Sunday c. (day == Saturday ) (day == Sunday ) d. (day == Saturday ) && (day == Sunday ) e. day!= Monday 14. A pseudocode program is started below that gets two pieces of input from the user and stores each value in a variable. Continue writing pseudocode to accomplish this task: If the hour is within the school day (8 to 15) then display Nice to see you!, Otherwise, display It s time to go home! DISPLAY ( Enter the hour of day (0 23) ) hour < INPUT () 15. Consider the code segment below given in pseudo code (see reference above). Assuming that variables a, b and c already have numeric values assigned to them, what is the expected output of

6 this code segment? val < a IF(a < b AND b < c){ val < b; ELSE { IF (a < c AND c < b) { val < c; DISPLAY (val); a. The code will display the middle of all three values b. The code will display the smallest of the three values c. The code will display the largest of the three values d. The code will always display the value stored in variable a e. The code will not display anything due to an error For the next two questions, consider the following JavaScript code segment. var word = prompt( Enter a word ); if( word.length > 10){ console.log( Wow, big word. ); else{ if( word.length < 3 ){ console.log( Did you say something? That was so short. ); else{ if( word.length > 6){ console.log( Use that word on the SAT. ); else{ console.log( I ve never heard that before. ); 16. If the above code segment is run, and hello is entered at the prompt, what will be displayed in the console? a. Wow, big word. b. Did you say something? That was so short. c. Use that word on the SAT. d. I ve never heard that before.

7 e. Nothing will be printed. 17. If the above code segment is run, and goodbye is entered into the prompt, what will be displayed in the console? a. Wow, big word. b. Did you say something? That was so short. c. Use that word on the SAT. d. I ve never heard that before. e. Nothing will be printed. 18. Consider the following JavaScript code segment. 1. var time = promptnum( What hour is it (on a 24 hour clock)? ); 2. var greeting = ; 3. if (time < 6) { 4. greeting = "It is too early!"; 5. else if (time < 20) { 6. greeting = "Good day!"; 7. else if (time < 10) { 8. greeting = Good morning! ; 9. else { 10. greeting = "Good evening!"; console.log(greeting); Something is wrong with the logic in the program above. For which values of time will the greeting Good Morning be displayed? a. Any time between 6 and 9 b. Any time between 10 and 19 c. Any time between 0 and 20 d. There is no value of time that will result in Good Morning being displayed e. The logic error will cause the program to stop running at line A programmer designed a program for an airline to determine whether there is an extra fee on a checked bag. The logic is shown in the flow chart at right. The code they wrote (see below) runs without error, but unfortunately it does not work as intended.

8 1. var weight = promptnum("how much does your luggage weigh?"); 2. if (weight > 50){ 3. settext("response", "There is a $25 fee to take this luggage"); 4. else if (weight > 120){ 5. settext("response", "Your luggage is too heavy for this flight"); 6. else { 7. settext("response", "Your luggage is accepted as is"); 8. What is the problem? Consider the list of values below and choose two that if assigned to weight will result in the incorrect message being displayed as the response (choose 2)? a. 30 b. 50 c. 75 d. 125 e For each expression below, circle whether it evaluates to true or false. The variable temperature is initialized as shown. var temperature = 30; Expression Evaluates to (circle one) (temperature > 0) && (temperature < 32) true false (temperature > 0) (temperature < 32) true false (temperature!= 0) && (temperature < 32) true false (temperature == 0) (temperature > 32) true false (temperature < 0) (temperature > 32) true false

Intro to Event-Driven Programming

Intro to Event-Driven Programming Unit 5. Lessons 1 to 5 AP CS P We roughly follow the outline of assignment in code.org s unit 5. This is a continuation of the work we started in code.org s unit 3. Occasionally I will ask you to do additional

More information

Lab 1 Concert Ticket Calculator

Lab 1 Concert Ticket Calculator Lab 1 Concert Ticket Calculator Purpose To assess your ability to apply the knowledge and skills developed in weeks 1 through 3. Emphasis will be placed on the following learning outcomes: 1. Create and

More information

Introduction to Programming in Turing. Input, Output, and Variables

Introduction to Programming in Turing. Input, Output, and Variables Introduction to Programming in Turing Input, Output, and Variables The IPO Model The most basic model for a computer system is the Input-Processing-Output (IPO) Model. In order to interact with the computer

More information

The sequence of steps to be performed in order to solve a problem by the computer is known as an algorithm.

The sequence of steps to be performed in order to solve a problem by the computer is known as an algorithm. CHAPTER 1&2 OBJECTIVES After completing this chapter, you will be able to: Understand the basics and Advantages of an algorithm. Analysis various algorithms. Understand a flowchart. Steps involved in designing

More information

CSE 1223: Introduction to Computer Programming in Java Chapter 3 Branching

CSE 1223: Introduction to Computer Programming in Java Chapter 3 Branching CSE 1223: Introduction to Computer Programming in Java Chapter 3 Branching 1 Flow of Control The order in which statements in a program are executed is called the flow of control So far we have only seen

More information

Computers and FORTRAN Language Fortran 95/2003. Dr. Isaac Gang Tuesday March 1, 2011 Lecture 3 notes. Topics:

Computers and FORTRAN Language Fortran 95/2003. Dr. Isaac Gang Tuesday March 1, 2011 Lecture 3 notes. Topics: Computers and FORTRAN Language Fortran 95/2003 Dr. Isaac Gang Tuesday March 1, 2011 Lecture 3 notes Topics: - Program Design - Logical Operators - Logical Variables - Control Statements Any FORTRAN program

More information

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 05 / 31 / 2017 Instructor: Michael Eckmann Today s Topics Questions / Comments? recap and some more details about variables, and if / else statements do lab work

More information

CSCI 150: Exam 1 Practice

CSCI 150: Exam 1 Practice CSCI 150: Exam 1 Practice Instructor: Brent Yorgey February 5, 2018 Read all questions carefully before beginning. You will have 50 minutes to complete this exam. You are not allowed to use your notes,

More information

CSCI 150: Exam 1 Practice

CSCI 150: Exam 1 Practice CSCI 150: Exam 1 Practice January 12, 2019 Read all questions carefully before beginning. You will have 50 minutes to complete this exam. You are not allowed to use your notes, textbook, phone, or computer.

More information

Pseudocode. ARITHMETIC OPERATORS: In pseudocode arithmetic operators are used to perform arithmetic operations. These operators are listed below:

Pseudocode. ARITHMETIC OPERATORS: In pseudocode arithmetic operators are used to perform arithmetic operations. These operators are listed below: Pseudocode There are 3 programming/pseudocode constructs: 1. Sequence: It refers that instructions should be executed one after another. 2. Selection: This construct is used to make a decision in choosing

More information

3 The Building Blocks: Data Types, Literals, and Variables

3 The Building Blocks: Data Types, Literals, and Variables chapter 3 The Building Blocks: Data Types, Literals, and Variables 3.1 Data Types A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating

More information

CPE 112 Spring 2015 Exam II (100 pts) March 4, Definition Matching (8 Points)

CPE 112 Spring 2015 Exam II (100 pts) March 4, Definition Matching (8 Points) Name Definition Matching (8 Points) 1. (8 pts) Match the words with their definitions. Choose the best definition for each word. Relational Expression Iteration Counter Count-controlled loop Loop Flow

More information

ITEC136 - Lab 2 Population

ITEC136 - Lab 2 Population ITEC136 - Lab 2 Population Purpose To assess your ability to apply the knowledge and skills developed up though week 7. Emphasis will be placed on the following learning outcomes: 1. Decompose a problem

More information

Control Structures in Java if-else and switch

Control Structures in Java if-else and switch Control Structures in Java if-else and switch Lecture 4 CGS 3416 Spring 2017 January 23, 2017 Lecture 4CGS 3416 Spring 2017 Selection January 23, 2017 1 / 26 Control Flow Control flow refers to the specification

More information

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017 Control Structures Lecture 4 COP 3014 Fall 2017 September 18, 2017 Control Flow Control flow refers to the specification of the order in which the individual statements, instructions or function calls

More information

Decision Structures. Chapter 4

Decision Structures. Chapter 4 Decision Structures Chapter 4 Chapter 4 Objectives To understand: o What values can be stored in a Boolean variable o What sequence structures are and when used o What decision structures are and when

More information

CS 115 Lecture 4. More Python; testing software. Neil Moore

CS 115 Lecture 4. More Python; testing software. Neil Moore CS 115 Lecture 4 More Python; testing software Neil Moore Department of Computer Science University of Kentucky Lexington, Kentucky 40506 neil@cs.uky.edu 8 September 2015 Syntax: Statements A statement

More information

CS 115 Lecture 8. Selection: the if statement. Neil Moore

CS 115 Lecture 8. Selection: the if statement. Neil Moore CS 115 Lecture 8 Selection: the if statement Neil Moore Department of Computer Science University of Kentucky Lexington, Kentucky 40506 neil@cs.uky.edu 24 September 2015 Selection Sometime we want to execute

More information

1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical d.

1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical d. Gaddis: Starting Out with Python, 2e - Test Bank Chapter Two MULTIPLE CHOICE 1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical

More information

Chapter 5 Conditional and Iterative Statements. Statement are the instructions given to the computer to perform any kind of action.

Chapter 5 Conditional and Iterative Statements. Statement are the instructions given to the computer to perform any kind of action. Chapter 5 Conditional and Iterative Statements Statement Statement are the instructions given to the computer to perform any kind of action. Types of Statement 1. Empty Statement The which does nothing.

More information

CSCI 150: Exam 1 Practice

CSCI 150: Exam 1 Practice CSCI 150: Exam 1 Practice Instructor: Mark Goadrich and Gabriel Ferrer September 13, 2016 Read all questions carefully before beginning. You will have 1 hour to complete this exam. You are not allowed

More information

Midterm Exam. 5. What is the character - (minus) used for in JavaScript? Give as many answers as you can.

Midterm Exam. 5. What is the character - (minus) used for in JavaScript? Give as many answers as you can. First Name Last Name CSCi 90.3 March 23, 2010 Midterm Exam Instructions: For multiple choice questions, circle the letter of the one best choice unless the question explicitly states that it might have

More information

Objectives. Chapter 4: Control Structures I (Selection) Objectives (cont d.) Control Structures. Control Structures (cont d.) Relational Operators

Objectives. Chapter 4: Control Structures I (Selection) Objectives (cont d.) Control Structures. Control Structures (cont d.) Relational Operators Objectives Chapter 4: Control Structures I (Selection) In this chapter, you will: Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)

More information

Try typing the following in the Python shell and press return after each calculation. Write the answer the program displays next to the sums below.

Try typing the following in the Python shell and press return after each calculation. Write the answer the program displays next to the sums below. Name: Date: Instructions: PYTHON - INTRODUCTORY TASKS Open Idle (the program we will be using to write our Python codes). We can use the following code in Python to work out numeracy calculations. Try

More information

c122mar413.notebook March 06, 2013

c122mar413.notebook March 06, 2013 These are the programs I am going to cover today. 1 2 Javascript is embedded in HTML. The document.write() will write the literal Hello World! to the web page document. Then the alert() puts out a pop

More information

CS 115 Data Types and Arithmetic; Testing. Taken from notes by Dr. Neil Moore

CS 115 Data Types and Arithmetic; Testing. Taken from notes by Dr. Neil Moore CS 115 Data Types and Arithmetic; Testing Taken from notes by Dr. Neil Moore Statements A statement is the smallest unit of code that can be executed on its own. So far we ve seen simple statements: Assignment:

More information

Chapter 4: Control Structures I (Selection) Objectives. Objectives (cont d.) Control Structures. Control Structures (cont d.

Chapter 4: Control Structures I (Selection) Objectives. Objectives (cont d.) Control Structures. Control Structures (cont d. Chapter 4: Control Structures I (Selection) In this chapter, you will: Objectives Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)

More information

BUP2 5/2 12/4/07 12:49 AM Page 1. Introduction

BUP2 5/2 12/4/07 12:49 AM Page 1. Introduction BUP2 5/2 12/4/07 12:49 AM Page 1 Introduction This booklet will give you easy to follow instructions to allow you to set your BUP2 Programmer to the Weekday/Weekend, (same times Monday - Friday, different

More information

#include <iostream> #include <algorithm> #include <cmath> using namespace std; int f1(int x, int y) { return (double)(x/y); }

#include <iostream> #include <algorithm> #include <cmath> using namespace std; int f1(int x, int y) { return (double)(x/y); } 1. (9 pts) Show what will be output by the cout s in this program. As in normal program execution, any update to a variable should affect the next statement. (Note: boolalpha simply causes Booleans to

More information

Comp 151. Control structures.

Comp 151. Control structures. Comp 151 Control structures. admin For these slides read chapter 7 Yes out of order. Simple Decisions So far, we ve viewed programs as sequences of instructions that are followed one after the other. While

More information

(the bubble footer is automatically inserted into this space)

(the bubble footer is automatically inserted into this space) CS 1110 Exam 1, Fall 2018 Page 1 of 8 UVa userid: CS 1110 Exam 1 Name Bubble in your computing ID in the footer of this page. We use an optical scanner to read it, so fill in the bubbles darkly. If you

More information

Text Input and Conditionals

Text Input and Conditionals Text Input and Conditionals Text Input Many programs allow the user to enter information, like a username and password. Python makes taking input from the user seamless with a single line of code: input()

More information

boolean & if-then-else

boolean & if-then-else boolean & if-then-else Lecture 03 Step 1: Open VSCode and its Integrated Terminal Step 2: npm run pull Step 3: npm run start Step 4: Open another tab to pollev.com/comp110 Assignments Out Problem Set 0

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

CMPT 120 Introduction To Computing Science And Programming I. Pseudocode. Summer 2012 Instructor: Hassan Khosravi

CMPT 120 Introduction To Computing Science And Programming I. Pseudocode. Summer 2012 Instructor: Hassan Khosravi CMPT 120 Introduction To Computing Science And Programming I Pseudocode Summer 2012 Instructor: Hassan Khosravi Guessing game 1. Tell the user to pick a secret number between 1 and 100. 2. The smallest

More information

Programming Language. Control Structures: Selection (switch) Eng. Anis Nazer First Semester

Programming Language. Control Structures: Selection (switch) Eng. Anis Nazer First Semester Programming Language Control Structures: Selection (switch) Eng. Anis Nazer First Semester 2018-2019 Multiple selection choose one of two things if/else choose one from many things multiple selection using

More information

Python for Non-programmers

Python for Non-programmers Python for Non-programmers A Gentle Introduction 1 Yann Tambouret Scientific Computing and Visualization Information Services & Technology Boston University 111 Cummington St. yannpaul@bu.edu Winter 2013

More information

Assessment - Unit 3 lessons 9-15

Assessment - Unit 3 lessons 9-15 Name(s) Period Date Assessment - Unit 3 lessons 9-15 1. Which of the following is FALSE about event driven programs? a. An event driven program cannot implement an algorithm. b. Some portions of an event

More information

Introduction to: Computers & Programming: Review prior to 1 st Midterm

Introduction to: Computers & Programming: Review prior to 1 st Midterm Introduction to: Computers & Programming: Review prior to 1 st Midterm Adam Meyers New York University Summary Some Procedural Matters Summary of what you need to Know For the Test and To Go Further in

More information

Chapter 2.4: Common facilities of procedural languages

Chapter 2.4: Common facilities of procedural languages Chapter 2.4: Common facilities of procedural languages 2.4 (a) Understand and use assignment statements. Assignment An assignment is an instruction in a program that places a value into a specified variable.

More information

C++ Programming: From Problem Analysis to Program Design, Fourth Edition. Chapter 4: Control Structures I (Selection)

C++ Programming: From Problem Analysis to Program Design, Fourth Edition. Chapter 4: Control Structures I (Selection) C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 4: Control Structures I (Selection) Objectives In this chapter, you will: Learn about control structures Examine relational

More information

Lecture 3. Input, Output and Data Types

Lecture 3. Input, Output and Data Types Lecture 3 Input, Output and Data Types Goals for today Variable Types Integers, Floating-Point, Strings, Booleans Conversion between types Operations on types Input/Output Some ways of getting input, and

More information

Functions and Arrays Programs

Functions and Arrays Programs Functions and Arrays Programs NOTE. Do not use any global variables unless explicitly told to do so. AP CSP Exercise 1. Create a program that calculates the distance between a point and the origin. Since

More information

JavaScript Basics. The Big Picture

JavaScript Basics. The Big Picture JavaScript Basics At this point, you should have reached a certain comfort level with typing and running JavaScript code assuming, of course, that someone has already written it for you This handout aims

More information

Software. Programming Languages. Types of Software. Types of Languages. Types of Programming. Software does something

Software. Programming Languages. Types of Software. Types of Languages. Types of Programming. Software does something Software Software does something LBSC 690: Week 10 Programming, JavaScript Jimmy Lin College of Information Studies University of Maryland Monday, April 9, 2007 Tells the machine how to operate on some

More information

Introducing: main Function, Comments, Statements

Introducing: main Function, Comments, Statements Once you're seated, please respond to the poll at pollev.com/compunc If you are not registered for PollEverywhere, please go ahead and do so before class begins! Lecture 01 Take on Me Practice: Primitive

More information

AQA Decision 1 Algorithms. Section 1: Communicating an algorithm

AQA Decision 1 Algorithms. Section 1: Communicating an algorithm AQA Decision 1 Algorithms Section 1: Communicating an algorithm Notes and Examples These notes contain subsections on Flow charts Pseudo code Loops in algorithms Programs for the TI-83 graphical calculator

More information

Overview: Programming Concepts. Programming Concepts. Names, Values, And Variables

Overview: Programming Concepts. Programming Concepts. Names, Values, And Variables Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating

More information

Overview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript

Overview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating

More information

From video conversation 2. This is a gap fill exercise and can be used as either a quiz/test of

From video conversation 2. This is a gap fill exercise and can be used as either a quiz/test of Teacher s guide to the quizzes/tests available for Unit 4 Quiz 1 Quiz 2 Quiz 3 Quiz 4 From video conversation 1. This is a gap fill exercise and can be used as either a quiz/test of target language acquisition,

More information

St. Benedict s High School. Computing Science. Software Design & Development. (Part 1 Computer Programming) National 5

St. Benedict s High School. Computing Science. Software Design & Development. (Part 1 Computer Programming) National 5 Computing Science Software Design & Development (Part 1 Computer Programming) National 5 VARIABLES & DATA TYPES Variables provide temporary storage for information that will be needed while a program is

More information

Input, output, and sequence

Input, output, and sequence Chapter 29 Input, output, and sequence For this chapter, switch languages in DrRacket to Advanced Student Language. In the real world, we don t usually give a computer all the information it needs, all

More information

CHAPTER 2 PROBLEM SOLVING TECHNIQUES. Mr Mohd Hatta Bin Hj Mohamed Ali Computer Programming BFC2042

CHAPTER 2 PROBLEM SOLVING TECHNIQUES. Mr Mohd Hatta Bin Hj Mohamed Ali Computer Programming BFC2042 CHAPTER 2 PROBLEM SOLVING TECHNIQUES Mr Mohd Hatta Bin Hj Mohamed Ali Computer Programming BFC2042 Software Engineering vs Problem Solving Software Engineering - A branch of Computer Science & provides

More information

NESTED IF STATEMENTS AND STRING/INTEGER CONVERSION

NESTED IF STATEMENTS AND STRING/INTEGER CONVERSION LESSON 15 NESTED IF STATEMENTS AND STRING/INTEGER CONVERSION OBJECTIVE Learn to work with multiple criteria if statements in decision making programs as well as how to specify strings versus integers in

More information

Lesson 5C MyClass Methods. By John B. Owen All rights reserved 2011, revised 2014

Lesson 5C MyClass Methods. By John B. Owen All rights reserved 2011, revised 2014 Lesson 5C MyClass Methods By John B. Owen All rights reserved 2011, revised 2014 Table of Contents Objectives Defining your own class Defining and calling a static method Method structure String return

More information

Introduction to Decision Structures. Boolean & If Statements. Different Types of Decisions. Boolean Logic. Relational Operators

Introduction to Decision Structures. Boolean & If Statements. Different Types of Decisions. Boolean Logic. Relational Operators Boolean & If Statements Introduction to Decision Structures Chapter 4 Fall 2015, CSUS Chapter 4.1 Introduction to Decision Structures Different Types of Decisions A decision structure allows a program

More information

STUDENT OUTLINE. Lesson 8: Structured Programming, Control Structures, if-else Statements, Pseudocode

STUDENT OUTLINE. Lesson 8: Structured Programming, Control Structures, if-else Statements, Pseudocode STUDENT OUTLINE Lesson 8: Structured Programming, Control Structures, if- Statements, Pseudocode INTRODUCTION: This lesson is the first of four covering the standard control structures of a high-level

More information

What is Java Script? Writing to The HTML Document. What Can JavaScript do? CMPT 165: Java Script

What is Java Script? Writing to The HTML Document. What Can JavaScript do? CMPT 165: Java Script What is Java Script? CMPT 165: Java Script Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University November 7, 2011 JavaScript was designed to add interactivity to HTML pages

More information

Let's Look Back. We talked about how to create a form in HTML. Forms are one way to interact with users

Let's Look Back. We talked about how to create a form in HTML. Forms are one way to interact with users Introduction to PHP Let's Look Back We talked about how to create a form in HTML Forms are one way to interact with users Users can enter information into forms which can be used by you (programmer) We

More information

New Permit Request Guide

New Permit Request Guide 2016 2017 New Permit Request Guide To start the process you will have to open the facilities rentals online permit bookings system by accessing the following webpage; http://permits.peelschools.org. Sign

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

Concepts Review. 2. A program is the implementation of an algorithm in a particular computer language, like C and C++.

Concepts Review. 2. A program is the implementation of an algorithm in a particular computer language, like C and C++. Concepts Review 1. An algorithm is a sequence of steps to solve a problem. 2. A program is the implementation of an algorithm in a particular computer language, like C and C++. 3. A flowchart is the graphical

More information

Expressions and Variables

Expressions and Variables Expressions and Variables Expressions print(expression) An expression is evaluated to give a value. For example: 2 + 9-6 Evaluates to: 5 Data Types Integers 1, 2, 3, 42, 100, -5 Floating points 2.5, 7.0,

More information

Flow Chart. The diagrammatic representation shows a solution to a given problem.

Flow Chart. The diagrammatic representation shows a solution to a given problem. low Charts low Chart A flowchart is a type of diagram that represents an algorithm or process, showing the steps as various symbols, and their order by connecting them with arrows. he diagrammatic representation

More information

Lesson 5 Cloud Upload

Lesson 5 Cloud Upload Lesson 5 Cloud Upload What you will need CloudProfessor (CPF) Temperature sensor Arduino Leonardo Arduino Shield USB cable Overview In the previous lessons, students learned how to retrieve data from sensors

More information

Exercise 1 Using Boolean variables, incorporating JavaScript code into your HTML webpage and using the document object

Exercise 1 Using Boolean variables, incorporating JavaScript code into your HTML webpage and using the document object CS1046 Lab 5 Timing: This lab should take you approximately 2 hours. Objectives: By the end of this lab you should be able to: Recognize a Boolean variable and identify the two values it can take Calculate

More information

Maxime Defauw. Learning Swift

Maxime Defauw. Learning Swift Maxime Defauw Learning Swift SAMPLE CHAPTERS 1 Introduction Begin at the beginning, the King said, very gravely, and go on till you come to the end: then stop. Lewis Carroll, Alice in Wonderland Hi and

More information

Lab 2 Population. Purpose. Assignment Lab 2 analyzes population growth of a town as well as compare the population growth of two towns.

Lab 2 Population. Purpose. Assignment Lab 2 analyzes population growth of a town as well as compare the population growth of two towns. Lab 2 Population Purpose To assess your ability to apply the knowledge and skills developed up though week 7. Emphasis will be placed on the following learning outcomes: 1. Decompose a problem into modularized

More information

Selection Control Structure CSC128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING

Selection Control Structure CSC128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING Selection Control Structure CSC128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING MULTIPLE SELECTION To solve a problem that has several selection, use either of the following method: Multiple selection nested

More information

JavaScript s role on the Web

JavaScript s role on the Web Chris Panayiotou JavaScript s role on the Web JavaScript Programming Language Developed by Netscape for use in Navigator Web Browsers Purpose make web pages (documents) more dynamic and interactive Change

More information

Python allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid:

Python allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid: 1 STRINGS Objectives: How text data is internally represented as a string Accessing individual characters by a positive or negative index String slices Operations on strings: concatenation, comparison,

More information

Lesson 7: If Statement and Comparison Operators

Lesson 7: If Statement and Comparison Operators JavaScript 101 7-1 Lesson 7: If Statement and Comparison Operators OBJECTIVES: In this lesson you will learn about Branching or conditional satements How to use the comparison operators: ==,!=, < ,

More information

CMSC 201 Spring 2017 Lab 01 Hello World

CMSC 201 Spring 2017 Lab 01 Hello World CMSC 201 Spring 2017 Lab 01 Hello World Assignment: Lab 01 Hello World Due Date: Sunday, February 5th by 8:59:59 PM Value: 10 points At UMBC, our General Lab (GL) system is designed to grant students the

More information

Using System.out.println()

Using System.out.println() Programming Assignments Read instructions carefully Many deduction on Program 3 for items in instructions Comment your code Coding conventions 20% of program grade going forward Class #23: Characters,

More information

Cambridge International Examinations Cambridge Ordinary Level

Cambridge International Examinations Cambridge Ordinary Level Cambridge International Examinations Cambridge Ordinary Level *4357963448* COMPUTER SCIENCE 2210/21 Paper 2 Problem-solving and Programming May/June 2015 1 hour 45 minutes Candidates answer on the Question

More information

Variables and Typing

Variables and Typing Variables and Typing Christopher M. Harden Contents 1 The basic workflow 2 2 Variables 3 2.1 Declaring a variable........................ 3 2.2 Assigning to a variable...................... 4 2.3 Other

More information

IT Introduction to Programming for I.T. Midterm Exam #1 - Prof. Reed Spring 2008

IT Introduction to Programming for I.T. Midterm Exam #1 - Prof. Reed Spring 2008 IT 101 - Introduction to Programming for I.T. Midterm Exam #1 - Prof. Reed Spring 2008 What is your name?: (0 points) There are two sections: I. True/False..................... 20 points; ( 10 questions,

More information

CS 303E Fall 2011 Exam 2 Solutions and Criteria November 2, Good Luck!

CS 303E Fall 2011 Exam 2 Solutions and Criteria November 2, Good Luck! CS 303E Fall 2011 Exam 2 Solutions and Criteria November 2, 2011 Name: EID: Section Number: Friday discussion time (circle one): 9-10 10-11 11-12 12-1 2-3 Friday discussion TA(circle one): Wei Ashley Answer

More information

CS31 Discussion 1E. Jie(Jay) Wang Week3 Oct.12

CS31 Discussion 1E. Jie(Jay) Wang Week3 Oct.12 CS31 Discussion 1E Jie(Jay) Wang Week3 Oct.12 Outline Problems from Project 1 Review of lecture String, char, stream If-else statements Switch statements loops Programming challenge Problems from Project

More information

Administrativia. CS107 Introduction to Computer Science. Readings. Algorithms. Expressing algorithms

Administrativia. CS107 Introduction to Computer Science. Readings. Algorithms. Expressing algorithms CS107 Introduction to Computer Science Lecture 2 An Introduction to Algorithms: and Conditionals Administrativia Lab access Searles 128: Mon-Friday 8-5pm (unless class in progress) and 6-10pm Sat, Sun

More information

Decisions, Decisions. Testing, testing C H A P T E R 7

Decisions, Decisions. Testing, testing C H A P T E R 7 C H A P T E R 7 In the first few chapters, we saw some of the basic building blocks of a program. We can now make a program with input, processing, and output. We can even make our input and output a little

More information

LOOPS. Repetition using the while statement

LOOPS. Repetition using the while statement 1 LOOPS Loops are an extremely useful feature in any programming language. They allow you to direct the computer to execute certain statements more than once. In Python, there are two kinds of loops: while

More information

Algorithm Discovery and Design. Why are Algorithms Important? Representing Algorithms. Chapter 2 Topics: What language to use?

Algorithm Discovery and Design. Why are Algorithms Important? Representing Algorithms. Chapter 2 Topics: What language to use? Algorithm Discovery and Design Chapter 2 Topics: Representing Algorithms Algorithmic Problem Solving CMPUT101 Introduction to Computing (c) Yngvi Bjornsson & Jia You 1 Why are Algorithms Important? If

More information

Pupil Name. Year. Teacher. Target Level. Key Stage 3 Self-Assessment Year 9 Python. Spelling Test No 3. Spelling Test No 2. Spelling Test No 1

Pupil Name. Year. Teacher. Target Level. Key Stage 3 Self-Assessment Year 9 Python. Spelling Test No 3. Spelling Test No 2. Spelling Test No 1 Pupil Name Year Teacher Target Level Spelling Test No 1 Spelling Test No 2 Spelling Test No 3 1) 2) 3) 4) 5) 1) 2) 3) 4) 5) 1) 2) 3) 4) 5) Spelling Test No 4 Spelling Test No 5 Spelling Test No 6 1) 2)

More information

A quick look at the basic functions of the Hercules Programmable Controller by

A quick look at the basic functions of the Hercules Programmable Controller by A quick look at the basic functions of the Hercules Programmable Controller by Basic Manual Operations Recall a Preset Switch a Relay Sweep All Relays Basic Programmable Features Time Events Photocell

More information

CS Introduction to Programming Fall 2016

CS Introduction to Programming Fall 2016 CS 1113-300 Introduction to Programming Fall 2016 Exam 3 Review - Part 2 (Python) Friday, December 2 nd, 2016 Ahmed Ibrahim 1 / 26 Course Evaluation Please take a few minutes to submit your course evaluation

More information

Computer Science 202 Introduction to Programming The College of Saint Rose Fall Topic Notes: Conditional Execution

Computer Science 202 Introduction to Programming The College of Saint Rose Fall Topic Notes: Conditional Execution Computer Science 202 Introduction to Programming The College of Saint Rose Fall 2012 Topic Notes: Conditional Execution All of our programs so far have had one thing in common: they are entirely sequential.

More information

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently.

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently. The Science of Computing I Lesson 4: Introduction to Data Structures Living with Cyber Pillar: Data Structures The need for data structures The algorithms we design to solve problems rarely do so without

More information

Elementary Computing CSC 100. M. Cheng, Computer Science

Elementary Computing CSC 100. M. Cheng, Computer Science Elementary Computing CSC 100 1 Basic Programming Concepts A computer is a kind of universal machine. By using different software, a computer can do different things. A program is a sequence of instructions

More information

CMSC 201 Fall 2016 Lab 09 Advanced Debugging

CMSC 201 Fall 2016 Lab 09 Advanced Debugging CMSC 201 Fall 2016 Lab 09 Advanced Debugging Assignment: Lab 09 Advanced Debugging Due Date: During discussion Value: 10 points Part 1: Introduction to Errors Throughout this semester, we have been working

More information

Fundamentals of Structured Programming

Fundamentals of Structured Programming Fundamentals of Structured Programming Dr. Salma Hamdy s.hamdy@cis.asu.edu.eg 1 Course Logistics Staff Teachers Prof. Mohamed Roushdy (Dean) Dr. Salma Hamdy Contact: s.hamdy@cis.asu.edu.eg Office: FCIS,

More information

A control expression must evaluate to a value that can be interpreted as true or false.

A control expression must evaluate to a value that can be interpreted as true or false. Control Statements Control Expressions A control expression must evaluate to a value that can be interpreted as true or false. How a control statement behaves depends on the value of its control expression.

More information

Logic & Algorithms Foundations of Computer Science Behrouz A. Forouzan, Brooks/Cole Thomson Learning, Pacific Grove, USA, 2003.

Logic & Algorithms Foundations of Computer Science Behrouz A. Forouzan, Brooks/Cole Thomson Learning, Pacific Grove, USA, 2003. OVERVIEW Logic & Algorithms Foundations of Computer Science Behrouz A. Forouzan, Brooks/Cole Thomson Learning, Pacific Grove, USA, 2003. OBJECTIVES After reading this chapter, the reader should be able

More information

King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department

King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department CPCS202, 1 st Term 2016 (Fall 2015) Program 5: FCIT Grade Management System Assigned: Thursday, December

More information

Question 1. Part (a) Simple Syntax [1 mark] Circle add_ints(), because it is missing arguments to the function call. Part (b) Simple Syntax [1 mark]

Question 1. Part (a) Simple Syntax [1 mark] Circle add_ints(), because it is missing arguments to the function call. Part (b) Simple Syntax [1 mark] Note to Students: This file contains sample solutions to the term test together with the marking scheme and comments for each question. Please read the solutions and the marking schemes and comments carefully.

More information

JavaScript 1 Instructions

JavaScript 1 Instructions JavaScript 1 Instructions 1. Intro to lessons 2-10 1.1. use alert to show a message This 1 st lesson contains 5 tasks that give examples JavaScript code you'll learn to read and write in lessons 2-10.

More information

Decisions in Java Nested IF Statements

Decisions in Java Nested IF Statements Several Actions The Nested if Statement Decisions in Java Nested IF Statements We have already explored using the if statement to choose a single action (vs no action), or to choose between two actions.

More information

Chapter 1: Problem Solving Skills Introduction to Programming GENG 200

Chapter 1: Problem Solving Skills Introduction to Programming GENG 200 Chapter 1: Problem Solving Skills Introduction to Programming GENG 200 Spring 2014, Prepared by Ali Abu Odeh 1 Table of Contents Fundamentals of Flowcharts 2 3 Flowchart with Conditions Flowchart with

More information

New Permit Request Guide

New Permit Request Guide 2017 2018 New Permit Request Guide If this is the first time that you using our permit system you will need to register your group you will need to go to http://permits.peelschools.org and in the lower

More information

Computer Programming. Basic Control Flow - Loops. Adapted from C++ for Everyone and Big C++ by Cay Horstmann, John Wiley & Sons

Computer Programming. Basic Control Flow - Loops. Adapted from C++ for Everyone and Big C++ by Cay Horstmann, John Wiley & Sons Computer Programming Basic Control Flow - Loops Adapted from C++ for Everyone and Big C++ by Cay Horstmann, John Wiley & Sons Objectives To learn about the three types of loops: while for do To avoid infinite

More information