Chapter 7. Arrays and Collections. Instructor s Manual Table of Contents. At a Glance. Chapter Overview. Chapter Objectives.

Save this PDF as:
 WORD  PNG  TXT  JPG

Size: px
Start display at page:

Download "Chapter 7. Arrays and Collections. Instructor s Manual Table of Contents. At a Glance. Chapter Overview. Chapter Objectives."

Transcription

1 C# Programming: From Problem Analysis to Program Design, 2nd ed. 7-1 Chapter 7 Arrays and Collections At a Glance Instructor s Manual Table of Contents Chapter Overview Chapter Objectives Instructor Notes zes Discussion Questions Projects to Assign Key Terms

2 C# Programming: From Problem Analysis to Program Design, 2nd ed. 7-2 Lecture Notes Chapter Overview In this chapter, students are introduced to one type of collection, called an array, which is similar to a vector in mathematics or cells in a spreadsheet, in that each entry can be referenced by the location of the item in the collection. Both single and multidimensional arrays are created. Students learn how to access single values and iterate through collections to process all the values. Students are introduced to members of the ArrayList class for creating collections that can grow and shrink and learn about special properties and methods of this class and the.net Array class. Additional programming using strings and their predefined methods for accessing and modifying collections of character data items is included in this chapter. Chapter Objectives In this chapter, students will: Learn array basics Declare arrays and perform compile-time initialization of array elements Access elements of an array Become familiar with methods of the Array class Write methods that use arrays as parameters Write classes that include arrays as members and instantiate user-defined array objects Create two-dimensional arrays including rectangular and jagged types Use multidimensional arrays Use the ArrayList class to create dynamic lists Learn about the predefined methods of the string class Be introduced the other collection classes Work through a programming example that illustrates the chapter s concepts Instructor Notes ARRAY BASICS An array is a data structure that may contain any number of variables of the same type. The elements are referenced by the same name and accessed through an index. The index references the element by its location relative to the first element in the array. All arrays are objects of the base type, Array class (System.Array). The Array class includes a number of built-in methods and properties that add functionality for creating, manipulating, searching, and sorting arrays.

3 C# Programming: From Problem Analysis to Program Design, 2nd ed True or False: The first element of an array is referenced by index Arrays from all of the.net languages inherit from the class. Answer: System.Array 3. Elements in arrays must be of the same. Answer: data type 4. True or False: The elements in an array are referenced by the same identifier. ARRAY DECLARATION Create an array the same way you instantiate an object of a user-defined class: by using the new keyword at the time of declaration. Specify during declaration the number of individual elements for the array. The format for creating an array is: type [ ] identifier = new type [integral value]; All data values placed in an array must be of the same base type. The integral value is used to specify the number of elements, which is the length or size of the array. Arrays are zero based, meaning the first element is indexed by zero. The last element of all arrays is always referenced by an index with a value of the length of the array minus one. You can declare an array without instantiating it. The general form is: type [ ] identifier; A separate step is required when you declare it this way. You must instantiate the array by indicating how many elements to allocate. This is sometimes referred to as dimensioning the array. The general form is: identifier = new type [integral value]; When you declare an array, the array identifier is normally defined using a singular noun. This is because you access individual elements in the array usually as opposed to using the data structure as a grouped collection. Array Initializers You can initialize the elements of an array during declaration. The general form is: type[ ] identifier = new type[ ] {value1, value2,...valuen}; Alternatively, a shortcut to specifying the size and at the same time placing values in the array is: type [ ] identifier = {value1, value2,...valuen};

4 C# Programming: From Problem Analysis to Program Design, 2nd ed The number of memory locations set up for anarray with the following declaration is: int [ ] anarray = new { 2, 3, 4, 5, 10}; Answer: 5 2. True or False: You can initialize the memory location of the array at the same time that you declare the array. 3. True or False: You must use the new keyword if you want to declare an array. 4. Why do you use singular nouns for array identifiers? Answer: Instead of accessing the array as a single structure, you normally reference the individual elements of the array, one element at a time. ARRAY ACCESS To access an array element, you must specify which element is to be accessed by suffixing the identifier with an index enclosed in square brackets. C# always performs bounds checking on array indexes. Some languages let you store or access values outside the originally declared legal bounds of the array. You cannot do this in C#. Sentinel-Controlled Access If you do not know how many elements will be stored in an array, you can create the array large enough to hold any number of entries. Then tell users to enter a predetermined sentinel value after they enter the last value. If you use this approach, you need to increment a counter, as values are entered so that you know how many elements are stored in your array. You cannot use the Length property because it returns whatever the array is dimensioned to hold. Using Foreach with Arrays The foreach loop can be used to iterate through an array. However, it can be used for readonly access to the elements. The general form is: foreach (type identifier in expression) statement; The identifier is the iteration variable and it represents a different array element with each loop iteration. The type used in the foreach expression should match the array type. The expression is the name of the array.

