Discrete and Prog

Embed Size (px)

Citation preview

  • 8/6/2019 Discrete and Prog

    1/10

    I.a. Storage and Multimedia

    a. The Benefits Of Secondary Storage

    y Space Storage of data

    y Reliability Data are safe

    y Convenience Can access data quicklyy Economy Significant savings in storage costs

    b. Magnetic Disk Storage

    y Diskettes and Hard disks

    y Based on a technology of representing data as magnetized spots on the surface of a spinning

    disk, with a magnetized spot representing a 1 bit and the absence as 0.

    c. Floppy Disks

    y Made up of flexible Mylar and coated with iron oxide.

    y Record data as magnetized spots on tracks on its surface

    y The most popular: 3.5 floppy disk w/ 1.44 MB capacity.

    y Special: HiFD w/ 200MB, SuperDisk w/ 120MB and 240MB, ZipDrive w/ 750MB capacity

    d. Hard Disks

    y A rigid platter coated with magnetic oxide that can be magnetized to represent data

    y Several platters are assembled into a disk pack.

    y A disk drive is a device that enables data to be read from or written to a disk.

    I.b. Organized Data on Disk

    y Track Circular portion of the disk surface. Line

    y Sector Holds a fixed number of bytes, typically 512MB. Pie

    y Cluster Fixed number of adjacent sector

    y Cylinder for multiple platters storage

    I.c. Optical Disk Storage

    y Laser hits the disk surface creating pits, reading it requires laser scanning that picks the

    reflections

    y Read-only media disks that can be read but not written to by the user

    y Write-once, read-many media may be written once

    y Magneto-Optical disks hybrid type that combine best features of magnetic and optical disk

    technologies.

    I.d. Compact Disks

    y CD-ROM Compact Disk Read Only Memory - Drive is capable only of reading data from CDs

    y CD-R Compact Disk Recordable - Enables writing on optical disk but just once

    y CD-RW Compact Disk-ReWritable - Flexible, record and erase data several times.

  • 8/6/2019 Discrete and Prog

    2/10

    I.e. DVD - ROM

    y Digital Versatile Disk (orig. digital video disk)

    y Has 4.7GB capacity, 7x than than CD-ROM

    y Double layered: 8.5GB capacity

    y Writable: DVD-RAM, DVD-R, DVD+R

    y Rewritable: DVD-RW, DVD+RW

    Blu-ray Disc

    y Uses a blue light laser.

    y Has 27GB capacity

    I.f. Multimedia

    y Presents information with text, illustrations, photos, narration, music, animation and film clips.

    y

    Multimedia requirements should be mety Special software for drives and sound card

    I.g. Organized Data

    1.Character a letter, digit or special character

    2.Field contains set of related characters

    3.Record collection of related fields

    4.File collection of related records

    5.Database collection of interrelated files stored together with minimum redundancy.

    How long will it last?

    Hard drive:3-5 years; mechanical components wear out

    Floppy disk: 1 yr. of regular use, longer w/ careful storage

    Magnetic Tape: 3-5; as long as 25

    CD-ROM: approx.200 yrs.

    CD-R: approx. 100-200 yrs.

    CD-RW: 30 yr; proper temperature is critical

    DVD-ROM: approx. 200 yrs

    II. a. Networking

    Data Communications System

    y Computer systems that transmits data over communication lines

  • 8/6/2019 Discrete and Prog

    3/10

    y Network A computer system that uses communications equipment to connect two or more

    computers and their resources

    II.b. Basic Components of DCS

    1.A sending device

    2.A communications link

    3.A receiving device

    II.c. Types of Communications Media

    1.Wire Pairs also known as twisted pair

    2.Coaxial Cables consists of center conductor w/ several layers of insulation

    3.Fiber optics uses glass as medium

    4.Microwave Transmission LOS transmission of data through atmosphere

    5.Satellite Transmission Form of microwave transmission in which a satellite acts as the relay station.

    6.Wireless Transmissions

    II.d. Wireless Transmission

    1.IrDA uses infrared to transmit data a few feet between devices

    2.Bluetooth shirt distance technique(30 feet or less) that uses radio waves

    3.Wi-Fi distances about 150 feet

    II.e. Network Topologies

    Topology physical layout of a network

    Node a computer on a network

    y Star network Has a central (hub) computer that is responsible for managing network.

    y Ring Network Links node in a circular chain.

    y Bus Network Has a single line(the bus) to which all the network nodes are attached.

    II.f. Local Area Networks

    y A collection of computers, usually personal computers, that share hardware, software and data.

    y Cover short distances, such as within a campus, building or office.

    II.g. Local Area Networks Components

    y Network cable - medium of communication

    y Network Interface Card(NIC) connects computer to a wiring network

  • 8/6/2019 Discrete and Prog

    4/10

    y Bridge hardware/software combination that recognizes messages on a network and passes on

    messages addressed to nodes in other networks.

    y Router a special computer that directs communications traffic when several networks are

    connected

    y Gateway hardware/software collection that lets a node communicate with a computer on

    another dissimilar network

    y Wireless access point(base station) connects to a wired network and provide wireless

    transmit/receive capabilities over a radius of several hundred feet.

    III.a. Fundamentals of Programming

    Topic:

    y Introduction to Computers, Programs and Java

    y Primitive Data Types and Operations

    y Selection Statements

    y Loops

    y Methods - Recursion

    y Arrays Algorithm Efficiency and Sorting

    Objectives:

    y To have knowledge of computer basics, programs, and operating systems

    y To represent numbers in binary, octal, decimal, hexadecimal and other number system

    y To know the relationship between the Web and Java

    y To recognize the terms API,IDE and JDK

    y To write a simple Java program

    II.b. Introduction

    Software Word processor, web browsers and email programs

    applications that run in a computer

    -intangible things in a computer

    -created using programming languages

    III.c. Computer Basic

    Computer an electronic device that store and processes data

    -includes hardware(physical aspect of a computer) and software(invisible instructions that control the

    hardware

    -consists of CPU, memory, storage devices, input and output devices and communication devices

    -components are connected through a bus, a subsystem

  • 8/6/2019 Discrete and Prog

    5/10

    III.d. Computer Hardware Components

    Central Processing Unit brain of the computer

    -compose of a control unit(control and coordinates actions) and an arithmetic logic unit(performs numeric

    and logic operations

    Memory stores data and instructions that the CPU executes

    -with memory unit(an ordered sequence of bytes)

    -a memory byte is never empty

    Storage Devices location where data are stored

    -disk drives, CD drives, tape drives and USB flash drives

    Input and Output Devices let user communicate to computer

    -keyboard with function keys, modifier keys, numeric keypad, arrow keys

    -pointing device(mouse)

    -monitor(displays text and graphics information

    Communication devices networking devices(modem, DSL, NIC)

    III.e. Programs

    -also known as software, are instructions to computers

    Machine language computer language

    -set of primitive instructions

    -difficult to program

    Assembly language low-level programming language that uses mnemonics

    -developed to make programming easy using assembler

    High-level language English like and easy to learn

    -COBOL, FORTRAN, BASIC, Pascal, Ada, C, Visual Basic, Delphi, C++, C# and

    JAVA

    III.f. Operating System

    -the most important program that manage and control computer activities

    -with (1)controlling and monitoring system activities, (2)allocating and assigning system resources and

    (3)scheduling operations such as multiprogramming, multithreading and multiprocessing

  • 8/6/2019 Discrete and Prog

    6/10

    IV. Number Systems (Importance and Conversion)

    a. Computer usage of number systems

    Computer use binary numbers internally because storage devices stores data in 1s and 0s.

    Decimal numbers are use in our everyday life unlike binary numbers that is the primitive language of acomputer.

    Programs written in decimal should be converted to binary numbers to reach the machine language.

    Hexadecimal number system is created to write binary number simply.

    Decimal number system has ten digits, and the position values are integral powers of 10, likewise, binary

    number system has two digits, and the position values of the integral is 2.

    b. Conversions:

    Given a binary number bnbn-1bn-2 b2b1b0, the equivalent decimal value is

    bn x 2n + bn-1 x 2n-1 + bn-2 x 2n-2 + ... + b2 x 22 + b1 x 21 + b0 x 20

    Ex.

    1.Convert 102 to ____10.

    2.Convert 10002 to _____10.

    3.Convert 101010102 to _____10.

    Given an octal number onon-1on-2 o2o1o0, the equivalent decimal value is

    on x 8n + on-1 x 8n-1 + on-2 x 8n-2 + ... + o2 x 82 + o1 x 81 + o0 x 80

    Ex.

    1.Convert 108 to ____10.

    2.Convert 13028 to _____10.

    3.Convert 323088 to _____10.

    Given a hexadecimal number hnhn-1hn-2 h2h1h0, the equivalent decimal value is

    hn x 16n + hn-1 x 16n-1 + hn-2 x 16n-2 + ... + h2 x 162 + h1 x 161 + h0 x 160

    Ex.

    1.Convert 1016 to ____10.

  • 8/6/2019 Discrete and Prog

    7/10

    2.Convert ECE3D16 to _____10.

    3.Convert FACADE16 to _____10.

    Any number system to decimal

    Given a number snsn-1sn-2 s2s1s0 with base e, the equivalent decimal value is

    sn x en + sn-1 x en-1 + en-2 x en-2 + ... + s2 x e2 + s1 x e1 + s0 x e0

    Ex.

    1.Convert 345 to ____10.

    2.Convert 35A11 to _____10.

    3.Convert 65217 to _____10.

    1. In a class of 50 students, 18 take Chorus, 26 take Band, and 2 take both Chorus and Band. How many

    students in the class are not enrolled in either Chorus or Band?

    16 + 2 + 24 + x= 50

    42 + x= 50

    x = 8 students

    2. In a school of 320 students, 85 students are in the band, 200 students are on sports teams, and 60

    students participate in both activities. How many students are involved in either band or sports?

  • 8/6/2019 Discrete and Prog

    8/10

    25 + 60 + 140 = 225

    There are 225 students involved

    in either band or sports.

    3. A veterinarian surveys 26 of his patrons. He discovers that 14 have dogs, 10 have cats, and 5 have fish. Four

    have dogs and cats, 3 have dogs and fish, and one has a cat and fish. If no one has all three kinds of pets, howmany patrons have none of these pets?

    7 + 4 + 0 + 3 + 1 + 5 + 1 + x = 26

    21 + x = 26

    x = 5 patrons have none of these animals

    4. From a survey of 100 college students, a marketing research company found that 75 students owned stereos, 45

    owned cars, and 35 owned cars and stereos.

    a) How many students owned either a car or a stereo?

    b) How many students did not own either a car or a stereo?

    METHOD:

    a) Start with a Venn Diagram and label the different categories:

    b) Fill in the number of students who own both cars and stereos, which would be in the intersection of the two

    sets:

  • 8/6/2019 Discrete and Prog

    9/10

    c) Fill in the remaining numbers for the two sets. In this case, since a total of 45 students own cars, and 35 have

    already been listed, then 45 - 35 = 10students own cars only. Similarly, since 75 students own stereos and 35 have

    already been listed, then 75 - 35 = 40 students who own stereos only:

    d) Finally, interpret and answer the questions:

    How many students owned either a car or a stereo?

    The question asks either ... or which is union of the sets.

    From the diagram, the number of elements in A = 10 + 35

    and the number of elements in B which are NOT in A are 40.

    So the union would be 10+35+40 = 85

    How many students did not own either a car or a stereo?

    The question asks for the number not in either A nor B(namely, the complement of A B or (A B)' ).

    Since there are 100 students in the universe, then the complement is found

    by subtracting those who own either a car or stereo from the total number of students surveyed

    or 100 - 85 = 15.

    5. Suppose n(U) = 150, n(A) = 37, and n(B) = 84.

    a) If n( A U B) = 100, find n(a B) and draw a Venn diagram illustrating the composition of U.

    b) How many elements belong to A only?

    METHOD:

    a) Start with a Venn diagram and label the categories:

  • 8/6/2019 Discrete and Prog

    10/10

    b) Since the number of elements in the union = 100,

    add the number of elements in A to the numbers of elements in B:

    37 + 84 = 121.

    But 121 is larger than 100, which means that 121 - 100 = 21 must

    be in both sets or in the intersection! And the first question

    (If n( A U B) = 100, find n(a B) and draw a Venn diagram illustrating the composition of U.) is answered!

    c) Using the information about the intersection, the other numbers can then be filled in:

    And the second question (How many elements belong to A only?) is answered

    since the total number of elements in A is 37.

    Then the remaining elements in A will be 37 - 21 = 16!