Docsity

Computer Science Notes: Programming Basics, Data Structures & Practice Exercises, Study notes of Computer science

Toggle sidebar
bg1
Computer Science Notes โ€“ Introduction & Programming Basics
1. Introduction to Computer Science
Computer Science (CS) is the study of computers, algorithms, and problem-
solving using software and hardware. It combines theory, programming, and
practical applications.
Applications: Web development, AI, data science, robotics, cybersecurity,
software engineering.
2. Basics of Computers
2.1 Components of a Computer
1. Input Devices โ€“ Keyboard, Mouse, Scanner
2. Output Devices โ€“ Monitor, Printer, Speakers
3. Central Processing Unit (CPU) โ€“ Brain of the computer; handles
processing.
oComponents: ALU (Arithmetic Logic Unit), Control Unit, Registers
4. Memory & Storage
oRAM: Temporary, fast-access memory
oROM: Read-only memory
oHard Disk / SSD: Long-term storage
2.2 Software Types
๏‚ทSystem Software: Operating Systems, Device Drivers
๏‚ทApplication Software: Word processors, Browsers, Games
3. Programming Fundamentals
3.1 Programming Languages
๏‚ทHigh-Level Languages: Python, Java, C++ โ€“ human-readable
๏‚ทLow-Level Languages: Assembly, Machine code โ€“ hardware-oriented
3.2 Basic Programming Concepts
1. Variables: Store data
o
Example:
age = 20
2. Data Types: Integer, Float, String, Boolean
3. Operators: Arithmetic (+, -, *, /), Comparison (==, >, <)
pf3

Partial preview of the text

Download Computer Science Notes: Programming Basics, Data Structures & Practice Exercises and more Study notes Computer science in PDF only on Docsity!

Computer Science Notes โ€“ Introduction & Programming Basics

1. Introduction to Computer Science Computer Science (CS) is the study of computers, algorithms, and problem- solving using software and hardware. It combines theory, programming, and practical applications. Applications: Web development, AI, data science, robotics, cybersecurity, software engineering. 2. Basics of Computers 2.1 Components of a Computer 1. Input Devices โ€“ Keyboard, Mouse, Scanner 2. Output Devices โ€“ Monitor, Printer, Speakers 3. Central Processing Unit (CPU) โ€“ Brain of the computer; handles processing. o Components: ALU (Arithmetic Logic Unit), Control Unit, Registers 4. Memory & Storage o RAM: Temporary, fast-access memory o ROM: Read-only memory o Hard Disk / SSD: Long-term storage 2.2 Software Types ๏‚ท System Software: Operating Systems, Device Drivers ๏‚ท Application Software: Word processors, Browsers, Games 3. Programming Fundamentals 3.1 Programming Languages ๏‚ท High-Level Languages: Python, Java, C++ โ€“ human-readable ๏‚ท Low-Level Languages: Assembly, Machine code โ€“ hardware-oriented 3.2 Basic Programming Concepts 1. Variables: Store data

o Example: age = 20

  1. Data Types: Integer, Float, String, Boolean
  2. Operators: Arithmetic (+, -, *, /), Comparison (==, >, <)
  1. Input/Output โ€“ Reading user input and displaying output

o Example in Python:

name = input("Enter your name: ") print("Hello,", name) 3.3 Control Structures

  1. Conditional Statements โ€“ Decision making if score >= 50: print("Pass") else: print("Fail")
  2. Loops โ€“ Repeat tasks o For Loop: for i in range(5): print(i) o While Loop: x = 0 while x < 5: print(x) x += 1 4. Functions ๏‚ท Definition: A block of code performing a specific task. ๏‚ท Example: def add(a, b): return a + b result = add(5, 3) print(result) # Output: 8 ๏‚ท Benefits: Reusability, modularity, easy debugging. 5. Data Structures (Introduction) Type Description Example Array Collection of elements of same type [1,2,3,4] List Ordered collection, can contain different types [1, "hello", 3.5] Stack LIFO (Last In First Out) Browser