5 C# Programming: From Problem Analysis to Program Design, 2nd ed True or False: You should prime the read when you use a sentinel-controlled loop with an array. 2. True or False: The foreach statement can be used with an array to access and change the elements. 3. True or False: The Length property returns the number of values currently stored in the array. 4. How would you add 100 to the third physical element of an array named anarray? Answer: anarray[2] += 100; ARRAY CLASS All arrays, of any type, inherit characteristics from the Array class, which includes a number of predefined methods and properties. Review Table 7-1 for a list of the properties and methods. A number of the methods are class methods. To call a class method, you prefix the method name with the class name. 1. Which method in the Array class enables you to perform a search for a value in an array? Answer: BinarySearch( ) 2. True or False: The Reverse( ) method is a class method that reverses the order of elements in the array. 3. The base class of all arrays is named. Answer: Array 4. What is required in order to use a class method? Answer: You must precede the method with the class name. For example, to use class methods of the Array class, calls to methods must be preceded by Array (i.e. Array.Reverse(someArrayName)).

6 C# Programming: From Problem Analysis to Program Design, 2nd ed. 7-6 ARRAYS AS METHOD PARAMETERS You can write your own methods and send arrays as arguments. In order to identify that an array is the parameter, you write the array identifier name and type inside the parentheses in the parameter heading. However, the length or size of the array is not included. Open and closed square brackets are required to indicate that the parameter is an array. Pass by Reference Arrays are reference variables. The memory location does not actually contain the values, but rather an address indicating the location of the first element in the array. You pass a reference to the address of the array elements when you use an array as an argument to a method. It is important to understand that if the method changes one or more of the elements, the changes are made to the actual data. The actual call to the method expecting an array as an argument simply includes the identifier. There are no square brackets. It is the address of the first element that is sent. Array Assignment The assignment operator = may not work as you would think it should. Individual elements are not copied to another memory location. Rather, after the assignment is made, the two array identifiers reference the same address in memory. Params Parameters When used in the heading of a method, it indicates that the number of arguments to the method may vary. The keyword params appears only in the formal parameter list. A variable number of arguments are accepted when params is included. It makes the method very flexible. 1. Arrays are pass by by default? Answer: reference 2. True or False: In order to call a method that expects an array as an argument, include the array name and an empty set of square brackets in the call statement. 3. True or False: One way to make a duplicate of all the elements in the array is to use the assignment operator. 4. When should the params keyword be used in the heading for a method? Answer: When the number of arguments to the method vary

7 C# Programming: From Problem Analysis to Program Design, 2nd ed. 7-7 ARRAYS IN CLASSES Arrays can be used as fields or instance variables in classes. Normally, the base type is declared with the other instance variable. But, space is allocated when an object of that class is instantiated. Once an object of the class has been constructed, you can call its methods or reference any of its public data fields. You can use parallel arrays in the class declaration. Parallel arrays are two or more arrays that have a relationship. Array of User-Defined Objects Just as you can create arrays of predefined types, such as int, you can create arrays of userdefined objects by instantiating the class. Arrays as Return Types Arrays can be sent to methods as arguments, and methods can have arrays as their return types as well. Recall that a method can return a single type, but the single type can be an array type. Array objects and string types contain a reference to the location of the stored values. 1. True or False: You can declare an array as a data member to a user-defined class. 2. True or False: You can return an array of 1,000 elements back from a value returning method. 3. True or False: One way to make a duplicate of all the elements in the array is to use the assignment operator. 4. If you are going to define an array as a data member in a class, define base type as an array. But, allocate space when an object of that class is. Answer: instantiated TWO-DIMENSIONAL ARRAYS Two-dimensional and other multidimensional arrays follow the same guidelines you learned with one-dimensional arrays. Two kinds of two-dimensional arrays are rectangular and jagged or ragged arrays. Two-dimensional arrays are referenced much like you reference a matrix.

8 C# Programming: From Problem Analysis to Program Design, 2nd ed. 7-8 Rectangular Array A rectangular two-dimensional array is usually visualized as a table divided into rows and columns, much like a spreadsheet. The form is: type [, ] identifier = new type [integral value, integral value]; You can perform compile-time initialization of the elements and store the data in contiguous memory locations by row. Each row is grouped using curly braces. A comma is used to separate rows. A number of useful members of the Array class. GetLength( ) method can be called to return the number of rows or columns. The property Rank returns the number of dimensions of the array. The foreach loop structure can be used to iterate through a two-dimensional array. Jagged Array When the number of columns in the rows must differ, a jagged, or ragged, array can be created. One row might have five columns; another row 50 columns. To create a jagged array, you can create a one-dimensional array of type Array and initialize each of the one-dimensional arrays separately. The GetLength( ), GetUpperBound( ), and GetLowerBound( ) methods can be used with jagged arrays. 1. What are the two types of two-dimensional arrays that can be created in C#? Answer: Rectangular and jagged 2. True or False: The GetLength( ) method returns the number of rows multiplied by the number of columns. 3. True or False: With a jagged array, one row may have three columns while another row may have 10 columns. 4. Two-dimensional arrays are referenced much like you reference a. Answer: matrix MULTIDIMENSIONAL ARRAYS Multidimensional arrays are only limited by your imagination as far as the number of dimensions for which you can allocate arrays in C#. All data values placed in an array must be of the same base type. A two-dimensional array is actually a multidimensional array; however, it is such a common type of structure that it often is put in its own category. To declare a threedimensional array, three integral values are used. They specify the number of planes, rows, and columns to set aside for the array. The form is: type [,, ] identifier = new type [integral value, integral value, integral value];

