Thursday, December 25, 2008

Dot Matrix Print Head

  • Impact printer
  • Print head strikes inked ribbon
  • Line printers
  • Band printers
  • Speed measured in characters per second

Ink-jet printers

  • Non-impact printer
  • Inexpensive home printer
  • Color output common using CMYK
  • Cyan, magenta, yellow, black
  • Sprays ink onto paper
  • Speed measured in pages per minute
  • Quality expressed as dots per

Laser printer

Non-impact printer

Produces high quality documents

Color or black and white

Print process

Laser draws text on page

Toner sticks to text

Toner melted to page

Speed measured in pages per minute

Quality expressed as dots per inch

Definition of memory and its classification




















Memory Hierarchies

Definition of memory and its

classification

Ø Memory

When you launch a program, it is loaded into and run from memory

Ø Classification of Memory

Ø Internal Processor Memory

Ø Main Memory:

Example: RAM, ROM.

Ø Secondary Memory:

Example: CD, Floppy etc.

Memory Capacity

ü Bit

ü Byte: 1 byte= 8 bits

ü Kilobyte (K or KB): 1KB=1024 bytes

ü Megabyte (M or MB): 1MB=1048579 bytes

ü Gigabyte (G or GB): 1GB=1048876 byte

ü Terabyte

Memory Hierarchies

General Properties of Memory Devices

Access Time: The average time required to read a fixed amount of information from the memory

Cycle time: The minimum time between two consecutive memory access operations is called the cycle time.

Data Transfer rate: The maximum amount of information that can be transferred to or from the memory every second is called the data transfer rate.

Main memory or Primary memory

Main memory or Primary memory

Ø Read only Memory

Ø Random Access Memory

Ø Cache Memory

Read only Memory (ROM)

    • Read Only Memory.
    • Used for storing programs & data permanently.
    • User may read data from ROM but may not write on ROM.
    • Permanent or Nonvolatile memory

Random Access Memory (RAM)

Ø Temporary storage that can be read from or written into by the user.

Ø Used primarily to store user programs and data.

Ø Temporary or Volatile memory.

Ø Determines a computer’s speed and power

Ø 2 types of RAM:


Static RAM

Dynamic RAM

Differences between SRAM and DRAM

SRAM

DRAM

High speed RAM

Relatively slower

SRAM is costly

Less costly

Does not require refreshing

Requires refreshing periodically

Generally used for cache

Used for main memory

Difference between RAM & ROM

RAM

ROM

Random Access Memory

Read Only memory

User can read & write into it

User can only read from it

For any type of processing, user must store program & data into RAM

Manufacturer stores instruction into ROM permanently

Temporary or volatile memory

Permanent or non-volatile memory

Cache Memory or High Speed Buffer



















Cache Memory

Cache memory is high-speed memory that holds the most recent data and instructions that have been loaded by the CPU.

Cache is located directly on the CPU or between the CPU and RAM, making it faster than normal RAM.

CPU-resident cache is called Level-1 (L1) cache. External cache is called Level-2 (L2) cache.

The amount of cache memory has a tremendous impact on the computer's speed.

Secondary Memory or Secondary Storage Devices

Secondary Memory

Ø Nonvolatile

Ø Slow compared to primary memory

Ø Less costly & high capacity


Categorizing Storage Devices

The hardware that writes data to or reads data from a storage medium is called a storage device. A floppy disk drive is a storage device.

Storage devices hold data, even when the computer is turned off.

The two primary storage technologies are magnetic and optical.

Magnetic storage are:

-Diskettes (floppy disks)

-Hard disks

Optical storage are:

-Compact Disk Read-Only Memory (CD-ROM)

-Digital Video Disk Read-Only Memory (DVD- ROM)

Comparison of primary & secondary memory

Characteristics

Primary

Secondary

Location with respect to the CPU

Directly accessible

Indirectly accessible

Cost

More expensive

Less expensive

Capacity

Lower than secondary memory

Several thousand times higher than primary

Means of storing information

Semiconductor chips

Magnetic and optical

A Program that will Find the Two Numbers Addition

First Method:

#include
Void main ()
{
int a, b, sum;
sum = a + b
printf ("Enter Two Numbers :\n");
scanf ("%d %d\n", & a, & b);
printf ("Sum of two Numbers: \n", sum);
}

Second Method:

#include
int main ()
{
int a, b, sum;
sum = a + b
printf ("Enter First Input:\n");
scanf ("%d\n", & a);
printf ("Enter Second Input:\n");
scanf ("%d\n", & b);
printf ("Sum is: \n", sum);
}

A Program that will Count Temperature From Celcius to Farenite

#include
void main ()
{
float cel, faren;
printf ("Enter value in celcius:\n");
scanf ("%f\n", &cel);
faren = 18*cel+32;
printf ("Farenite Result is :\n", faren);
}

A Program that will Find the Max Number among Two Numbers

#include
void main ()
{
int a, b, max;
printf ("Enter Two Number:\n");
scanf ("%d %d\n", &a, &b);
if (a>b)
{
max = a;
}
else
{
max = b;
}
printf ("Max of %d and %d is %d \n", a, b, max);
}

Wednesday, December 3, 2008

A Program that will Count Leap Year

#include
void main ()
{
int year,
printf ("Enter the year: ");
scanf ("%d", & year);
if (year % 4 = = 0 & & year % 100! = 0 || year % 400 = = 0)
{
printf ("It is a leap year\n");
}
else
{
printf ("It is not a leap Year\n");
}
}

A Program that will Find the Max Number among three Number

#include
void main ()
{
int a,b,c,max,
printf ("Enter Three Values: ");
scanf ("%d %d %d", &a, &b, &c);
if (a>b)
{
if (a>=c)
max = a,
else
max = c,
}
else
{
if (b>=c)
max = b,
else
max = c,
}
printf ("Maximum of %d, %d and %d is %d\n", a,b,c,max);
}

A Program that will calculate Your grade in the exam

#include
void main ()
{
int marks,
printf ("How much (% %)number you get:");
scanf ("%d", & marks);
if (marks>=80)
printf ("You get A+\n");
else if (marks>=75)
printf ("You get A\n");
else if (marks>=70)
printf ("You get A-\n");
else if (marks>=65)
printf ("You got B+\n");
else if (marks>=60)
printf ("You got B\n");
else if (marks>=40)
printf ("You got D\n");
else
printf ("You got F\n");
}