IT101 IT Fundamentals 2022-2023 PDF

Document Details

RaptJadeite8896

Uploaded by RaptJadeite8896

Assiut University

2023

Assiut University

Dr. Islam Taj-Eddin, Dr. Ali Hussein Ahmed, Dr. Tarik Mohamed Abdel-Kader Ibrahim, Dr. Ebram Kamal William Aziz

Tags

IT fundamentals computer science programming computer technology

Summary

This document is a course outline for the IT101 IT Fundamentals course at Assiut University in 2022-2023. It covers course content, staff information, goals, and an overview of lectures, with mentions of programming and computer hardware.

Full Transcript

IT101 IT FUNDAMENTALS Dr. Islam Taj-Eddin Dr. Ali Hussein Ahmed Dr. Tarik Mohamed Abdel-Kader Ibrahim Dr. Ebram Kamal William Aziz IT Department, Faculty of Computers and Information Assiut University 2022-2023 Enroll The course on Thinqi LMS https://aun.edu....

IT101 IT FUNDAMENTALS Dr. Islam Taj-Eddin Dr. Ali Hussein Ahmed Dr. Tarik Mohamed Abdel-Kader Ibrahim Dr. Ebram Kamal William Aziz IT Department, Faculty of Computers and Information Assiut University 2022-2023 Enroll The course on Thinqi LMS https://aun.edu.eg/thinqi Code=IT101-1 LECTURE 1&2&3 Introduction and Computer Software& Hardware and Logic Gates Course Goals Demystifying Technology Technical Literacy Communication with Software Engineers Course Overview (subject to change) ❑ Orientation+ Computer HW + SW + Logic Gates (4 lectures) ❑ Introduction to Programming (Problem Solving , FlowCharts) (2 letures) ❑ Introduction to Programming C++ (2 Lectures) ❑ The Internet and the Web (2 Lectures) Course Staff Dr Islam Ali Tajaddin Dr Ali Hussein [email protected] [email protected] IT DEPT FCI IT DEPT FCI Dr. Tarik Mohamed Abdel-Kader Ibrahim [email protected] IT DEPT FCI Dr. Ebram Kamal William Aziz [email protected] IT DEPT FCI Course Policies: Grade Breakdown 20% Mid Quizzes 50% 10% Practical Final 20% Lab outline (3 hrs) Teaching Assistants ……soon Let's Go... Introduction to Computers ‫اﻟﺘﻄﺒﻴﻘﺎت‬ ‫ أي ﺑﺮﻧﺎﻣﺞ ﺗﻘﻮم ﺑﺘﺸﻐﻴﻠﻪ ﻋﻠﻰ ﺟﻬﺎز اﻟﻜﻤﺒﻴﻮﺗﺮ اﻟﺨﺎص ﺑﻚ‬ Applications ‫ ﺗﻄﺒﻴﻖ اﻟﻤﻼﺣﻈﺎت‬Microsoft Word Google Chrome ‫ ﻳﻤﻜﻦ اﺳﺘﺨﺪاﻣﻪ‬app (Mac). ‫ أو‬exe (Windows). ‫ ﻣﻠﻒ‬ (‫دون ﻣﻌﺮﻓﺔ ﻛﻴﻔﻴﺔ ﻋﻤﻠﻪ ﺧﻠﻒ اﻟﻜﻮاﻟﻴﺲ )اﻟﺘﺠﺮﻳﺪ‬ ‫ وﻫﻲ اﻟﻄﺒﻘﺔ اﻟﺘﺎﻟﻴﺔ ﻣﻦ اﻟﺘﺠﺮﻳﺪ‬،‫ ﺗﺘﻢ ﻛﺘﺎﺑﺔ اﻟﺒﺮاﻣﺞ ﻓﻲ اﻟﻜﻮد‬ Any program you run on your computer Microsoft Word Google Chrome Note application.exe (Windows) or.app (Mac) file Can use without knowing how it works behind the scenes (abstraction) Programs are written in code, the next layer of abstraction Computer Definition & Operation How is a computer defined? Electronic device operating under the control of instructions stored in its own memory The computer 1. first, Accepts data such as raw facts, figures, and symbol 2. then, Processes data into information (Data that is organized, meaningful, and useful ) 3. finally, Produces and stores results Data Processing What is the information processing cycle? Input Process Output Storage Communication The Components of a Computer What is an input device? Hardware used to enter data and instructions The Components of a Computer What is an output device? Hardware that conveys information to a user The Components of a Computer What is the system unit? Box-like case containing electronic components used to process data What is the magical inside the black box? Memory Video card Card Power Supply Sound Card The Components of a Computer The two main components on the motherboard Central Processing Unit (CPU) Also called a processor Carries out instructions that tell computer what to do Memory Temporary holding place for data and instructions CPU "Brain" of a computer Receives input data and performs the binary instructions given to it Communicates with I/O (input-output) devices, such as: Keyboard Mouse Contains registers that house information, and performs operations (i.e. assembly instructions) on values in these registers Memory CPUs must get their instructions and data from somewhere Memory: computer hardware components that store data Two types of memory: RAM (random access memory) Hard drive (also known as disk) Any program you are currently running (in foreground or background) has memory stored in RAM. CPU gets data directly from RAM. RAM Anything you are running is stored in RAM Very easily accessible (can find something in RAM quickly) When computer is turned off (or power cut), everything in RAM is wiped (This is why you should save documents before shutting down!) The Components of a Computer The Storage Holds data, instructions, and information for future use Storage media Physical material on which data, instructions, and information are stored Storage device Records and retrieves items to and from a storage medium Storage device A floppy disk? Thin, circular, flexible disk enclosed in rigid plastic shell A Zip® disk looks similar but has much greater storage capability (=170 floppy disk) A hard disk? Provides much greater storage capacity than a floppy disk or Zip® disk Housed inside the system unit Hard Drive Slow to access memory in hard drive When you save a file, it is saved to "disk" or stored in the hard drive Typically lots of storage (256GB to 1TB) compared to RAM (4 GB to 16 GB) A Compact disc? Flat, round, portable metal disc ▪ CD-ROM ▪ CD-RW Capacity: 673~768 MB ▪ DVD-ROM ▪ DVD+RW Capacity:4.7 ~ 17.1 GB The Miniature storage media Digital Portable, thin cameras memory cards used in: Handheld computers What about "flash storage?" Flash storage is high-speed memory that doesn't require power like RAM (also known as SSD, or solid state drive) Fast compared to traditional hard drives, which rely on spinning disks, motors, and magnetism Drawbacks of flash storage: very pricey, rewrite limitations Computer Software How do you install and run a software program? A program/Software is a series of instructions/Machine Code that tells the computer what to do Step 2. Install the Step 1. software program by Insert the program disc instruction in the disc, into the CD-ROM then run the program drive Step 3. The program executes Machine code What is this machine code we keep speaking of? Humans write programs that are human- readable. A machine needs code that is machine- readable (which is binary) Our code, like Javascript, is compiled and interpreted to binary (1s and 0s) instructions that machines can understand Something in the computer must take and understand these instructions...what component is it? Software Coding Strengths of Computers Very fast (billions of operations per second) Very accurate Weaknesses of Computers Only simple operations Addition Comparison Equality No insight Introduction to Code: How Computers Work Code is a series of instructions Each instruction is an operation Computer follows each instruction, one after another Programs are comprised of millions of instructions Introduction to Code: The Programmer Computers are hugely useful Messaging Image editing Programmers convert human requirements into computer code Develop algorithms (which we'll see later in the course!) Computer Software What is a programmer? Someone who develops application or system software ▪ Programmer writes instructions/Code to direct computer to process data into information Introduction to Code: Tips and Previews Code is like Legos - small bricks to big structures Patience :) Computers do exactly what you tell them (no interpretive power) Introduction to Code: First Code Operation Using Javascript (plus some extensions- as an example) Each line of code is small First line: print! print(6); print(1, 2); print("hello"); Output 6 12 hello We can use print statements to make art print(" * *"); print(" *** ***"); print(" * *"); print(" [-] "); print(" ( )"); print(" -------"); Introduction to Code: Programming Errors Two types: syntax and logic errors Syntax Error means you violated the programming language regulations print(" * *") Missed semicolon Logic error is classified as a type of runtime error that can result in a program producing an incorrect output. It can also cause the program to crash when running. Dividing by zero Software Properties What is a graphical user interface (GUI)? Allows you to interact with the software using graphics and icons Controls how you enter data and how the screen displays information Computer Software What is system software? Programs that control the operations of the computer and its devices Operating System (OS) is a set of programs that coordinates all Utility Programs allow the user to activities among perform maintenance-type tasks computer hardware usually related to managing a devices and allows computer, its devices or its programs users to run application software Computer Software What is application software? Programs that perform specific tasks for users ▪ Suite Popular software applications bundled together as a single unit Word Spreadsheet Processing Presentation Database Graphics Programming Languages Code is written in a programming language Gives the "rules" (syntax and commands) for the code What programming languages have you heard of? Each has strengths and weaknesses and specializations (just like human languages) High-level (closer to how humans think) vs. low- level (closer to computers, but much faster) Types of Programming Languages Compiled "Source code" (what the programmer writes) is converted to "object code" (what the computer reads) Compiled once, run many times (like translating a book to another language) Interpreted Machine code instructions generated on the fly (like acting as a verbal translator in a conversation) Slower to run, but no compile step! Programming Languages: Source Code Source code is editable (what the programmer writes).exe/.app files are just machine code Can't change a program without the source code! License is to use the software, not change it Cracks are nonethical Open Source in Theory Idea: give everyone the source code! No more licenses (free to use) Examples: Programming languages Browsers Operating Systems Compilers Led to Linux Open Source in Practice Give out source code (Github) Users have a right to modify the source code Users are incentivized to contribute back with changes Results: Not a competitive advantage Higher quality Better use of resources Lifecycle of a program Load the program file from the file system Each program gets its own memory Program's code (instructions) Data the program manipulates (like file being edited) OS "fetches" an instruction, which is then run Begins with the first line of code Instructions like "return to step 5" keep the program running Lifecycle of a program At the end of the program, OS needs to stop fetching instructions and ensure program returns memory Ending programs Abnormal exit: Program "not responding" Use Activity Monitor (Mac)/Task Manager (Windows) "Illegal" activity: A program tries to access the memory of another program Out of Memory: A program requests more memory (e.g. you edit a lot of videos at once) THE COMPONENTS OF THE SYSTEM UNIT The System Unit What is the system unit ? system unit Case that contains electronic components of the computer used to process data ▪ Sometimes called the chassis system unit system unit system unit The System Unit What are common components inside the system unit? power supply Processor drive bays Memory Adapter cards processor ▪ Sound card ▪ Modem card memory ports ▪ Video card ▪ Network card Ports Drive bays sound card Power supply video card modem card network card The System Unit What is the motherboard? adapter cards Main circuit processor chip board in system unit Contains adapter memory chips cards, processor chips, and memory chips Also called system board memory slots Expansion slots for adapter cards motherboard The System Unit dual inline What is a chip? packages (DIP) holds memory chips Small piece of semi-conducting material on which integrated circuits are etched ▪ Integrated circuits contain many microscopic pathways capable of carrying electrical current pin grid array (PGA) package Chips are packaged so they can holds processor chips be attached to a circuit board Central Processing Unit What is the central processing unit (CPU)? Interprets and carries Processor out basic instructions Control Arithmetic that operate a computer Unit Logic Unit (ALU) ▪ Control unit directs and Instruction coordinates operations in Data computer Information ▪ Arithmetic logic unit (ALU) performs Input Output Devices Data Memory Information Devices arithmetic, comparison, and logical operations Instruction Also called the processor Data Information Storage Devices Central Processing Unit What is a machine cycle? Four operations of the CPU comprise a machine cycle The Operating System: Full Picture Name types of operating systems? Starts running when the computer "boots up" Manager/supervisor Starting/runs/stopping programs Manages all shared resources (like memory) No matter how a program ends, all resources must be released Can run multiple programs at once Allows a computer to change over time (updates) Other responsibilities: File system Manages windows Some basic programs OS: Starting a Program: Full Picture Load the program file from the file system (persistent storage) Each program gets its own RAM Program's machine code Data the program manipulates (like file being edited) Copy machine code from persistent storage to RAM OS: Running programs: Full Picture CPU "fetch/execute cycle" Fetch one instruction Execute (run) that instruction Repeat Machine code is loaded into RAM CPU begins at the top Instructions like "return to step 5" keep the program running OS: Program runs and exits normally: Full Picture Operating system starts and stops programs Each program has its own separate area in RAM: its instructions + data CPU "round robin" Persistent storage is organized as a file system, programs can read and write data here User quits the program Operating system reclaims shared resources OS: Abnormal Exit: Full Picture Program "not responding" The operating system stops running that program - involuntary vs. normal-exit The operating system reclaims the program's area of RAM Use Activity Monitor (Mac)/Task Manager (Windows) OS: Running Out Of Memory: Full Picture A program requests more RAM from the operating system e.g. to hold an image, but there's not enough RAM available The operating system refuses the request, the program gives an error message OS: Memory Access Error: Full Picture A program tries to access the memory of another program Maybe because of a bug (common) Maybe on purpose because it is malware The operating system blocks the access (ideally) Maybe kills the offending program too OS: Reboot: Full Picture Why does this fix anything? Sometimes some operating-system managed bytes in RAM is not quite right a bug in the operating system, or perhaps a hardware error A reboot wipes all the data from RAM Starts up the operating system fresh This should never be necessary Central Processing Unit What is pipelining? CPU begins fetching second instruction before completing machine cycle for first instruction Results in faster processing Central Processing Unit What is a register? Temporary high-speed storage area that holds data and instructions Stores location from where instruction was fetched Stores Stores data instruction while it is while ALU being decoded computes it Stores results of calculation Central Processing Unit What is the system clock? Controls timing of all computer operations Generates regular electronic pulses, or ticks, that set operating pace of components of system unit Pace of system clock is clock speed Processor speed can Each tick Most clock speeds are also be measured in is a in the gigahertz (GHz) millions of instructions clock cycle range (1 GHz = one per second (MIPS) billion ticks of system clock per second) Central Processing Unit How do personal computer processors compare? Comparison of Widely Used Personal Computer Processors Name Date Clock Introduced Speed Itanium® 2 2002 1 GHZ and up Xeon 2001 1.4–2.4 GHZ Itanium® 2001 733–800 MHZ Pentium® 4 2000 1.4–2.53 GHZ Pentium® III Xeon 1999 500–900 MHZ Pentium ® III 1999 400 MHZ–1.2 GHZ Celeron® 1998 266 MHZ–1.8 GHZ Operon 2003 To come Athlon MP 2002 1.53–1.6 GHZ Athlon XP 2001 1.33–1.73 GHZ Athlon 1999 500 MHZ–1.4 GHZ Central Processing Unit Which processor should you select? The faster the processor, the more expensive the computer Central Processing Unit What are heat sinks and heat pipes? heat sink fan Heat sink—component with fins that cools processor Heat pipe—smaller device for notebook computers heat sink Central Processing Unit What is parallel processing? Control Processor Using multiple processors simultaneously to Processor 1 Processor 2 Processor 3 Processor 4 execute a Memory Memory Memory Memory program faster Requires special software to divide problem and Results combined bring results together Data Representation How do computers represent data? Most computers are digital ▪ Recognize only two discrete states: on or off ▪ Use a binary system to recognize two states ▪ Use Number system with two unique digits: 0 and 1, called bits (short for binary digits) Data Representation What is a byte? 8 bits grouped together as a unit Provides enough different combinations of 0s and 1s to represent 256 individual characters ▪ Numbers ▪ Uppercase and lowercase letters ▪ Punctuation marks Data Representation What are three popular coding systems to represent data? ASCII—American Standard Code for Information Interchange EBCDIC—Extended Binary Coded Decimal Interchange Code Unicode—coding scheme capable of representing all languages of the world ASCII Symbol EBCDIC 00110000 0 11110000 00110001 1 11110001 00110010 2 11110010 00110011 3 11110011 Data Representation How is a letter converted to binary form and back? Step 1. The user presses Step 2. the capital letter D An electronic signal for the (shift+D key) on capital letter D is sent to the the keyboard. system unit. Step 4. Step 3. After processing, the binary The signal for the capital letter D code for the capital letter D is is converted to its ASCII binary converted to an image, and code (01000100) and is stored in displayed on the output device. memory for processing. Memory Seat #2B4 Seat #2B3 What is memory? Consists of one or more chips on motherboard or other circuit board Each byte stored in unique location called an address, similar to addresses on a passenger train Memory Memory stores three basic categories of items: 1) Operating system and other system software 2) Application programs 3) Data and the resulting information Memory How is memory measured? By number of bytes available for storage Term Abbreviation Approximate Size Kilobyte KB or K 1 thousand bytes Megabyte MB 1 million bytes Gigabyte GB 1 billion bytes Terabyte TB 1 trillion bytes Memory What is random access memory (RAM)? Most RAM is Also called volatile, it is lost main memory when computer’s or primary power is storage turned off Next Memory How do program instructions transfer in and out of RAM? RAM Step 1. When you start the computer, certain operating system files load into RAM from the Operating system Operating system hard disk. The operating system displays the user instructions interface interface on the screen. Step 2. When you start a Web browser, the program’s instructions load into RAM from the Web browser Web browser hard disk. The Web browser window is displayed instructions window on the screen. Step 3. When you start a word processing program, the program’s instructions load into RAM from the hard disk. The word processing Word processing Word processing program, along with the Web Browser and certain program instructions program window operating system instructions are in RAM. The word processing program window is displayed on the screen. RAM Step 4. When you quit a program, such as the Web browser, its program instructions are removed from RAM. The Web browser no longer is displayed on the screen. Web browser program Web browser instructions are window no longer is removed from RAM displayed on desktop Memory What are three basic types of RAM chips? Used for Most special common applications type such as (SRAM) cache Faster Faster and variations more reliable of DRAM are than DRAM SDRAM and chips RDRAM Dynamic RAM (DRAM) Static RAM (SRAM) Magnetoresistive RAM (MRAM): less power; more storage capability; faster access time; stable; more expensive Memory dual inline memory module Where does memory reside? Resides on small circuit board called memory module Memory slots on memory chip memory slot motherboard hold memory modules Memory How much RAM does an application require? Software package typically indicates System Requirements Windows XP HomeEdition/Professional ® RAM requirements Intel Pentium processor at 233MHZ or higher AMD K6 (Athlon Duron Family processor at 233MHZ or higher For optimal 64 MB of RAM performance, you need more than minimum specifications Memory What is cache? Helps speed computer processes by storing frequently used instructions and data Also called memory cache ▪ L1 cache built into processor ▪ L2 cache slower but has larger capacity ▪ L2 advanced transfer cache is faster, built directly on processor chip ▪ L3 cache is separate from processor chip on motherboard (L3 is only on computers that use L2 advanced transfer cache) Next Memory What is read-only memory (ROM)? Memory chips that store Nonvolatile memory, it is not permanent data lost when computer’s and instructions power is turned off Three types: EEPROM Firmware— (electrically Manufactured with erasable programmable permanently written PROM read-only memory)— data, instructions, (programmable Type of PROM or information read-only containing microcode memory)— programmer Blank ROM can erase chip onto which a programmer can write permanently Memory What is access time? Amount of time it takes processor to read data from memory Measured in nanoseconds (ns), one billionth of a second It takes 1/10 of a second to blink your eye; a computer can perform up to 10 million operations in same amount of time Term Speed Millisecond One-thousandth of a second Microsecond One-millionth of a second One-billionth of a second Nanosecond One-trillionth of a second Picosecond Expansion Slots and Expansion Cards Types of Adapter Cards What is an adapter card? Enhances system unit or provides connections to external devices called peripherals Also called an expansion card Expansion Slots and Expansion Cards What is an expansion slot? An opening, or socket, on the motherboard that can hold an adapter card With Plug and Play, the computer automatically configures cards and other devices as you install them Expansion Slots and Expansion Cards What are PC cards and flash memory cards? A PC card adds memory, sound, modem, and other capabilities to notebook computers A flash memory card allows users to transfer data from mobile devices to desktop computers ▪ Hot plugging allows you to insert and remove cards while computer is running Ports What are ports and connectors? Port connects external devices to system unit Connector joins cable to peripheral Ports What are different types of connectors? Ports What is a serial port? Transmits one bit of data at a time Connects slow-speed devices, such as mouse, keyboard, modem Ports What is a parallel port? Connects devices that can transfer more than one bit at a time, such as a printer Ports What are USB ports? USB (universal serial bus) port can connect up to 127 different peripherals together with a single connector type PCs typically have Third USB two to four USB ports Single USB port can device connects be used to attach to second USB on front or back of device, and so on the system unit multiple peripherals in a daisy chain Second USB device connects to first USB First USB device device connects to USB port on computer Ports What are special-purpose ports? Allow users to attach specialized peripherals (digital video cameras, color printers, scanners, and disk drives) or transmit data to wireless devices ▪ FireWire port ▪ MIDI (Musical Instrument Digital Interface) port ▪ SCSI (small computer system interface) port ▪ IrDA (Infrared Data Association) port ▪ Bluetooth port Buses What is a bus? Channel that allows devices inside computer to communicate with each other ▪ System bus connects processor and RAM ▪ Bus width determines number of bits transmitted at one time ▪ Word size is the number of bits processor can interpret and execute at a given time Buses What is an expansion bus? Allows processor to communicate with peripherals Bays What is a bay? Open area inside system unit used to install additional equipment Drive bays typically hold disk drives Categories of Computers What are the categories of computers? Personal computers (desktop) Mobile computers and mobile devices Midrange servers Mainframe computers Supercomputers Personal Computers What are the two most popular series of personal computers? PC and compatibles Apple Macintosh use the Windows uses the Macintosh operating system operating system (Mac OS) Personal Computers What is a desktop computer? Designed so all of the components fit on or under a desk or table Personal Computers What is a notebook computer? Portable, small enough to fit on your lap(2 lbs to 9 lbs ) Also called a laptop Generally more expensive than a desktop computer Handheld Computers What is a tablet PC? Resembles a letter-sized slate Allows you to write on the screen using a stylus Smaller version is the modular computer What are Web-enabled handheld computers? Allow you to check e-mail and access the Internet Web-enabled telephone is a “smart phone” Handheld Computers What is a personal digital assistant (PDA)? Provides personal organizer functions ▪ Calendar ▪ Appointment book ▪ Address book ▪ Calculator ▪ Notepad Servers What types of servers are there? Midrange server Powerful, large computer that supports up to a few thousand computers Mainframe Very powerful, expensive computer that supports thousands of computers Supercomputer The fastest, most powerful, most expensive computer. Used for applications requiring complex mathematical calculations Mobile Computers What is a mobile computer? Notebook, weighing between 2.5 and 8 pounds (1.13 and 3.63 kg), or mobile device such as a PDA flash memory card PDA PC Cards in PC Card slots CD or DVD drive disk in floppy disk drive or battery Zip® disk drive notebook computer Mobile Computers What is in the system unit of a mobile computer? Motherboard, processor, and memory—also devices such as the keyboard, speakers, and display Mobile Computers What ports are on a notebook computer? Mobile Computers What ports are on a tablet PC? Elements of an InformationSystem What are information system elements ? People Procedures Data Software Hardware Step 3. Software Step 2. processes data Step 1. People use and directs People develop software to hardware to procedures for enter data into store and or processing data computer output (hardware) information Networks and the Internet What is a network? Collection of computers and devices connected together Communications Device Communications Media Enables a Satellites Cables connection Telephone Cellular between lines radio computers One type is a modem Networks and the Internet Why do we need network? To share Resources Hardware devices Software programs To save Data time Information and money Networks and the Internet What is a server? Manages the resources on a network A client accesses the resources on the server Networks and the Internet What is the Internet? Worldwide collection of networks that connects millions of computers Networks and the Internet Why do users access the Internet? 1. Communications 2. Information 3. Shopping 4. Banking and Investing 5. Classes 6. Entertainment Networks and the Internet What is the World Wide Web (WWW)? Billions of documents, called Web pages, available to anyone connected to the Internet A Web site is a collection of related Web pages A Web page contains text, graphics, sound, video, and links to You can share other Web pages information by creating Web pages or posting photos on a photo community Hardware Circuits Basically, hardware is circuits Circuits are composed many digital logic gates Digital logic gates can take in multiple inputs and redirect to one output Logic gates are made up of transistors In order to understand Logic gates, we must understand Boolean algebra first Review of Boolean algebra Just like Boolean logic Variables can only be 1 or 0 Instead of true / false Review of Boolean algebra Not_ is a horizontal bar above the number 0_ = 1 1=0 Or is a plus 0+0 = 0 0+1 = 1 1+0 = 1 1+1 = 1…..?!...... And is multiplication 0*0 = 0 0*1 = 0 1*0 = 0 1*1 = 1 AND Gate Takes in 2 inputs, each either 0 or 1 Outputs 1 only if both inputs are 1 OR Gate Takes in 2 inputs, each either 0 or 1 Outputs 1 only if at least input is 1 XOR Gate Takes in 2 inputs, each either 0 or 1 Outputs 1 only if both inputs are 1 OR both inputs are 0 Stands for "exclusive or" NOT Gate Takes in 1 input, each either 0 or 1 Outputs the "flipped" input ~1 is 0; ~0 is 1 Basic logic gates ONLY 1 or 2 inputs and 1 output x Not x x xy And y x x+y Or y x xy Nand y x+y Nor x y Xor x xÅy y COMBINATIONAL GATES Summary Name Symbol Function Truth Table A B X A X=A B 0 0 0 AND X or 0 1 0 1 0 0 B X = AB 1 1 1 A B X A 0 0 0 OR X X=A+B 0 1 1 1 0 1 B 1 1 1 A X I 0 1 A X X = A’ 1 0 A X 0 0 Buffer A X X=A 1 1 A B X A 0 0 1 NAND 0 1 1 X X = (AB)’ 1 0 1 B 1 1 0 A B X A 0 0 1 NOR X X = (A + B)’ 0 1 1 0 0 0 B 1 1 0 A B X A X=AÅB XOR X or 0 0 0 1 0 1 Exclusive OR 1 0 1 B X = A’B + AB’ 1 1 0 A B X A X = (A Å B)’ XNOR X or 0 0 0 1 1 0 Exclusive NOR B X = A’B’+ AB 1 0 0 or Equivalence 1 1 1 Converting between Logic gates/Logic diagram and Boolean algebraic expressions/Boolean function Find the output of the following circuit x x+y y (x+y)y y y __ Answer: (x+y)y Find the output of the following circuit x x xy xy y y ___ __ Answer: xy Write the circuits for the following __ Boolean algebraic expressions a) x+y x x+y x y Write the circuits for the following Boolean algebraic expressions _______ b) (x+y)x x x+y (x+y)x x+y y Writing xor using and/or/not x y xÅy 1 1 0 1 0 1 0 1 1 0 0 0 x x+y (x+y)(xy) y xy xy LOGIC CIRCUIT DESIGN x y z F 0 0 0 0 Truth 0 0 1 1 Table 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1 F = x’y’z + xy’z’ + xy’z + xyz’ + xyz F = x’y’z + xy’ (z’ + z) + xy (z’ + z) Boolean F = x’y’z + xy’ + xy Function F = x’y’z + x (y’ + y) F = x’y’z + x x F Logic y Diagram z Thank U IT101 IT FUNDAMENTALS Dr. Islam Taj-Eddin Dr. Ali Hussein Ahmed Dr. Tarik Mohamed Abdel-Kader Ibrahim Dr. Ebram Kamal William Aziz IT Department, Faculty of Computers and Information Assiut University 2024-2025 Enroll The course on Thinqi LMS https://aun.edu.eg/thinqi Code=IT101-1 LECTURE 4&5 Problem Solving Objectives Identify Important Terms Know How to Develop Programs List Problems Solving Tools Apply Problems Solving Tools What are the meanings of the terms "hardware" and "software”? Hardware refers to the physical components of the computer, including all peripherals, the central processing unit, disk drives, and all mechanical and electrical devices. Programs are referred to as software. What are the meanings of the terms "programmer" and "user”? A programmer is a person who solves problems by writing programs on a computer. After analyzing the problem and developing a plan for solving it, he or she writes and tests the program that instructs the computer how to carry out the plan. A user is any person who uses a program. Are there certain features that all programs have in common? Most programs do three things: – Take in data, – Manipulate them, – and give desired information. These operations are referred to as – input, – processing, – and output. Graphic representation of the problem solving process 8 Problem Solving Program Development Cycle Software refers to a collection of instructions for the computer The computer only knows how to do what the programmer tells it to do Therefore, the programmer has to know how to solve problems What is meant by problem solving? Problems are solved by carefully reading them to determine what data are given and what outputs are requested. Then a step-by-step procedure is devised to process the given data and produce the requested output. This procedure is called an algorithm. Finally, a computer program is written to carry out the algorithm. Algorithm A step by step series of instructions for solving a problem (a recipe is an example of an algorithm) 12 Program development cycle 1. Analyze: Define the problem (inputs, process, outputs). 2. Design: Plan the solution to the problem (Algorithm). 13 Performing a Task on the Computer Determine Output Identify Input Determine process necessary to turn given Input into desired Output Problem-solving: approach like algebra class How fast is a car traveling if it goes 50 miles in 2 hours? Process: speed = distance / time Output: a number giving the speed in miles per hour Input: the distance and time the car has traveled Program development cycle 3. Code: Translate the algorithm into a programming language. 4. Test and debug: Locate and remove any errors in the program. 5. Complete the documentation: Organize all the materials that describe the program. 16 Programming Tools Three tools are used to convert algorithms into computer programs: Hierarchy chart - Shows how the different parts of a program relate to each other. Flowchart - Graphically depicts the logical steps to carry out a task and shows how the steps relate to each other. Pseudocode - Uses English-like phrases with some Visual Basic terms to outline the program. 17 Problem solving example How many stamps do you use when mailing a letter? One rule of thumb is to use one stamp for every five sheets of paper or fraction. 18 Algorithm 1. Request the number of sheets of paper; call it Sheets. (input) 2. Divide Sheets by 5. (processing) 3. Round the quotient up to the next highest whole number; call it Stamps. (processing) 4. Reply with the number Stamps. (output) 19 Flowcharts Graphically depict the logical steps to carry out a task and show how the steps relate to each other. 20 Flowchart symbols 21 Flowchart symbols 22 Flowchart example 23 Pseudocode Uses English-like phrases with some C terms to outline the task. 24 Pseudocode example Determine the proper number of stamps for a letter Read Sheets (input) Set the number of stamps to Sheets / 5 (processing) Round the number of stamps up to the next whole number (processing) Display the number of stamps (output) 25 Hierarchy charts Show how the different parts of a program relate to each other Hierarchy charts may also be called structure charts HIPO (Hierarchy plus Input-Process-Output) charts top-down charts VTOC (Visual Table of Contents) charts 26 Hierarchy charts example 27 Divide-and-conquer method Used in problem solving – take a large problem and break it into smaller problems solving the small ones first Breaks a problem down into modules 28 Statement structures / Programming Construct 1. Sequence – follow instructions from one line to the next without skipping over any lines 2. Decision - if the answer to a question is “Yes” then one group of instructions is executed. If the answer is “No,” then another is executed 3. Looping – a series of instructions are executed over and over 29 Sequence flow chart 30 Decision flow chart 31 Relational Operators Relational Operators Operator Description > Greater than < Less than = Equal to Greater than or equal to Less than or equal to Not equal to Looping flow chart 33 Direction of Numbered NYC Streets Algorithm Problem: Given a street number of a one-way street in New York City, decide the direction of the street, either eastbound or westbound Discussion: in New York City even numbered streets are Eastbound, odd numbered streets are Westbound 34 Pseudocode Program: Determine the direction of a numbered NYC street Get street If street is even Then Display Eastbound Else Display Westbound End If 35 Hierarchy Chart 36 Class Average Algorithm Problem: Calculate and report the grade-point average for a class Discussion: The average grade equals the sum of all grades divided by the number of students Input: Student grades Processing: Find the sum of the grades; count the number of students; calculate average Output: Average grade 37 Flowchart 38 Pseudocode Program: Determine the average grade of a class Initialize Counter and Sum to 0 Do While there are more data Get the next Grade Add the Grade to the Sum Increment the Counter Loop Computer Average = Sum / Counter Display Average 39 Hierarchy Chart 40 Comments When tracing a flowchart, start at the start symbol and follow the flow lines to the end symbol Flowcharts, pseudocode, and hierarchy charts are program planning tools that are not dependent on the programming language being used 41 Comments continued As we said before, There are four primary logical programming constructs: 1. sequence 2. decision 3. loop 4. unconditional branch 42 Unconditional branch Appear in some languages as Goto statements Involves jumping from one place in a program to another Structured programming uses the sequence, decision, and loop constructs but forbids the unconditional branch 43 Tips and tricks of flowcharts Flowcharts are time-consuming to write and difficult to update For this reason, professional programmers are more likely to favor pseudocode and hierarchy charts Because flowcharts so clearly illustrate the logical flow of programming techniques, they are a valuable tool in the education of programmers 44 Tips and tricks of pseudocode There are many styles of pseudocode Some programmers use an outline form Some use a form that looks almost like a programming language 45 Tips and tricks of hierarchy charts Many people draw rectangles around each item in a hierarchy chart In the text, rectangles are omitted to encourage the use of hierarchy charts by making them easier to draw 46 Example (1) Describe the process of washing hands. Example (2) Write a flow chart that reads two numbers and calculates their summation. Example (3) Write a flowchart that reads three numbers and finds the largest one. Language Constructs (cont.) Language Constructs (cont.) Selection ❖Single-Selection IF IF condition THEN statement 1 etc. ENDIF The rest of the program Language Constructs (cont.) ❖Double-Selection IF IF condition THEN statement 2 ELSE statement 3 ENDIF statement 4 Language Constructs (cont.) Example: Input a set of 4 marks Calculate their average by summing and dividing by 4 IF average is below 50 THEN Print “FAIL” ELSE Print “PASS” ENDIF Language Constructs (cont.) Language Constructs (cont.) ❖Multiple selection SWITCH expression TO case 1: action 1 case 2: action 2 etc. default: action x Language Constructs (cont.) Repetition: ❖While loop: WHILE condition statement 1 etc. ENDWHILE The rest of the program Language Constructs (cont.) Example: Set x=1 WHILE x

Use Quizgecko on...
Browser
Browser