9 C# Programming: From Problem Analysis to Program Design, 2nd ed. 7-9 GetLength(2) returns the length of the third dimension, or rank. This references the number of columns. GetLength(1) returns the dimension for the number of rows per plane. GetLength(0) returns the dimension for the number of planes. 1. How can you retrieve the number of rows in a three-dimensional array? Answer: By using the GetLength(1) method 2. True or False: You can define up to six dimensions for an array. 3. True or False: A two-dimensional array is a multidimensional array. 4. In order to define a four-dimensional array, how many commas would appear in the declaration inside the square bracket? Answer: Three ARRAYLIST CLASS The ArrayList class enables you to create a listlike structure that can dynamically increase or decrease in length. Indexes of ArrayList objects are zero based. Table 7-2 lists some of the predefined methods and properties. Like a vector found in other languages, you can push and pop a member on/off it. 1. What property in the ArrayList class enables you to get the maximum number of elements that the array can contain? Answer: Capacity 2. True or False: An array can increase in sizes once it is dimensioned. 3. True or False: You can reference individual elements in an ArrayList using an index. 4. The ArrayList is much like a found in other languages. Answer: vector

10 C# Programming: From Problem Analysis to Program Design, 2nd ed STRING CLASS You can use string or String. String is a.net class. Since all keywords in C# start with a lowercase character, you can also use string. String is a reference type. Equality operators function differently with string than with other reference objects. The equality operators are defined to compare the contents or values. You can access the individual characters using an index, but string variables are objects of the string class. In addition to [ ] and the + used for concatenation, you have many predefined methods and properties that make string objects functional and flexible. Objects of the string class store an immutable series of characters. Once you give a string a value, it cannot be modified. Methods that seem to be modifying a string are actually returning a new string containing the modification. Review Table 7-3 for some of the members of the string class. There are two types of string literals. Quoted string literals appear between double quotation marks ( ) and are the most common. string literal starts with the at symbol and is also enclosed in double quotation marks. string literals are referred to as verbatim string literals because the characters between the double quotes are interpreted verbatim. 1. What does it mean for a string to be an immutable series of characters? Answer: Once you give a string a value, it cannot be modified. 2. True or False: Placing symbol in front of the string reduces the need for the quotation marks. 3. True or False: You can reference individual characters in a string using the [ ]. 4. How does the equality operator function differently with string reference objects from other user-defined reference objects. Answer: The equality operators are defined to compare the contents or values of the string object, but not other reference objects. OTHER COLLECTION CLASSES Collection classes enable you to store and retrieve groups of objects. In addition to Array and ArrayList, there are a number of other collection classes available with the.net framework.

11 C# Programming: From Problem Analysis to Program Design, 2nd ed The BitArray class stores bit values represented as Booleans. The HashTable class stores a collection of key/value pairs. The Queue class represents a FIFO collection; Stack collection represents a LIFO collection. The SortedList class represents a collection of sorted key/value pairs accessible by key or index. Dictionary class is new to.net Framework 2.0 and is a generic class that provides a mapping from a set of keys to a set of values. 1. Which collection class could be used to store a ordered list of student IDs? Answer: SortedList class 2. True or False: Queue, Dictionary, and HashTable are all examples of collections classes available to.net languages. PROGRAMMING EXAMPLE: MANATEE APPLICATION This application is created to record the sightings of manatees. It demonstrates the use of collections both array and string objects. Parallel arrays store the location, date, and number of manatees present at each sighting. Two separate classes are developed. For the manatee sighting class, characteristics of location and date of viewing, count of manatees, average sighting, and date of maximum sightings are included. Methods to determine the average, highest month, and associated month name are part of the application. Structured English (pseudocode) and class diagrams are included with the example. A table identifies which data fields should have properties defined. A prototype for the desired output is shown. The application prints the report by location and includes the date during the viewing time period when the most sightings at a given location occurred. The output should include the count associated with the most sightings. The complete program listing is shown in the book and available as a Visual Studio project to demo for the class. Discussion Questions Some interesting topics of discussion in this chapter include: Under what circumstances would parallel arrays be useful? Discuss how the Array class differs from the ArrayList class.

