Computer Basics PDF
Document Details
Uploaded by Deleted User
Tags
Related
Summary
This document provides a foundational overview of computer basics, including hardware and software components, data representation, and network types. It covers topics such as the CPU, RAM, secondary storage, and different types of networks.
Full Transcript
Computer Basics: -Hardware: physical, tangible parts (keyboard, monitor, disks, chips) -Software: programs and data -Both hardware and software are essential for computer function Main Components: -Central Processing Unit (CPU): executes program commands -Main Memory (RAM): primary sto...
Computer Basics: -Hardware: physical, tangible parts (keyboard, monitor, disks, chips) -Software: programs and data -Both hardware and software are essential for computer function Main Components: -Central Processing Unit (CPU): executes program commands -Main Memory (RAM): primary storage for active programs and data -Input/Output Devices: facilitate user interaction (monitor, keyboard, mouse) -Secondary Memory: long-term storage (hard disk, USB flash drive) Software Categories: -Operating System: controls machine activities, manages resources -Application Programs: specific software for various tasks Data Representation: -Analog: continuous, proportional representation -Digital: information broken into discrete pieces -Computers store all information digitally (numbers, text, graphics, audio, video) Computer Architecture: -Memory divided into cells with unique addresses -Information stored in bytes (usually 8 bits) -Storage capacity measured in KB, MB, GB, TB, PB Memory Types: -Main memory (RAM): volatile, direct access -Secondary memory: non-volatile, can be direct or sequential access -ROM: Read-Only Memory Central Processing Unit (CPU): -Follows fetch-decode-execute cycle -Components: Arithmetic/Logic Unit, Registers, Control Unit =Speed measured in gigahertz (GHz) Networks: -Two or more connected computers sharing data and resources -Each computer has a unique network address -File servers store shared programs and data Network Types: -Local Area Network (LAN): covers small distance/number of computers -Wide Area Network (WAN): connects multiple LANs, often over long distances Internet: -Global WAN using TCP/IP protocols -Each computer has unique IP address and domain name -Domain Name System (DNS) translates between IP addresses and domain names World Wide Web: -Accessed through browsers (e.g., Internet Explorer, Safari, Firefox) -Uses HTML for document structure -Resources located using URLs (Uniform Resource Locators) Lecture 2 Java Programming Language: -Created by Sun Microsystems in 1995 -Program structure: classes containing methods and statements -Java applications always have a main method Java Program Components: -Comments: explain program purpose and processing steps -Identifiers: "words" in a program (letters, digits, underscore, dollar sign) -Reserved words: predefined meanings in the language Program Development: -Writing code in a specific language -Translating code into executable form -Debugging errors Java Translation Process: Java source code compiled into bytecode Bytecode executed by Java Virtual Machine (JVM) Makes Java architecture-neutral Types of Errors: -Compile-time errors: syntax errors caught by compiler -Run-time errors: occur during program execution -Logical errors: program runs but produces incorrect results Object-Oriented Programming Concepts: -Objects: fundamental entities representing real-world concepts -Classes: blueprints for objects, defining state and behavior -Inheritance: deriving new classes from existing ones Indentation Rules: Definition: Indentation is the act of shifting text to the right by adding spaces or tabs at the beginning of lines. Syntactically Not Mandatory: From a purely syntactical perspective, indentation is not mandatory in most programming languages, including Java. Purpose: To visually represent the hierarchical structure of the code. To make it easier to identify which statements belong to which blocks of code. Best Practices: Following indentation rules is part of adhering to coding standards and best practices. Readability and Debugging: Proper indentation makes code structure clear, aiding in understanding and debugging. Language Specificity: In some languages like Python, indentation is part of the syntax and affects how the code runs. In Java, it's for readability only and doesn't affect execution. Common Indentation Units: Spaces: Usually 2, 4, or 8 spaces. Tabs: A single tab character. Consistency: Use consistent indentation throughout a file and project. Relation to Code Blocks: In most programming styles, each new block (defined by curly braces {} in Java) is indented one level. Not Just for Blocks: Indentation is also used for line continuation, aligning parameters in method calls, etc. Class Definition: The class body should be indented one level inside the class declaration. Method Definition: The method body should be indented one level inside the method declaration. Line Wrapping: If a line of code is too long and needs to be wrapped, indent the continued line. Typically, indent the wrapped part by 8 spaces or two levels. Comments: Inline comments should be indented to the same level as the code they describe. Block comments can start at the same indentation as the code they precede. Alignment: When breaking long method calls or declarations, align parameters under each other.