Chapter 4 Decisions. Section 4.1 Relational and Logical Operators. 1. Asc("A") is 65. What is Asc("C")? (A) 66 (B) 67 (C) 68 (D) "C" B
|
|
- Magdalene Lang
- 6 years ago
- Views:
Transcription
1 hapter 4 ecisions Section 4.1 Relational and Logical Operators 1. sc("") is 65. What is sc("")? () 66 () 67 () 68 () "" 2. sc("") is 65. What is displayed by txtox.ext = hr(65) & ""? () () () () Not enough information is available. 3. Which of the following expressions has as its value the words "Hello World surrounded by quotation marks? () "Hello World" () hr(34) & "Hello World" () hr(34) & Hello World & hr(34) () hr(34) & "Hello World" & hr(34) 4. Which of the following is true? () "at" = "cat" () "at" < "cat" () "at" > "cat" () Relational operators are only valid for numeric values. 5. Which of the following is a valid Visual asic conditional statement? () 2 < n < 5 () 2 < n Or < 5 () 2 < n Or 5 () (2 < n) Or (n < 5) 6. Which statement is true? () "ord" < "ord" () hevy > hevy () GM <= GM () oldsmobile < Oldsmobile
2 7. Which statement is false? () "ord" >= "ord" () "hevy" <= "chevy" () GM <= GM () Oldsmobile < Oldsmobile 8. he operator nd is a(n) operator. () arithmetic () relational () logical () none of the above 9. he three main logical operators are,, and. () nd, Or, Not () nd, Not, If () Or, Not, If () alse, nd, rue 10. When using the logical operator nd, what part of the expression must be true? () only the left part () only the right par () both parts () either the left or right part, but not both 11. When using the logical operator Or, what part of the expression must be true? () only the left part () only the right part () either the left or right part, but not both () either the left or right part 12. When is the expression Not cond1 true? () when cond1 is false () when cond1 is true () when cond1 is either true or false () None of the above 13. When Visual asic stops evaluating a compound condition with the logical ndlso operator because the first condition evaluates to alse, it is called evaluation? () short-circuit () pre- () compound () first
3 14. Which value for x would make the following condition true: x >= 5 () x is equal to 7 () x is equal to 5 () x is equal to () ll of the above 15. Which value for x would make the following condition true: Not (x >= 5) () x is equal to 7 () x is equal to 4 () x is equal to () ll of the above 16. Which value for x would make the following condition true: (x >= 5) nd (x <= 6) () x is equal to 7 () x is equal to 5 () x is equal to () and 17. "1st Place" < "2nd Place" (/) 18. he second condition in cond1 OrElse cond2 is not evaluated when the first condition is false. (/) 19. compound condition containing the keyword Or will always have the same truth value as the compound condition where Or is replaced with OrElse. (/) 20. he second condition in cond1 ndlso cond2 is not evaluated when the first condition is true. (/) 21. he following two statements are equivalent. (/) Not (a < b) a > b 22. In Visual asic, the letter j is considered to be greater than the letter y. (/) 23. he nd operator requires that both conditions be true for the compound condition to be true. (/)
4 24. If two simple conditions are true, the compound condition created from them by the Or operator is also true. (/) 25. he condition "Y" = "y" is true. (/) 26. If two simple conditions are true, the compound condition created from them by the nd operator is also true. (/) 27. he following condition evaluates to rue. (/) ("OG" > "") nd ("" > "IR") nd ("IR" > "aardvark") 28. ssume that,, and are conditions, with being true, being true, and being false. Give the truth value of ( nd (Not )). alse 29. ssume that,, and are conditions, with being true, being true, and being false. Give the truth value of ( nd Not ( or )). alse 30. ssume that,, and are conditions, with being true, being true, and being false. Give the truth value of (Not ( nd )). alse 31. Is the following condition true or false (assume a = 2, b = 3, and c = 3)? (a = c) Or (b = c) true 32. < and = are examples of relational operators. (/) 33. onditions can involve variables, operators, and functions. (/) 34. wo strings are compared working from left to right, character by character, to determine which one should precede the other. (/) 35. Write a condition to express each of the following: (a) X is strictly between 10 and 10. (X > 10) nd (x < 10) nother answer is Not (X >= 10 Or X <= -10) (b) Exactly one of X and Y is greater than 6. ((X > 6) nd (Y <= 6)) Or ((Y > 6) nd (X <= 6)) nother answer is ((X > 6) Or (Y > 6)) nd Not ((X > 6) nd (Y > 6)) (c) oth X and Y are positive or both X and Y are negative. (X >0 nd Y > 0) Or (X < 0 nd Y <0 ) nother answer is X * Y > 0
5 36. he value of "education".endswith("on") is rue. (/) 37. he value of "education".startswith("e") is rue. (/) 38. he value of IsNumeric("$20.00") is rue. (/) 39. he value of IsNumeric("wenty") is rue. (/) 40. he value of 1 <= n <= 9 is rue if the value of n is between 1 and 9. (/) Section 4.2 If locks 1. onsider the following two sets of code. (a) If (a = 1) nd (b = 1) hen (b) If a = 1 hen txtox.ext = "Hi" If b = 1 hen txtox.ext = "Hi" Which one of the following statements is true? () (a) and (b) will produce different outputs. () (b) is not a valid set of Visual asic instructions. () he two sets of code are equivalent, but (a) is preferred to (b) because (a) is clearer. () he condition statement in (a) is not valid. 2. What will be displayed by the following program when the button is clicked? Private Sub btnisplay_lick(...) Handles btnisplay.lick im a, b, c, x s ouble a = 5 b = 3 c = 6 If a > c hen x = 1 Else If b > c hen x = 2 Else x = 3 txtox.ext = Str(x) End Sub () 1 () 2 () 3 () None of the above
6 3. What will be the output of the following program when the button is clicked? Private Sub btnisplay_lick(...) Handles btnisplay.lick im x, y, z s ouble x = 3 y = 3 If x > y hen z = x + y Else z = y - x txtox.ext = Str(z) End Sub () 6 () 3 () 0 () No output 4. What will be the output of the following program when the button is clicked? Private Sub btnisplay_lick(...) Handles btnisplay.lick im word1, word2, newword s String word1 = "shower" word2 = "about" newword = word1.substring(0, 4) & word2.substring(0, 3) If newword.indexof("how") = -1 hen txtox.ext = "he new word was not found." Else txtox.ext = "ound it." End Sub () he new word was not found. () ound it. () Syntax error () No output 5. What will be the output of the following lines of code? im phrase s String = " penny saved is worth nothing." If phrase.indexof("pen") <> -1 hen txtox.ext = Str(phrase.IndexOf("pen")) Else txtox.ext = Str(-1) () pen () 2 () 0 () penny saved is worth nothing.
7 6. Which of the following is not a logical operator in Visual asic? () Not () nd () Or () hen 7. What will be displayed when the button is clicked? Private Sub btnisplay_lick(...) Handles btnisplay.lick im num s ouble = 9 im sqrroot s ouble If num < 0 hen Messageox.Show("annot find square root. Result set to zero.", "Error") sqrroot = 0 Else sqrroot = Math.Sqrt(Num) txtox.ext = Str(sqrRoot) End Sub () 0 () 3 () 6 () n error will occur. 8. (n) allows a program to decide on a course of action based on whether a certain condition is true or false. () Or block () If block () nd block () Else block 9. onstructs in which an If block is contained inside another If block are called: () multi-if blocks () nested If blocks () sequential If blocks () None of the above
8 10. What word(s) will appear in the list box when the button is clicked? Private Sub btnisplay_lick(...) Handles btnisplay.lick im num s Integer = 5 If num = 2 hen lstox.items.dd("wo") ElseIf num > 3 hen lstox.items.dd("great") ElseIf num = 5 hen lstox.items.dd("equal") End Sub () wo, Great, and Equal () Great and Equal () Great () Equal 11. When an If block has completed execution, the program instruction immediately following the If block is executed. (/) 12. he following lines of code are correct. (/) If (txtge.ext >= 62) hen txtoutput.ext = "You are elegible to collect Social Security." 13. he following lines of code are correct. (/) If age >= 13 nd < 20 hen txtoutput.ext = "You are a teenager." 14. he Else part of an If block may be omitted if no action is associated with it. (/) 15. Given that x = 7, y = 2, and z = 4, the following If block will display "RUE". (/) If (x > y) Or (y > z) hen txtox.ext = "RUE" 16. Given that x = 7, y = 2, and z = 4, the following If block will display "RUE". (/) If (x > y) nd (y > z) hen txtox.ext = "RUE" 17. Every If block must have a hen and an Else. (/) 18. No more than one ElseIf statement may occur in any one If block. (/)
9 19. No more than one Else statement may occur in any one If block. (/) 20. variable declared inside an If block ceases to exist after the block is exited. (/) 21. he following line of code is valid. (/) If letter = ("he quality of mercy is not strained").substring(7, 1) hen 22. he following line of code is valid. (/) If 0 grade 100 hen Section 4.3 Select ase locks 1. Why is the following Select ase block invalid in Visual asic? Select ase myname.substring(0, 1) ase myname < "" txtox.ext = "Your name starts with,, or." End Select () here should not be a standard conditional expression in a value list. () here are not enough ase statements. () here is no selector. () myname.substring(0, 1) is not valid where it is. 2. Suppose that the selector in a Select ase block is the string variable myvar. Which of the following is NO a valid ase clause? () ase "dams" () ase "739" () ase myvar.substring(0, 1) () ase myvar.length
10 3. What will be the output of the following program when the button is clicked? Private Sub btnisplay_lick(...) Handles btnisplay.lick im name s String = "Washington" Select ase name ase "George" txtox.ext = "George" ase "Wash" txtox.ext = "Wash" ase "WSHINGON" txtox.ext = "WSHINGON" ase Else txtox.ext = "Washington" End Select End Sub () WashWashington () Washington () WSHINGONWashington () No output 4. What is the problem (if any) with the following Select ase block which is intended to determine the price of a movie depending on the patron's age? Private Sub btnisplay_lick(...) Handles btnisplay.lick im age as Integer, price s ecimal age = Int(Inputox("Enter your age:")) Select ase age ase Is >= 65 'Senior citizen price = 4.50 ase Is >= 5 'Regular price price = 6.00 ase Is >= 0 'hild (no charge with parents) price = 0 ase Else txtox.ext = "Entry error" End Select End Sub () Everyone will get in free at the child rate. () he output will always be "Entry error." () he ase Is statements have bad syntax. () here is nothing wrong.
11 5. What will be the output of the following program when the button is clicked? Private Sub btnisplay_lick(...) Handles btnisplay.lick im a, b, c, acronym s String a = "federal" b = "aviation" c = "administration" acronym = a.substring(0, 1) & b.substring(0, 1) & c.substring(0, 1) Select ase acronym ase "" txtox.ext = "ederal viation dministration" ase "E" txtox.ext = "rug Enforcement gency" ase Else txtox.ext = "Unknown acronym. Sorry." End Select End Sub () ederal viation dministration () rug Enforcement gency () Syntax error () Unknown acronym. Sorry. 6. In a Select ase block, if more than one ase clause matches the selector, () only the statements associated with the first matching ase clause will be executed. () all of the statements associated with each matching ase clause will be executed. () only the statements associated with the last matching ase clause will be executed. () the program will malfunction and stop. 7. What will be displayed in the list box when the following code runs? Select ase num ase 6, 7, 11 lstox.items.dd("w") ase Is < 7 lstox.items.dd("x") ase Is > 5 lstox.items.dd("y") ase Else lstox.items.dd("z") End Select () Z can never be displayed. () W, X and Y will be displayed if the value of num is 6. () W and Y will be displayed if the value of num is 7. () Z will always be displayed. 8. ifferent items appearing in the same value list of a Select ase block must be separated by a. () semi colon () comma () colon () pair of quotation marks
12 9. Which ase clause will be true whenever the value of the selector in a Select ase block is between 1 and 5 or is 8? () ase 1 o 8 () ase 1 o 5, 8 () ase 1 o 8, 5 () ase 1 o 5; Which ase clause will be true whenever the value of the selector in a Select ase block is greater than or equal to 7? () ase Is >7 () ase Is = 8 () ase Is >= 7 () ase Is <= What type of items are valid for use in the value list of a ase clause? () literals () variables () expressions () ll of the above 12. he ase Else part of a Select ase block is optional. (/) 13. One may use an If block within a Select ase block. (/) 14. One may use a Select ase block within an If block. (/) 15. Every Select ase block can be replaced by If blocks. (/) 16. One may use a Select ase block within another Select ase block. (/) 17. Select ase choices are determined by the value of an expression called a selector. (/) 18. Items in the value list must evaluate to a literal of the same type as the selector. (/) 19. single ase statement can contain multiple values. (/) 20. You can specify a range of values in a ase clause by using the o keyword. (/)
13 21. variable declared inside a Select ase block cannot be referred to by code outside of the block. (/) Section 4.4 Input via User Selection 1. t design time, values can be placed into a list box via the. () String Editor () String ollection Editor () ollection Editor () Items Editor 2. collection of related radio buttons is usually placed in a. () List box () ext box () ollection Editor () Group box 3. What property gives the value of the index of an item selected in a list box. () Selection () SeletedItem () Index () SelectedIndex 4. he default event procedure for a list box is. () SelectedIndexhanged () lick () heckedhanged () Indexhanged 5. he default event procedure for a check box is. () SelectedIndexhanged () lick () heckedhanged () hecked 6. If the value of lstox.selectedindex is 0, then an item in the list box has been selected. (/) 7. licking on a selected radio button deselects the radio button. (/) 8. he index of the first item in a list box is 1. (/)
14 9. licking on a checked check box unchecks the check box. (/) 10. Which of the following statements selects the radio button radutton? () radutton = rue () radutton.on = rue () radutton.hecked = rue () radutton.selected = rue 11. Which of the following is not commonly used to allow the user to select among several options? () a collection of radio buttons () a collection of check boxes () a list box () a collection of text boxes 12.. he value of lstox.ext is the currently selected item of the list box. (/) 13.. When a check box is empty, the value of its Selected property is alse. (/) 14. Which of the following techniques does NO always toggle the checked and unchecked state of a check box control? () lick on the square or its caption with the mouse. () Press the spacebar when the square has the focus. () Press lt+ccess key (if an access key has been specified). () Set the hecked property equal to Which of the following techniques always toggles the "on" and "off" states of a radio button control? () lick on the circle or its caption with the mouse. () Press the spacebar when the circle has the focus. () Press on another radio button in the same group box. () Set the hecked property equal to rue. (E) None of the above E 16. What is the key difference between a group of check boxes attached to a group box and a group of radio buttons attached to a group box? () Only radio buttons can be toggled. () Only one radio button at a time can be checked. () heck boxes cannot be attached to a group box. () he only difference is the shape of the control.
15 13. When a check box is checked, the value of the hecked property will be () rue. () alse. () 1. () he title (as seen by the user) for the group box control is set by which one of the following properties? () ext () Name () ag () nchor 15. When the user clicks on a check box control at run time, which one of the following events is raised (in addition to the lick event)? () ontroldded () Invalidated () Stylehanged () heckedhanged 16. check box control named chkirst contains the following code in its heckedhanged event procedure. Which of the following is true concerning the use of this control? im message s String = "hello" Messageox.Show(message) () he message "hello" will appear when the user checks the control but not when it is unchecked. () he message "hello" will appear when the user unchecks the control but not when it is checked. () he message "hello" will appear when the user checks the control and again when it is unchecked. () he message "hello" will not appear using this code. 17. Suppose there are four radio button controls attached to a group box control on a form. How many radio buttons can be selected (that is, be on ) at any given time? () 2 () 1 () 3 () 4
16 18. radio button named radutton is placed on a form, and the statement Messageox.Show(radutton.hecked) is placed in its heckedhanged event procedure. t run time, what result will be displayed in the message box when the user clicks on radutton? () 1 () rue () 2 () alse 19. fter several controls of the same type have been created, they can be moved inside a group box and thereby become attached to it. (/) 20. With a check box control, toggling the state of the small square raises the heckhanged event. (/) 21. Group boxes are passive objects used to group related sets of controls. (/) 22. Programmers frequently write event procedures for the group box control. (/) 23. If you set a group box control s Visible property to alse, the attached controls will still remain visible. (/) 24. When a check box control has the focus, the spacebar can be used to invoke its heckedhanged event. (/) 25. s with the button and check box controls, an access key can be set up by placing an ampersand in front of a letter in the radio button s ext property setting. (/) 26. Suppose a form contains two group box controls with one radio button placed on each. In this case, both radio buttons can be selected (or turned on ) at the same time. (/)
Chapter 6 Repetition
hapter 6 Repetition Section 6.1 o Loops 1. What is wrong with the following o loop? im index As Integer = 1 o While index 9 lstbox.items.add("hello") index += 1 Loop (A) he test variable should not
More informationVisual Basic.NET. 1. Which language is not a true object-oriented programming language?
Visual Basic.NET Objective Type Questions 1. Which language is not a true object-oriented programming language? a.) VB.NET b.) VB 6 c.) C++ d.) Java Answer: b 2. A GUI: a.) uses buttons, menus, and icons.
More informationMicrosoft Visual Basic 2005: Reloaded
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 4 Making Decisions in a Program Objectives After studying this chapter, you should be able to: Include the selection structure in pseudocode
More informationIntroduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4.
Introduction to Visual Basic and Visual C++ Arithmetic Expression Lesson 4 Calculation I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Arithmetic Expression Using Arithmetic Expression Calculations
More informationReview for Exam 2. IF Blocks. Nested IF Blocks. School of Business Eastern Illinois University. Represent computers abilities to make decisions
School of Business Eastern Illinois University Review for Exam 2 - IF Blocks - Do s - Select Case Blocks (Week 10, Friday 3/21/2003) Abdou Illia, Spring 2003 IF Blocks 2 Represent computers abilities to
More informationOverview: 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 informationOverview: 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 informationSelection 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 informationOverview About KBasic
Overview About KBasic The following chapter has been used from Wikipedia entry about BASIC and is licensed under the GNU Free Documentation License. Table of Contents Object-Oriented...2 Event-Driven...2
More informationCOP 2000 Introduction to Computer Programming Mid-Term Exam Review
he exam format will be different from the online quizzes. It will be written on the test paper with questions similar to those shown on the following pages. he exam will be closed book, but students can
More informationControl 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 informationTopics. 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 informationProgramming 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 informationCS115 - Module 3 - Booleans, Conditionals, and Symbols
Fall 2017 Reminder: if you have not already, ensure you: Read How to Design Programs, sections 4-5 Booleans (Bool) , and = are new functions, each of which produces a boolean value (Bool). (< 4 6)
More informationConditional 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 informationChapter 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 informationChapter 9: Dealing with Errors
Chapter 9: Dealing with Errors What we will learn: How to identify errors Categorising different types of error How to fix different errors Example of errors What you need to know before: Writing simple
More informationLecture 05 I/O statements Printf, Scanf Simple statements, Compound statements
Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 05 I/O statements Printf, Scanf Simple
More informationLaboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++
Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ 0.1 Introduction This is a session to familiarize working with the Visual Studio development environment. It
More informationLearning Language. Reference Manual. George Liao (gkl2104) Joseanibal Colon Ramos (jc2373) Stephen Robinson (sar2120) Huabiao Xu(hx2104)
Learning Language Reference Manual 1 George Liao (gkl2104) Joseanibal Colon Ramos (jc2373) Stephen Robinson (sar2120) Huabiao Xu(hx2104) A. Introduction Learning Language is a programming language designed
More informationControl Structures. CIS 118 Intro to LINUX
Control Structures CIS 118 Intro to LINUX Basic Control Structures TEST The test utility, has many formats for evaluating expressions. For example, when given three arguments, will return the value true
More informationIntroduction to Typed Racket. The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples
Introduction to Typed Racket The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples Getting started Find a machine with DrRacket installed (e.g. the
More informationPetros: A Multi-purpose Text File Manipulation Language
Petros: A Multi-purpose Text File Manipulation Language Language Reference Manual Joseph Sherrick js2778@columbia.edu June 20, 2008 Table of Contents 1 Introduction...................................................
More informationA 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 informationChapter 4 The If Then Statement
The If Then Statement Conditional control structure, also called a decision structure Executes a set of statements when a condition is true The condition is a Boolean expression For example, the statement
More informationSkill Area 306: Develop and Implement Computer Program
Add your company slogan Skill Area 306: Develop and Implement Computer Program Computer Programming (YPG) LOGO Skill Area 306.2: Produce Structured Program 306.2.1 Write Algorithm 306.2.2 Apply appropriate
More informationAn overview about DroidBasic For Android
An overview about DroidBasic For Android from February 25, 2013 Contents An overview about DroidBasic For Android...1 Object-Oriented...2 Event-Driven...2 DroidBasic Framework...2 The Integrated Development
More informationChapter 2 Visual Basic, Controls, and Events
hapter 2 Visual asic, ontrols, and Events Section 2.1 n Introduction to Visual asic 2015 1. Programming in V 2015 is different from traditional programming environments because first you should () write
More informationMicrosoft Visual Basic 2015: Reloaded
Microsoft Visual Basic 2015: Reloaded Sixth Edition Chapter Three Memory Locations and Calculations Objectives After studying this chapter, you should be able to: Declare variables and named constants
More informationRelational Operators. > greater than < less than >= greater than or equal to <= less than or equal to <> not equal to = equal to
Relational Operators > greater than < less than >= greater than or equal to
More information3 The L oop Control Structure
3 The L oop Control Structure Loops The while Loop Tips and Traps More Operators The for Loop Nesting of Loops Multiple Initialisations in the for Loop The Odd Loop The break Statement The continue Statement
More informationSyntax errors are produced when verifying an EasyLanguage statement that is not
Building Winning Trading Systems with Trade Station, Second Edition By George Pruitt and John R. Hill Copyright 2012 by George Pruitt and John R EasyLanguage Syntax Errors Syntax errors are produced when
More information(iv) The square root of an integer is a rational number. (viii) There is an infinite number of natural numbers.
A statement is a sentence that is either always true or always false. Examples 2 ` 2 4. Suppose x 2 2. henx is not an integer. All cats are gray. I have a gray cat. Non-examples x is an odd number. Let
More informationDATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Database Program: Microsoft Access Series DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) AGENDA 3. Executing VBA
More informationCONTROL FLOW CREATING ALTERNATE PATHS OF EXECUTION USING: BRANCHING WHILE LOOPS FOR LOOPS
CONROL LOW CREAING ALERNAE PAHS O EXECUION USING: BRANCHING WHILE LOOPS OR LOOPS CREAING ALERNAE PAHS O EXECUION Up until now our programs are sequential and execute all lines of code from top to bottom.
More informationChapter 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 informationJava+- Language Reference Manual
Fall 2016 COMS4115 Programming Languages & Translators Java+- Language Reference Manual Authors Ashley Daguanno (ad3079) - Manager Anna Wen (aw2802) - Tester Tin Nilar Hlaing (th2520) - Systems Architect
More informationDecision Structures. Selection. Selection options (in Java) Plain if s (3 variations) Each action could be any of: if else (3 variations)
Decision Structures if, if/ conditions Selection DECISION: determine which of 2 paths to follow (1+ statements in each path) CS1110 - Kaminski (ELSE path optional) 2 Selection options (in Java) Plain if
More informationCPE Summer 2015 Exam I (150 pts) June 18, 2015
Name Closed notes and book. If you have any questions ask them. Write clearly and make sure the case of a letter is clear (where applicable) since C++ is case sensitive. You can assume that there is one
More informationChapter 8 Text Files
Chapter 8 ext iles Section 8.1 Managing ext iles 1. What method is used to copy the contents of a string array or LINQ query into a text file? () Createextile () WritellLines (C) Copyoextile () ReadllLines
More informationUnit E Step-by-Step: Programming with Python
Unit E Step-by-Step: Programming with Python Computer Concepts 2016 ENHANCED EDITION 1 Unit Contents Section A: Hello World! Python Style Section B: The Wacky Word Game Section C: Build Your Own Calculator
More informationLanguage Reference Manual
ALACS Language Reference Manual Manager: Gabriel Lopez (gal2129) Language Guru: Gabriel Kramer-Garcia (glk2110) System Architect: Candace Johnson (crj2121) Tester: Terence Jacobs (tj2316) Table of Contents
More informationDAVE. Language Reference Manual. Hyun Seung Hong. October 26, 2015
DAVE Language Reference Manual Hyun Seung Hong Min Woo Kim Fan Yang Chen Yu hh2473 mk3351 fy2207 cy2415 Contents October 26, 2015 1 Introduction 3 2 Lexical Conventions 3 2.1 Character Set 3 2.2 Comment
More informationConcepts 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 informationSelections. 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 informationEqualsEquals Language Reference Manual
EqualsEquals Language Reference Manual name email role UNI Nam Nhat Hoang nam.hoang@columbia.edu System Architect nnh2110 Tianci Zhong tz2278@columbia.edu Manager tz2278 Ruicong Xie rx2119@columbia.edu
More informationSPARK-PL: Introduction
Alexey Solovyev Abstract All basic elements of SPARK-PL are introduced. Table of Contents 1. Introduction to SPARK-PL... 1 2. Alphabet of SPARK-PL... 3 3. Types and variables... 3 4. SPARK-PL basic commands...
More informationComputer 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 informationAccess Intermediate
Access 2010 - Intermediate (103-134) Building Access Databases Notes Quick Links Building Databases Pages AC52 AC56 AC91 AC93 Building Access Tables Pages AC59 AC67 Field Types Pages AC54 AC56 AC267 AC270
More informationCS 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 informationObjectives. 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 information8. Control statements
8. Control statements A simple C++ statement is each of the individual instructions of a program, like the variable declarations and expressions seen in previous sections. They always end with a semicolon
More informationIntroduction to Computer Programming for Non-Majors
Introduction to Computer Programming for Non-Majors CSC 2301, Fall 2016 Chapter 7 Part 2 Instructor: Long Ma The Department of Computer Science Quick review one-way or simple decision if :
More informationCS115 - Module 4 - Compound data: structures
Fall 2017 Reminder: if you have not already, ensure you: Read How to Design Programs, sections 6-7, omitting 6.2, 6.6, 6.7, and 7.4. Compound data It often comes up that we wish to join several pieces
More informationegrapher Language Reference Manual
egrapher Language Reference Manual Long Long: ll3078@columbia.edu Xinli Jia: xj2191@columbia.edu Jiefu Ying: jy2799@columbia.edu Linnan Wang: lw2645@columbia.edu Darren Chen: dsc2155@columbia.edu 1. Introduction
More informationControl Structures. Control Structures Conditional Statements COMPUTER PROGRAMMING. Electrical-Electronics Engineering Dept.
EEE-117 COMPUTER PROGRAMMING Control Structures Conditional Statements Today s s Objectives Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical
More informationA First Look at ML. Chapter Five Modern Programming Languages, 2nd ed. 1
A First Look at ML Chapter Five Modern Programming Languages, 2nd ed. 1 ML Meta Language One of the more popular functional languages (which, admittedly, isn t saying much) Edinburgh, 1974, Robin Milner
More informationChapter 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 informationOutline. Parser overview Context-free grammars (CFG s) Derivations Syntax-Directed Translation
Outline Introduction to Parsing (adapted from CS 164 at Berkeley) Parser overview Context-free grammars (CFG s) Derivations Syntax-Directed ranslation he Functionality of the Parser Input: sequence of
More informationChapter 4 - Notes Control Structures I (Selection)
Chapter 4 - Notes Control Structures I (Selection) I. Control Structures A. Three Ways to Process a Program 1. In Sequence: Starts at the beginning and follows the statements in order 2. Selectively (by
More information\n is used in a string to indicate the newline character. An expression produces data. The simplest expression
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationOBJECT ORIENTED SIMULATION LANGUAGE. OOSimL Reference Manual - Part 1
OBJECT ORIENTED SIMULATION LANGUAGE OOSimL Reference Manual - Part 1 Technical Report TR-CSIS-OOPsimL-1 José M. Garrido Department of Computer Science Updated November 2014 College of Computing and Software
More information3 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 informationLanguage Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */
Overview Language Basics This chapter describes the basic elements of Rexx. It discusses the simple components that make up the language. These include script structure, elements of the language, operators,
More information7 Control Structures, Logical Statements
7 Control Structures, Logical Statements 7.1 Logical Statements 1. Logical (true or false) statements comparing scalars or matrices can be evaluated in MATLAB. Two matrices of the same size may be compared,
More informationC++ PROGRAMMING. For Industrial And Electrical Engineering Instructor: Ruba A. Salamh
C++ PROGRAMMING For Industrial And Electrical Engineering Instructor: Ruba A. Salamh CHAPTER TWO: Fundamental Data Types Chapter Goals In this chapter, you will learn how to work with numbers and text,
More informationGeoCode Language Reference Manual
GeoCode Language Reference Manual Contents 1 Introduction... 3 2 Lexical Elements... 3 2.1 Identifiers... 3 2.2 Keywords... 3 2.3 Literals... 3 2.4 Line Structure... 4 2.5 Indentation... 4 2.6 Whitespace...
More informationCCBC Math 081 Order of Operations Section 1.7. Step 2: Exponents and Roots Simplify any numbers being raised to a power and any numbers under the
CCBC Math 081 Order of Operations 1.7 1.7 Order of Operations Now you know how to perform all the operations addition, subtraction, multiplication, division, exponents, and roots. But what if we have a
More informationWelcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 8/19/ Review. Here s a simple C++ program:
Welcome Back CSCI 262 Data Structures 2 - Review What you learned in CSCI 261 (or equivalent): Variables Types Arrays Expressions Conditionals Branches & Loops Functions Recursion Classes & Objects Streams
More informationJava Coding 2. Decisions, decisions!
Java Coding 2 Decisions, decisions! The if Statement An if statement is like a fork in the road. Depending upon a decision, different parts of the program are executed. The if Statement The if statement
More informationCS 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 informationIntro 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 informationCPE 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 informationWelcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 1/9/ Review. Here s a simple C++ program:
Welcome Back CSCI 262 Data Structures 2 - Review What you learned in CSCI 261 (or equivalent): Variables Types Arrays Expressions Conditionals Branches & Loops Functions Recursion Classes & Objects Streams
More informationModule 3: New types of data
Module 3: New types of data Readings: Sections 4 and 5 of HtDP. A Racket program applies functions to values to compute new values. These new values may in turn be supplied as arguments to other functions.
More informationStatements and Operators
Statements and Operators Old Content - visit altium.com/documentation Mod ifi ed by Rob Eva ns on Feb 15, 201 7 Parent page: EnableBasic Enable Basic Statements Do...Loop Conditional statement that repeats
More information5. Control Statements
5. Control Statements This section of the course will introduce you to the major control statements in C++. These control statements are used to specify the branching in an algorithm/recipe. Control statements
More informationFlow Control. CSC215 Lecture
Flow Control CSC215 Lecture Outline Blocks and compound statements Conditional statements if - statement if-else - statement switch - statement? : opertator Nested conditional statements Repetitive statements
More informationSlide 1 CS 170 Java Programming 1 The Switch Duration: 00:00:46 Advance mode: Auto
CS 170 Java Programming 1 The Switch Slide 1 CS 170 Java Programming 1 The Switch Duration: 00:00:46 Menu-Style Code With ladder-style if-else else-if, you might sometimes find yourself writing menu-style
More informationCS50 Supersection (for those less comfortable)
CS50 Supersection (for those less comfortable) Friday, September 8, 2017 3 4pm, Science Center C Maria Zlatkova, Doug Lloyd Today s Topics Setting up CS50 IDE Variables and Data Types Conditions Boolean
More informationMore Scripting Techniques Scripting Process Example Script
More Scripting Techniques Scripting Process Example Script 1 arguments to scripts positional parameters input using read exit status test program, also known as [ if statements error messages 2 case statement
More informationRepetition Algorithms
Repetition Algorithms Repetition Allows a program to execute a set of instructions over and over. The term loop is a synonym for a repetition statement. A Repetition Example Suppose that you have been
More informationCOSC 123 Computer Creativity. Java Decisions and Loops. Dr. Ramon Lawrence University of British Columbia Okanagan
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/else
More informationName SECTION: 12:45 2:20. True or False (12 Points)
Name SECION: 12:45 2:20 rue or False (12 Points) 1. (12 pts) Circle for true and F for false: F a) Local identifiers have name precedence over global identifiers of the same name. F b) Local variables
More informationCSE : Python Programming. Homework 5 and Projects. Announcements. Course project: Overview. Course Project: Grading criteria
CSE 399-004: Python Programming Lecture 5: Course project and Exceptions February 12, 2007 Announcements Still working on grading Homeworks 3 and 4 (and 2 ) Homework 5 will be out by tomorrow morning I
More informationCS 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 informationCSCI 1226 A Test #1. Wednesday, 10 October, 2018 Name: Student #: General Instructions Read and follow all directions carefully.
General Instructions Read and follow all directions carefully. CSCI 1226 A Test #1 Wednesday, 10 October, 2018 Name: Student #: When writing programs or program segments, use the conventions used in the
More informationMaking Decisions In Pascal
Making Decisions In Pascal In this section of notes you will learn how to have your Pascal programs choose between alternative courses of action High Level View Of Decision Making For The Computer Is income
More informationVISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0. L J Howell UX Software Ver. 1.0
VISUAL GUIDE to RX Scripting for Roulette Xtreme - System Designer 2.0 L J Howell UX Software 2009 Ver. 1.0 TABLE OF CONTENTS INTRODUCTION...ii What is this book about?... iii How to use this book... iii
More informationChapter 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 informationExpressions 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 informationMirage. Language Reference Manual. Image drawn using Mirage 1.1. Columbia University COMS W4115 Programming Languages and Translators Fall 2006
Mirage Language Reference Manual Image drawn using Mirage 1.1 Columbia University COMS W4115 Programming Languages and Translators Fall 2006 Prof. Stephen Edwards Team Members: Abhilash I ai2160@columbia.edu
More informationChapter 3 Problem Solving and the Computer
Chapter 3 Problem Solving and the Computer An algorithm is a step-by-step operations that the CPU must execute in order to solve a problem, or to perform that task. A program is the specification of an
More informationLecture 2 FORTRAN Basics. Lubna Ahmed
Lecture 2 FORTRAN Basics Lubna Ahmed 1 Fortran basics Data types Constants Variables Identifiers Arithmetic expression Intrinsic functions Input-output 2 Program layout PROGRAM program name IMPLICIT NONE
More informationMicrosoft Office Excel Use Excel s functions. Tutorial 2 Working With Formulas and Functions
Microsoft Office Excel 2003 Tutorial 2 Working With Formulas and Functions 1 Use Excel s functions You can easily calculate the sum of a large number of cells by using a function. A function is a predefined,
More informationSelections. CSE 114, Computer Science 1 Stony Brook University
Selections CSE 114, Computer Science 1 Stony Brook University http://www.cs.stonybrook.edu/~cse114 1 Motivation If you assigned a negative value for radius in ComputeArea.java, then you don't want the
More informationIEEE Floating-Point Representation 1
IEEE Floating-Point Representation 1 x = ( 1) s M 2 E The sign s determines whether the number is negative (s = 1) or positive (s = 0). The significand M is a fractional binary number that ranges either
More informationMotivating 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 informationFeatures of C. Portable Procedural / Modular Structured Language Statically typed Middle level language
1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC
More informationThe Logical Design of the Tokeniser
Page 1 of 21 The Logical Design of the Tokeniser Purpose 1. To split up a character string holding a RAQUEL statement expressed in linear text, into a sequence of character strings (called word tokens),
More information