12 C# Programming: From Problem Analysis to Program Design, 2nd ed Projects to Assign All of the Multiple Choice Exercises, Problems 1-20 Odd numbered Short Answer Exercises, Problems Programming Exercises, Problems 1, 4, 7, and 9 Key Terms array: data structure that may contain any number of variables of the same type that are referenced by a single identifier base type: the data type of the data values compile-time initialization: initialize the elements of an array during declaration dimensioning the array: instantiate the array by indicating how many elements to allocate elements of an array: individual variables in the array indexed variables: elements in an array index of the array: references the location of the variable relative to the first element; also called subscript jagged array: a two-dimensional array where the number of columns in the rows differ; also called ragged array or an array of arrays length of the array: number of elements in the array parallel arrays: two or more arrays that have a relationship parameter array: parameter in a method that uses the params modifier keyword indicating that the number of arguments to the method may vary ragged array: a two-dimensional array where the number of columns in the rows differ; also called jagged array or an array of arrays rectangular two-dimensional array: a data structure visualized as a table divided into rows and columns row major language: a language that stores data in contiguous memory locations by row size of the array: number of elements in the array subscripted variables: elements in an array verbatim string literal: string literals that begin symbol

12 Abstract Data Types

12 Abstract Data Types 12 Abstract Data Types 12.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define the concept of an abstract data type (ADT).

More information

In this Chapter you ll learn:

In this Chapter you ll learn: Now go, write it before them in a table, and note it in a book. Isaiah 30:8 To go beyond is as wrong as to fall short. Confucius Begin at the beginning, and go on till you come to the end: then stop. Lewis

More information

VB.NET Programming Fundamentals

VB.NET Programming Fundamentals Chapter 3 Objectives Programming Fundamentals In this chapter, you will: Learn about the programming language Write a module definition Use variables and data types Compute with Write decision-making statements

More information

Exercise 1: Python Language Basics

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

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

Excel 2007 Intermediate Documentation

Excel 2007 Intermediate Documentation Learning Outcomes Create complex formulas Utilize advanced (conditional) formatting Create and customize graphical displays Table of Contents Excel 2007 Intermediate Documentation The Center for Teaching,

More information

Introduction to Data Structures

Introduction to Data Structures Introduction to Data Structures Albert Gural October 28, 2011 1 Introduction When trying to convert from an algorithm to the actual code, one important aspect to consider is how to store and manipulate

More information

Arrays in Java. Working with Arrays

Arrays in Java. Working with Arrays Arrays in Java So far we have talked about variables as a storage location for a single value of a particular data type. We can also define a variable in such a way that it can store multiple values. Such

More information

Java Application Developer Certificate Program Competencies

Java Application Developer Certificate Program Competencies Java Application Developer Certificate Program Competencies After completing the following units, you will be able to: Basic Programming Logic Explain the steps involved in the program development cycle

More information

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage

More information

VB.NET - ARRAYS. Creating Arrays in VB.Net

VB.NET - ARRAYS. Creating Arrays in VB.Net http://www.tutorialspoint.com/vb.net/vb.net_arrays.htm VB.NET - ARRAYS Copyright tutorialspoint.com An array stores a fixed-size sequential collection of elements of the same type. An array is used to

More information

Programming Fundamental. Instructor Name: Lecture-2

Programming Fundamental. Instructor Name: Lecture-2 Programming Fundamental Instructor Name: Lecture-2 Today s Lecture What is Programming? First C++ Program Programming Errors Variables in C++ Primitive Data Types in C++ Operators in C++ Operators Precedence

More information

Chapter 14 Web Database Programming Using PHP

Chapter 14 Web Database Programming Using PHP Chapter 14 Web Database Programming Using PHP Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Outline A Simple PHP Example Overview of Basic Features of PHP Overview

More information

Comp Arrays and Pointers. Class Notes. T h e G r o u p o f T h r e e

Comp Arrays and Pointers. Class Notes. T h e G r o u p o f T h r e e Comp 2401 Arrays and Pointers Class Notes 2013 T h e G r o u p o f T h r e e Introduction To Arrays: In C programming, one of the frequently problem is to handle similar types of data. For example: if

More information

Python Loops and String Manipulation

Python Loops and String Manipulation WEEK TWO Python Loops and String Manipulation Last week, we showed you some basic Python programming and gave you some intriguing problems to solve. But it is hard to do anything really exciting until

More information

Glossary of Object Oriented Terms

Glossary of Object Oriented Terms Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction

More information

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

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

More information

5 Arrays and Pointers

5 Arrays and Pointers 5 Arrays and Pointers 5.1 One-dimensional arrays Arrays offer a convenient way to store and access blocks of data. Think of arrays as a sequential list that offers indexed access. For example, a list of

More information

Primitive Data Types Summer 2010 Margaret Reid-Miller

Primitive Data Types Summer 2010 Margaret Reid-Miller Primitive Data Types 15-110 Summer 2010 Margaret Reid-Miller Data Types Data stored in memory is a string of bits (0 or 1). What does 1000010 mean? 66? 'B'? 9.2E-44? How the computer interprets the string

More information

Access Tutorial 12: An Introduction to Visual Basic

Access Tutorial 12: An Introduction to Visual Basic Access Tutorial 12: An Introduction to Visual Basic 12.1 Introduction: Learning the basics of programming Programming can be an enormously complex and difficult activity. Or it can be quite straightforward.

