Understand Computer Storage and Data Types

Slides:



Advertisements
Similar presentations
C# Language Report By Trevor Adams. Language History Developed by Microsoft Developed by Microsoft Principal Software Architect Principal Software Architect.
Advertisements

Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Introduction to Computing Concepts Note Set 7. Overview Variables Data Types Basic Arithmetic Expressions ▫ Arithmetic.
Data Types in Java Data is the information that a program has to work with. Data is of different types. The type of a piece of data tells Java what can.
Data Types and Expressions
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Introduction.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Introduction.
Representation and Conversion of Numeric Types 4 We have seen multiple data types that C provides for numbers: int and double 4 What differences are there.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter Introduction to Computers and Programming 1.
CSCI 1100/1202 January 16, Why do we need variables? To store intermediate results in a long computation. To store a value that is used more than.
CIS Computer Programming Logic
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
VARIABLES AND TYPES CITS1001. Types in Java the eight primitive types the unlimited number of object types Values and References The Golden Rule Scope.
Copyright © 2002 W. A. Tucker1 Chapter 7 Lecture Notes Bill Tucker Austin Community College COSC 1315.
C Tokens Identifiers Keywords Constants Operators Special symbols.
CPS120: Introduction to Computer Science Variables and Constants Lecture 8 - B.
CSE 1301 Lecture 2 Data Types Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Introduction to Computer Systems and the Java Programming Language.
Chapter 2: Using Data.
CPS120: Introduction to Computer Science
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
Lecture #5 Introduction to C++
Basic Semantics Associating meaning with language entities.
Course Title: Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 03 Conditional statement 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER)
College Board A.P. Computer Science A Topics Program Design - Read and understand a problem's description, purpose, and goals. Procedural Constructs.
Copyright Curt Hill Variables What are they? Why do we need them?
Chapters 2 & 3. .NET Software development model that allows applications created in disparate programming languages to communicate Universal data access.
Copyright © – Curt Hill Types What they do.
Chapter 4 Literals, Variables and Constants. #Page2 4.1 Literals Any numeric literal starting with 0x specifies that the following is a hexadecimal value.
By : Reem Hasayen. A storage device is a hardware device capable of storing information. There are two types of storage devices used in computers 1. Primary.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
1.2 Primitive Data Types and Variables
CPS120: Introduction to Computer Science Variables and Constants.
Types Chapter 2. C++ An Introduction to Computing, 3rd ed. 2 Objectives Observe types provided by C++ Literals of these types Explain syntax rules for.
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
09/06/ Data Representation ASCII, Binary Denary Conversion, Integer & Boolean data types.
Introduction C# program is collection of classes Classes are collection of methods and some statements That statements contains tokens C# includes five.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
1 ENERGY 211 / CME 211 Lecture 3 September 26, 2008.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 1: Introduction to Computers and Programming.
Fundamentals 2.
Overview Working directly with memory locations is beneficial. In C, pointers allow you to: change values passed as arguments to functions work directly.
Choosing Data Types Database Administration Fundamentals
Chapter # 2 Part 2 Programs And data
Course Contents KIIT UNIVERSITY Sr # Major and Detailed Coverage Area
Chapter Topics The Basics of a C++ Program Data Types
The Machine Model Memory
Documentation Need to have documentation in all programs
Basic Elements of C++.
EPSII 59:006 Spring 2004.
Multiple variables can be created in one declaration
CSCI 161: Introduction to Programming
CSCI206 - Computer Organization & Programming
Basic Elements of C++ Chapter 2.
IDENTIFIERS CSC 111.
.Net Programming with C#
Introduction to Abstract Data Types
C++ Data Types Data Type
Chapter 2: Java Fundamentals
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Data Types Imran Rashid CTO at ManiWeber Technologies.
Chapter # 2 Part 2 Programs And data
Chapter 2: Java Fundamentals
ECE 103 Engineering Programming Chapter 8 Data Types and Constants
Variables and Constants
Presentation transcript:

Understand Computer Storage and Data Types LESSON 1.1 98-361 Software Development Fundamentals Understand Computer Storage and Data Types