More information

Moving from C++ to VBA

Moving from C++ to VBA Introduction College of Engineering and Computer Science Mechanical Engineering Department Mechanical Engineering 309 Numerical Analysis of Engineering Systems Fall 2014 Number: 15237 Instructor: Larry

More information

Y ou can create an associative array, which allows

Y ou can create an associative array, which allows CREATE AN ASSOCIATIVE ARRAY Y ou can create an associative array, which allows you to use string values instead of index numbers to identify the elements in the array. These string values are often referred

More information

09336863931 : provid.ir

09336863931 : provid.ir provid.ir 09336863931 : NET Architecture Core CSharp o Variable o Variable Scope o Type Inference o Namespaces o Preprocessor Directives Statements and Flow of Execution o If Statement o Switch Statement

More information

Matrix Multiplication

Matrix Multiplication Matrix Multiplication CPS343 Parallel and High Performance Computing Spring 2016 CPS343 (Parallel and HPC) Matrix Multiplication Spring 2016 1 / 32 Outline 1 Matrix operations Importance Dense and sparse

More information

VB.NET INTERVIEW QUESTIONS

VB.NET INTERVIEW QUESTIONS VB.NET INTERVIEW QUESTIONS http://www.tutorialspoint.com/vb.net/vb.net_interview_questions.htm Copyright tutorialspoint.com Dear readers, these VB.NET Interview Questions have been designed specially to

More information

Answers to Review Questions Chapter 7

Answers to Review Questions Chapter 7 Answers to Review Questions Chapter 7 1. The size declarator is used in a definition of an array to indicate the number of elements the array will have. A subscript is used to access a specific element

More information

JavaScript: Arrays. 2008 Pearson Education, Inc. All rights reserved.

JavaScript: Arrays. 2008 Pearson Education, Inc. All rights reserved. 1 10 JavaScript: Arrays 2 With sobs and tears he sorted out Those of the largest size... Lewis Carroll Attempt the end, and never stand to doubt; Nothing s so hard, but search will find it out. Robert

More information

CMSC 202H. ArrayList, Multidimensional Arrays

CMSC 202H. ArrayList, Multidimensional Arrays CMSC 202H ArrayList, Multidimensional Arrays What s an Array List ArrayList is a class in the standard Java libraries that can hold any type of object an object that can grow and shrink while your program

More information

1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D.

1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D. 1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D. base address 2. The memory address of fifth element of an array can be calculated

More information

One Dimension Array: Declaring a fixed-array, if array-name is the name of an array

One Dimension Array: Declaring a fixed-array, if array-name is the name of an array Arrays in Visual Basic 6 An array is a collection of simple variables of the same type to which the computer can efficiently assign a list of values. Array variables have the same kinds of names as simple

More information

arrays C Programming Language - Arrays

arrays C Programming Language - Arrays arrays So far, we have been using only scalar variables scalar meaning a variable with a single value But many things require a set of related values coordinates or vectors require 3 (or 2, or 4, or more)

More information

Visual basic tutorial problems, developed by Dr. Clement,

Visual basic tutorial problems, developed by Dr. Clement, EXCEL Visual Basic Tutorial Problems (Version January, 2011) Dr. Prabhakar Clement Arthur H. Feagin Distinguished Chair Professor Department of Civil Engineering, Auburn University Home page: http://www.eng.auburn.edu/users/clemept/

More information

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement? 1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members

More information

Microsoft Excel 2010: Create or Delete a Formula

Microsoft Excel 2010: Create or Delete a Formula Formulas are equations that perform calculations on values in your worksheet. A formula always starts with an equal sign (=). You can create a simple formula by using constants and calculation operators.

More information

Math Content by Strand 1

Math Content by Strand 1 Math Content by Strand 1 Number and Operations with Whole Numbers Multiplication and Division Grade 3 In Grade 3, students investigate the properties of multiplication and division, including the inverse

More information

Creating Basic Excel Formulas

Creating Basic Excel Formulas Creating Basic Excel Formulas Formulas are equations that perform calculations on values in your worksheet. Depending on how you build a formula in Excel will determine if the answer to your formula automatically

More information

Fundamentals of Java Programming

Fundamentals of Java Programming Fundamentals of Java Programming This document is exclusive property of Cisco Systems, Inc. Permission is granted to print and copy this document for non-commercial distribution and exclusive use by instructors

More information

MS Access: Advanced Tables and Queries. Lesson Notes Author: Pamela Schmidt

MS Access: Advanced Tables and Queries. Lesson Notes Author: Pamela Schmidt Lesson Notes Author: Pamela Schmidt Tables Text Fields (Default) Text or combinations of text and numbers, as well as numbers that don't require calculations, such as phone numbers. or the length set by

More information

Repetition and Loops. Additional Python constructs that allow us to effect the (1) order and (2) number of times that program statements are executed.

Repetition and Loops. Additional Python constructs that allow us to effect the (1) order and (2) number of times that program statements are executed. New Topic Repetition and Loops Additional Python constructs that allow us to effect the (1) order and (2) number of times that program statements are executed. These constructs are the 1. while loop and

More information

8.1. Example: Visualizing Data

8.1. Example: Visualizing Data Chapter 8. Arrays and Files In the preceding chapters, we have used variables to store single values of a given type. It is sometimes convenient to store multiple values of a given type in a single collection

More information

Adjusted/Modified by Nicole Tobias. Chapter 2: Basic Elements of C++

Adjusted/Modified by Nicole Tobias. Chapter 2: Basic Elements of C++ Adjusted/Modified by Nicole Tobias Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement

More information

Arrays. number: Motivation. Prof. Stewart Weiss. Software Design Lecture Notes Arrays

Arrays. number: Motivation. Prof. Stewart Weiss. Software Design Lecture Notes Arrays Motivation Suppose that we want a program that can read in a list of numbers and sort that list, or nd the largest value in that list. To be concrete about it, suppose we have 15 numbers to read in from

More information

Python Lists and Loops

Python Lists and Loops WEEK THREE Python Lists and Loops You ve made it to Week 3, well done! Most programs need to keep track of a list (or collection) of things (e.g. names) at one time or another, and this week we ll show

More information

CHAPTER 4 ESSENTIAL DATA STRUCTRURES

CHAPTER 4 ESSENTIAL DATA STRUCTRURES CHAPTER 4 ESSENTIAL DATA STRUCTURES 72 CHAPTER 4 ESSENTIAL DATA STRUCTRURES In every algorithm, there is a need to store data. Ranging from storing a single value in a single variable, to more complex

More information

1.6 The Order of Operations

1.6 The Order of Operations 1.6 The Order of Operations Contents: Operations Grouping Symbols The Order of Operations Exponents and Negative Numbers Negative Square Roots Square Root of a Negative Number Order of Operations and Negative

More information

Data Structures in the Java API

Data Structures in the Java API Data Structures in the Java API Vector From the java.util package. Vectors can resize themselves dynamically. Inserting elements into a Vector whose current size is less than its capacity is a relatively

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

Limitation of Liability

Limitation of Liability Limitation of Liability Information in this document is subject to change without notice. THE TRADING SIGNALS, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES,

More information

PL / SQL Basics. Chapter 3

PL / SQL Basics. Chapter 3 PL / SQL Basics Chapter 3 PL / SQL Basics PL / SQL block Lexical units Variable declarations PL / SQL types Expressions and operators PL / SQL control structures PL / SQL style guide 2 PL / SQL Block Basic

More information

Curriculum Map. Discipline: Computer Science Course: C++

Curriculum Map. Discipline: Computer Science Course: C++ Curriculum Map Discipline: Computer Science Course: C++ August/September: How can computer programs make problem solving easier and more efficient? In what order does a computer execute the lines of code

More information

Common Data Structures

Common Data Structures Data Structures 1 Common Data Structures Arrays (single and multiple dimensional) Linked Lists Stacks Queues Trees Graphs You should already be familiar with arrays, so they will not be discussed. Trees

More information

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London

More information

Borland C++ Compiler: Operators

Borland C++ Compiler: Operators Introduction Borland C++ Compiler: Operators An operator is a symbol that specifies which operation to perform in a statement or expression. An operand is one of the inputs of an operator. For example,

More information

MICROSOFT EXCEL FORMULAS

MICROSOFT EXCEL FORMULAS MICROSOFT EXCEL FORMULAS Building Formulas... 1 Writing a Formula... 1 Parentheses in Formulas... 2 Operator Precedence... 2 Changing the Operator Precedence... 2 Functions... 3 The Insert Function Button...

More information

C Primer. Fall Introduction C vs. Java... 1

C Primer. Fall Introduction C vs. Java... 1 CS 33 Intro Computer Systems Doeppner C Primer Fall 2016 Contents 1 Introduction 1 1.1 C vs. Java.......................................... 1 2 Functions 1 2.1 The main() Function....................................

More information

Arrays. Introduction. Chapter 7

Arrays. Introduction. Chapter 7 CH07 p375-436 1/30/07 1:02 PM Page 375 Chapter 7 Arrays Introduction The sequential nature of files severely limits the number of interesting things you can easily do with them.the algorithms we have examined

More information

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

KITES TECHNOLOGY COURSE MODULE (C, C++, DS) KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL

More information

Performing Simple Calculations Using the Status Bar

Performing Simple Calculations Using the Status Bar Excel Formulas Performing Simple Calculations Using the Status Bar If you need to see a simple calculation, such as a total, but do not need it to be a part of your spreadsheet, all you need is your Status

More information

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share. LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.

More information

PL/SQL Overview. Basic Structure and Syntax of PL/SQL

PL/SQL Overview. Basic Structure and Syntax of PL/SQL PL/SQL Overview PL/SQL is Procedural Language extension to SQL. It is loosely based on Ada (a variant of Pascal developed for the US Dept of Defense). PL/SQL was first released in ١٩٩٢ as an optional extension