Lesson Overview Students will understand computer storage and data types. In this lesson, you will learn: How a computer stores programs and instructions in computer memory Memory stacks and heaps Memory size requirements for the various data storage types Numeric data and textual data

Guiding Questions How are program instructions stored in a computer? Identify the different data types that can be used and the values they can hold. Use the guiding questions as a class starter, allowing the students time to answer the questions in their journals. Discuss student answers to the questions. Primary and secondary storage. Stacks or heaps depending on the type of data. int–integers, float, double; decimal–decimal values; bool–Boolean values (true/false), etc.

Activator Name the components of a computer. What components are involved in storing program instructions? CPU, RAM, hard drive, monitor, etc. RAM and hard drive

Review Terms Data type—a definition of a set of data that specifies the possible range of values of the set, the operations that can be performed on the values, and the way in which the values are stored in memory. Garbage collection—a process for automatic recovery of heap memory. Heap—a portion of memory reserved for a program to use for the temporary storage of data structures whose existence or size cannot be determined until the program is running. Memory —a device where information can be stored and retrieved. Stack—a region of reserved memory in which programs store status data such as procedure and function call addresses, passed parameters, and sometimes local variables.

How a computer stores programs in memory A computer keeps data and programs in storage as follows: Primary storage—Otherwise known as random access memory (RAM), it is made of memory chips. In common usage, it refers only to a computer’s main memory, the fast semiconductor storage (RAM) directly connected to the processor. Secondary storage—Otherwise known as a hard drive, it consists of a read/write head that floats above rotating platters coated with a magnetic material.

Memory–Stacks and Heaps Variables are stored in either a stack or heap based on their type: Value types (e.g.: int, double, float) go on the stack. Reference types (String, Object) go on the heap. * Value types in classes are stored with the instance of the class on the heap. The stack Values in the stack are managed without garbage collection because items are added and removed from the stack as last in, first out (LIFO) every time you enter or exit a scope, like a method or statement A StackOverFlowException occurs because you have used up all the available space in the stack.

Memory–Stacks and Heaps (continued) The heap A heap-based memory allocation occurs when we create a new object, at which point the compiler figures out how much memory is needed and allocates an appropriate amount of memory space and returns a reference representing the memory address. A heap is used for dynamic allocation of memory. The Microsoft® .NET Framework uses garbage collection to free up space during run time. Garbage collection is an automatic process for recovery of heap memory. Blocks of memory that had been allocated but are no longer in use are freed, and blocks of memory still in use may be moved to consolidate the free memory into larger blocks.

Data Types Numeric data types Integral types (e.g.: byte, char, int) Floating-point types (float, double) Decimal Boolean Example: bool done = false;

Data Types Numeric data types Integral types (e.g.: byte, char, int) Floating-point types (float, double) Decimal Boolean bool done = false;

Integral Types Type Range Size sbyte -128 to 127 Signed 8-bit integer Unsigned 8-bit integer char U+0000 to U+ffff Unicode 16-bit character short -32,768 to 32,767 Signed 16-bit integer ushort 0 to 65,535 Unsigned 16-bit integer int -2,147,483,648 to 2,147,483,647 Signed 32-bit integer uint 0 to 4,294,967,295 Unsigned 32-bit integer long -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 Signed 64-bit integer ulong 0 to 18,446,744,073,709,551,615 Unsigned 64-bit integer The ranges seen here are for the .NET Framework

Floating-Point Types Type Approximate Range Precision float ±1.5e−45 to ±3.4e38 7 digits double ±5.0e−324 to ±1.7e308 15-16 digits The ranges seen here are for the .NET Framework.

Decimal Type Type Approximate Range Precision decimal ±1.0 × 10−28 to ±7.9 × 1028 28-29 significant digits The ranges seen here are for the .NET Framework.

Using the Numeric Data Types byte numKids = 15; char letter = ‘p’; int worldPopulation = 6692030277; float money = 201.00f; double lotsaMoney = 2.4E+12; decimal testGrade = 89.5m;

Lesson Review Describe how the program statement below is stored in memory: int tennisPoints = 30; Identify the appropriate data types for each of the following values. 4233423.93 100 -2323 true This is the last slide of the presentation.