More information

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The JDK command to compile a class in the file Test.java is A) java Test.java B) java

More information

2. Names, Scopes, and Bindings

2. Names, Scopes, and Bindings 2. Names, Scopes, and Bindings Binding, Lifetime, Static Scope, Encapsulation and Modules, Dynamic Scope Copyright 2010 by John S. Mallozzi Names Variables Bindings Binding time Language design issues

More information

JavaScript: Introduction to Scripting. 2008 Pearson Education, Inc. All rights reserved.

JavaScript: Introduction to Scripting. 2008 Pearson Education, Inc. All rights reserved. 1 6 JavaScript: Introduction to Scripting 2 Comment is free, but facts are sacred. C. P. Scott The creditor hath a better memory than the debtor. James Howell When faced with a decision, I always ask,

More information

Multiplication. Year 1 multiply with concrete objects, arrays and pictorial representations

Multiplication. Year 1 multiply with concrete objects, arrays and pictorial representations Year 1 multiply with concrete objects, arrays and pictorial representations Children will experience equal groups of objects and will count in 2s and 10s and begin to count in 5s. They will work on practical

More information

Two-Dimensional Arrays. 15-110 Summer 2010 Margaret Reid-Miller

Two-Dimensional Arrays. 15-110 Summer 2010 Margaret Reid-Miller Two-Dimensional Arrays 15-110 Margaret Reid-Miller Two-Dimensional Arrays Arrays that we have consider up to now are onedimensional arrays, a single line of elements. Often data come naturally in the form

More information

MAX = 5 Current = 0 'This will declare an array with 5 elements. Inserting a Value onto the Stack (Push) -----------------------------------------

MAX = 5 Current = 0 'This will declare an array with 5 elements. Inserting a Value onto the Stack (Push) ----------------------------------------- =============================================================================================================================== DATA STRUCTURE PSEUDO-CODE EXAMPLES (c) Mubashir N. Mir - www.mubashirnabi.com

More information

Arrays. Arrays, Argument Passing, Promotion, Demotion

Arrays. Arrays, Argument Passing, Promotion, Demotion Arrays Arrays, Argument Passing, Promotion, Demotion Review Introduction to C C History Compiling C Identifiers Variables Declaration, Definition, Initialization Variable Types Logical Operators Control

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information

Sequential Data Structures

Sequential Data Structures Sequential Data Structures In this lecture we introduce the basic data structures for storing sequences of objects. These data structures are based on arrays and linked lists, which you met in first year

More information

DATA STRUCTURES USING C

DATA STRUCTURES USING C DATA STRUCTURES USING C QUESTION BANK UNIT I 1. Define data. 2. Define Entity. 3. Define information. 4. Define Array. 5. Define data structure. 6. Give any two applications of data structures. 7. Give

More information

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 The Java Type System By now, you have seen a fair amount of Java. Time to study in more depth the foundations of the language,

More information

COMP 356 Programming Language Structures Notes for Chapter 6 of Concepts of Programming Languages Data Types

COMP 356 Programming Language Structures Notes for Chapter 6 of Concepts of Programming Languages Data Types A data type consists of: a set of values COMP 356 Programming Language Structures Notes for Chapter 6 of Concepts of Programming Languages Data Types a set of predefined operations on those values Approaches

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

Chapter 8: Bags and Sets

Chapter 8: Bags and Sets Chapter 8: Bags and Sets In the stack and the queue abstractions, the order that elements are placed into the container is important, because the order elements are removed is related to the order in which

More information

Specifying Data. 9.1 Formatted data: the data command

Specifying Data. 9.1 Formatted data: the data command 9 Specifying Data As we emphasize throughout this book, there is a distinction between an AMPL model for an optimization problem, and the data values that define a particular instance of the problem. Chapters

More information

AP Computer Science Java Mr. Clausen Program 9A, 9B

AP Computer Science Java Mr. Clausen Program 9A, 9B AP Computer Science Java Mr. Clausen Program 9A, 9B PROGRAM 9A I m_sort_of_searching (20 points now, 60 points when all parts are finished) The purpose of this project is to set up a program that will

More information

Formulas in Excel 2010

Formulas in Excel 2010 Instructional Technology Department Formulas in Excel 2010 What is a Formula? A formula is basically a set of values that have some type of mathematical operations performed on them. Examples of mathematical

More information

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

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

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information

6.170 Tutorial 3 - Ruby Basics

6.170 Tutorial 3 - Ruby Basics 6.170 Tutorial 3 - Ruby Basics Prerequisites 1. Have Ruby installed on your computer a. If you use Mac/Linux, Ruby should already be preinstalled on your machine. b. If you have a Windows Machine, you

More information

Lecture 4 Notes: Arrays and Strings

Lecture 4 Notes: Arrays and Strings 6.096 Introduction to C++ January 10, 2011 Massachusetts Institute of Technology John Marrero Lecture 4 Notes: Arrays and Strings 1 Arrays So far we have used variables to store values in memory for later

More information

Quiz 4 Solutions EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II. 1 Q u i z 4 S o l u t i o n s

Quiz 4 Solutions EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II. 1 Q u i z 4 S o l u t i o n s Quiz 4 Solutions Q1: What value does function mystery return when called with a value of 4? int mystery ( int number ) { if ( number

More information

Java Basics: Data Types, Variables, and Loops

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

More information

OBJECT ORIENTED PROGRAMMING IN C++

OBJECT ORIENTED PROGRAMMING IN C++ OBJECT ORIENTED PROGRAMMING IN C++ For Off Campus BSc Computer Science Programme UNIT 1 1. The goal of programmers is to develop software that are. A. Correct B. Reliable and maintainable C. Satisfy all

More information

MS Access Lab 2. Topic: Tables

MS Access Lab 2. Topic: Tables MS Access Lab 2 Topic: Tables Summary Introduction: Tables, Start to build a new database Creating Tables: Datasheet View, Design View Working with Data: Sorting, Filtering Help on Tables Introduction

More information

Visual Basic. murach's TRAINING & REFERENCE

Visual Basic. murach's TRAINING & REFERENCE TRAINING & REFERENCE murach's Visual Basic 2008 Anne Boehm lbm Mike Murach & Associates, Inc. H 1-800-221-5528 (559) 440-9071 Fax: (559) 440-0963 murachbooks@murach.com www.murach.com Contents Introduction

More information

Chapter 5 Programming Statements. Chapter Table of Contents

Chapter 5 Programming Statements. Chapter Table of Contents Chapter 5 Programming Statements Chapter Table of Contents OVERVIEW... 57 IF-THEN/ELSE STATEMENTS... 57 DO GROUPS... 58 IterativeExecution... 59 JUMPING... 61 MODULES... 62 Defining and Executing a Module....

More information

C++ Keywords. If/else Selection Structure. Looping Control Structures. Switch Statements. Example Program

C++ Keywords. If/else Selection Structure. Looping Control Structures. Switch Statements. Example Program C++ Keywords There are many keywords in C++ that are not used in other languages. bool, const_cast, delete, dynamic_cast, const, enum, extern, register, sizeof, typedef, explicit, friend, inline, mutable,

More information

Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory.

Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. JAVA TYPES BASIC DATA TYPES GENERAL Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. Based on the data type

More information

Oracle Database: SQL and PL/SQL Fundamentals

Oracle Database: SQL and PL/SQL Fundamentals Oracle University Contact Us: +966 12 739 894 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training is designed to

More information

The Center for Teaching, Learning, & Technology

The Center for Teaching, Learning, & Technology The Center for Teaching, Learning, & Technology Instructional Technology Workshops Microsoft Excel 2010 Formulas and Charts Albert Robinson / Delwar Sayeed Faculty and Staff Development Programs Colston

More information

#820 Computer Programming 1A

#820 Computer Programming 1A Computer Programming I Levels: 10-12 Units of Credit: 1.0 CIP Code: 11.0201 Core Code: 35-02-00-00-030 Prerequisites: Secondary Math I, Keyboarding Proficiency, Computer Literacy requirement Semester 1

More information

b) lower case always use lower case for all matlab commands. This is what matlab recognizes.

b) lower case always use lower case for all matlab commands. This is what matlab recognizes. 1 Matlab 1) Fundamentals a) Getting Help for more detailed help on any topic, typing help, then a space, and then the matlab command brings up a detailed page on the command or topic. For really difficult

More information

Stacks. Linear data structures

Stacks. Linear data structures Stacks Linear data structures Collection of components that can be arranged as a straight line Data structure grows or shrinks as we add or remove objects ADTs provide an abstract layer for various operations

More information

Big O and Limits Abstract Data Types Data Structure Grand Tour. http://gcc.gnu.org/onlinedocs/libstdc++/images/pbds_different_underlying_dss_1.

Big O and Limits Abstract Data Types Data Structure Grand Tour. http://gcc.gnu.org/onlinedocs/libstdc++/images/pbds_different_underlying_dss_1. Big O and Limits Abstract Data Types Data Structure Grand Tour http://gcc.gnu.org/onlinedocs/libstdc++/images/pbds_different_underlying_dss_1.png Consider the limit lim n f ( n) g ( n ) What does it

More information

Creating Database Tables in Microsoft SQL Server

Creating Database Tables in Microsoft SQL Server Creating Database Tables in Microsoft SQL Server Microsoft SQL Server is a relational database server that stores and retrieves data for multi-user network-based applications. SQL Server databases are

More information

Introduction. Syntax Statements. Colon : Line Continuation _ Conditions. If Then Else End If 1. block form syntax 2. One-Line syntax. Do...

Introduction. Syntax Statements. Colon : Line Continuation _ Conditions. If Then Else End If 1. block form syntax 2. One-Line syntax. Do... 3 Syntax Introduction Syntax Statements Colon : Line Continuation _ Conditions If Then Else End If 1. block form syntax 2. One-Line syntax Select Case Case Case Else End Select Do...Loop For...Next While...Wend

More information