MTL CSC 111
MTL CSC 111
LECTURE 1
What is a Computer?
o A programmable electronic device capable of performing mathematical, logical,
and graphical manipulations.
o Operates under the control of stored instructions and processes data from input to
output.
What is Computer Science?
o The study of computers and computing, including theoretical foundations,
hardware, software, and their application in processing information.
Data: Raw facts, figures, and symbols (e.g., unordered lists of student names and marks).
Information: Processed data that is organized and presented in a meaningful way (e.g.,
sorted lists, calculated totals and averages).
Program: A set of instructions that directs a computer to perform specific tasks.
4. History of Computers
Human Computers:
o Originally, "computers" were people skilled in mathematical calculations.
Early Calculation Devices:
o Tally Sticks: Ancient tools for recording numbers, quantities, or messages.
o Abacus: A mechanical device used for performing mathematical calculations.
o Napier’s Bones: Invented in 1614 by John Napier, these rods aided in
multiplication, division, and computing square/cube roots.
Assignments Mentioned:
o Write a short note on several historical devices (Slide Rule, Pascaline, Stepped
Reckoner, Jacquard Loom, Arithmometer, Difference Engine, and Analytical
Engine), including their years of invention and their uses.
o Explore the history of computer generations.
1
Discussion Topics:
o Impact of Computers on Society: How computers have transformed work,
communication, and everyday life.
o Computers vs. Humans: A comparison highlighting the strengths of computers
(speed, accuracy, storage, automation) against human capabilities, while noting
that computers cannot think or feel.
6. Advantages of Computers
7. Limitations of Computers
Questions
1. What is a computer?
a) A mechanical device for writing letters
b) A programmable electronic device that processes data
c) A device that stores only images
d) A tool for manual calculations
o Answer: b) A programmable electronic device that processes data
2. What is Computer Science?
a) The study of human behavior
b) The study of cooking techniques
c) The study of computers, including their theoretical and algorithmic foundations,
hardware, software, and applications
d) The study of natural sciences only
o Answer: c) The study of computers, including their theoretical and algorithmic
foundations, hardware, software, and applications
2
3. In computing terms, what is “data”?
a) Processed information in an organized form
b) Raw facts, figures, and symbols
c) A set of instructions for the computer
d) The output produced by a computer
o Answer: b) Raw facts, figures, and symbols
4. What does “information” mean?
a) Unorganized raw data
b) Data that has been processed and organized to be meaningful
c) A type of computer program
d) Only numbers and statistics
o Answer: b) Data that has been processed and organized to be meaningful
5. What is a program?
a) A storage device for data
b) A set of instructions that enables a computer to perform a given task
c) An output produced by a computer
d) A type of hardware component
o Answer: b) A set of instructions that enables a computer to perform a given task
2. History of Computers
6. Who were the “computers” in the early days before electronic devices?
a) Automated robots
b) Specialized software programs
c) Humans trained to perform calculations
d) Abacuses
o Answer: c) Humans trained to perform calculations
7. What was the primary purpose of tally sticks in ancient times?
a) To perform complex algebra
b) To record and document numbers, quantities, or messages
c) To process digital information
d) To store images
o Answer: b) To record and document numbers, quantities, or messages
8. What is an abacus?
a) A digital storage device
b) A mechanical device used to perform mathematical calculations
c) A type of computer virus
d) A modern computer peripheral
o Answer: b) A mechanical device used to perform mathematical calculations
9. Who invented Napier’s Bones, and what was its primary use?
a) Charles Babbage; for designing computers
b) John Napier; for multiplying, dividing, and calculating square/cube roots
c) Isaac Newton; for solving physics problems
d) Alan Turing; for breaking codes
3
o Answer: b) John Napier; for multiplying, dividing, and calculating square/cube
roots
10. When was the word "computer" first recorded to refer to a person?
a) In the 18th century
b) In 1613
c) In the 20th century
d) In 1492
o Answer: b) In 1613
4
c) Cost effectiveness
d) Versatility
o Answer: b) Storage
16. Which advantage refers to a computer’s capability to perform repetitive tasks
consistently?
a) High Speed
b) Diligence
c) Versatility
d) Accuracy
o Answer: b) Diligence
17. What is one major limitation of computers mentioned in the lecture?
a) They are too fast for most applications
b) They can operate without any power supply
c) They cannot think or feel emotions
d) They are always cost-effective
o Answer: c) They cannot think or feel emotions
5. Additional Concepts
5
c) Programs
d) Algorithms
o Answer: b) Data
22. What term is used for data that has been processed and organized in a meaningful
way?
a) Data
b) Information
c) Programs
d) Code
o Answer: b) Information
23. What is a “program” in the context of computers?
a) A storage unit for data
b) A set of instructions that tells the computer what tasks to perform
c) The hardware that executes operations
d) A type of input device
o Answer: b) A set of instructions that tells the computer what tasks to perform
24. Which of the following historical devices was used as a memory aid for numbers?
a) Abacus
b) Tally Stick
c) Napier’s Bones
d) Analytical Engine
o Answer: b) Tally Stick
25. The lecture assigns a short note on several historical devices. What is the primary
purpose of this assignment?
a) To discuss modern computer programming techniques
b) To explore the evolution of calculating devices and understand their historical context
c) To analyze computer networks
d) To design a new computer system
o Answer: b) To explore the evolution of calculating devices and understand their
historical context
Lecture 2
History of Computers
3. Computer Constituents
6
o Hardware: The physical components of a computer (e.g., monitor, keyboard,
system unit).
o Software: A set of instructions that directs the hardware to perform specific tasks.
Desktop Computer Components:
o System Unit: The core of the computer where key components reside.
o Central Processing Unit (CPU): The “brain” responsible for processing and
calculations.
o Random Access Memory (RAM): Temporarily stores data used by the CPU
while the computer is on.
o Cabling: Almost every peripheral device connects to the system unit via cables.
5. Input Devices
7
Graphic Tablet, Touchscreen, Light Pen, and Stylus: Various devices
that allow direct input via touch or drawing.
Joystick/Gamepad: Typically used for gaming and specialized
applications.
o Imaging & Video Input Devices:
Digital Camera & Webcam: Capture images or live video.
Optical Scanners: Convert physical documents or images into digital
format (available as flatbed or handheld).
3D Scanner: Collects three-dimensional data from real-world objects.
Fingerprint Scanner & Barcode Reader: Used for security and
inventory management.
o Audio Input Devices:
Microphone: Captures sound.
MIDI Keyboard: Used to input musical data.
6. Output Devices
8
o Projector: Displays enlarged images or video on a large screen, used in
presentations and classrooms.
Types of Projectors: CRT projectors, LCD projectors, and Digital Light
Processing (DLP) projectors.
Generations of Computers
The evolution of computers is typically divided into several generations, each marked by
significant technological breakthroughs and changes in design, performance, and application.
9
help perform multiplication, division, and extraction of roots through repeated addition
and subtraction.
9. Slide Rule:
An analog computational tool based on logarithmic scales, used from the 17th century
until the advent of electronic calculators to perform multiplications, divisions, and more
complex functions like exponentiation.
10. Pascaline:
Created by Blaise Pascal in the 1640s, this early mechanical calculator used a series of
interlocking gears to perform addition and subtraction, marking one of the first devices to
automate arithmetic.
11. Stepped Reckoner:
Designed by Gottfried Wilhelm Leibniz, this mechanical calculator improved on earlier
devices by incorporating a stepped drum mechanism, enabling it to perform
multiplication and division as well as addition and subtraction.
12. Jacquard Loom:
Developed by Joseph Marie Jacquard in 1804, this loom used punched cards to control
the weaving of complex patterns, demonstrating early ideas of programmability that
influenced later computing.
13. Arithmometer:
A 19th-century mechanical calculator that became one of the first mass-produced devices
for performing reliable arithmetic operations in business and industry.
14. Difference Engine:
Conceptualized by Charles Babbage, this mechanical calculator was designed to compute
polynomial functions using the method of finite differences, aimed at automating the
creation of mathematical tables.
15. Analytical Engine:
Also proposed by Babbage, this was the first design for a general-purpose programmable
computer. It incorporated features such as a memory, a control unit, and the use of
punched cards to input instructions—foreshadowing modern computer architecture.
Questions
1. What is an abacus?
a) A mechanical calculator with interlocking gears
b) A manual counting tool with beads on rods
c) A device that uses punched cards for calculations
d) A slide-based logarithmic tool
o Answer: b) A manual counting tool with beads on rods
2. Tally sticks were primarily used for:
a) Recording numbers and quantities through notches
b) Multiplying large numbers using rods
c) Automating arithmetic operations
d) Encrypting secret messages
o Answer: a) Recording numbers and quantities through notches
10
3. Napier’s Bones are best described as:
a) A set of rods with numbers used to aid in multiplication and division
b) An early form of abacus used in Asia
c) A precursor to the slide rule using logarithms
d) A mechanical calculator that used gears
o Answer: a) A set of rods with numbers used to aid in multiplication and division
4. In what year were Napier’s Bones invented?
a) 1614
b) 1492
c) 1701
d) 1804
o Answer: a) 1614
3. Mechanical Calculators
11
9. Which device introduced a stepped drum mechanism to improve calculations?
a) Napier’s Bones
b) Pascaline
c) Stepped Reckoner
d) Arithmometer
o Answer: c) Stepped Reckoner
10. The Stepped Reckoner, designed by Leibniz, could perform:
a) Only addition
b) Addition, subtraction, multiplication, and division
c) Logical operations
d) Data storage
o Answer: b) Addition, subtraction, multiplication, and division
12
5. Pioneering Computing Machines
13
21. First-generation computers were characterized by the use of:
a) Transistors
b) Integrated circuits
c) Vacuum tubes
d) Microprocessors
o Answer: c) Vacuum tubes
22. Second-generation computers replaced vacuum tubes with:
a) Optical fibers
b) Transistors
c) Integrated circuits
d) Punched cards
o Answer: b) Transistors
23. Which generation of computers saw the widespread use of high-level programming
languages?
a) First Generation
b) Second Generation
c) Third Generation
d) Fifth Generation
o Answer: c) Third Generation
24. The concept of programmability through punched cards was first demonstrated by:
a) The Pascaline
b) Napier’s Bones
c) The Jacquard Loom
d) The Difference Engine
o Answer: c) The Jacquard Loom
25. Which invention is credited with laying the conceptual foundation for modern
computers by introducing programmability?
a) Abacus
b) Analytical Engine
c) Slide Rule
d) Arithmometer
o Answer: b) Analytical Engine
26. The Stepped Reckoner was significant because it:
a) Was the first device to use punched cards
b) Improved mechanical calculation with its stepped drum design
c) Was the first electronic computer
d) Used binary code for computations
o Answer: b) Improved mechanical calculation with its stepped drum design
27. Which invention used logarithmic scales to simplify complex calculations before
electronic calculators became common?
a) Napier’s Bones
14
b) Slide Rule
c) Pascaline
d) Abacus
o Answer: b) Slide Rule
28. What common feature did both the Difference Engine and the Analytical Engine
share?
a) They were both built using transistors
b) They both used punched cards for programming
c) They both aimed to automate mathematical computations
d) They were both mass-produced commercial products
o Answer: c) They both aimed to automate mathematical computations
29. How did early computing devices like the abacus and tally sticks contribute to
modern computing?
a) They introduced the concept of binary arithmetic
b) They established early methods for counting and data recording
c) They directly led to the development of the microprocessor
d) They were used as storage devices in modern computers
o Answer: b) They established early methods for counting and data recording
30. The historical evolution of computing devices demonstrates a continuous trend
toward:
a) Larger, less efficient machines
b) Increasing manual intervention in calculations
c) Greater automation, efficiency, and programmability
d) Reliance solely on human computation
o Answer: c) Greater automation, efficiency, and programmability
LECTURE 3
COMPUTER HARDWARE
Computer Hardware
Definition: The physical components of a computer.
Architecture/Configuration: The design and structure of hardware.
Categories of Hardware:
1. Central Processing Unit (CPU)
2. Main Memory
3. Peripheral Devices (External hardware like printers, scanners).
15
3. Central Processing Unit (CPU) – Processes data.
o Includes Arithmetic Logic Unit (ALU) and Control Unit.
4. Output Unit – Displays the results of processing.
3. Input Devices
Devices used to enter data into the computer.
Types of Keyboards
Keyboard Layouts
16
4. Pointing Devices
Definition: Devices used to control cursor movement.
Examples
Examples
17
7. Output Devices
Devices that display or output processed data.
Types of Monitors
Monitor Features
8. Printers
Devices used to produce hard copies of digital data.
Types of Printers
18
CPS (Characters per second)
LPM (Lines per minute)
PPM (Pages per minute)
9. Plotters
Definition: Used for printing vector graphics (e.g., architectural drawings).
Difference from Printers: Uses pens to draw lines instead of spraying ink.
11. Projectors
Definition: Display computer output on a larger screen.
Types of Projectors
1. Cathode Ray Tube (CRT) Projector – Uses three CRTs (Red, Green, Blue).
2. Liquid Crystal Display (LCD) Projector – Uses liquid crystal panels.
3. Digital Light Processing (DLP) Projector – Uses micro mirrors for better quality.
Output Devices
Definition: Hardware that displays or outputs processed data from a computer.
Examples: Monitor, Printer, Speakers, Projector.
19
2. Monitors (Display Devices)
Types of Monitors
1. Monochrome Monitor – Displays two colors (e.g., black & white, green & black).
2. Color Monitor (RGB Monitor) – Displays up to millions of colors.
3. Cathode Ray Tube (CRT) Monitor – Old, bulky monitor type.
4. Liquid Crystal Display (LCD) Monitor – Uses liquid crystals for better energy
efficiency.
5. Light-Emitting Diode (LED) Monitor – Improved LCD with higher contrast and better
viewing angles.
Monitor Features
3. Printers
Definition: A device that prints digital data on paper.
Types of Printers
1. Laser Printer (Toner-based) – Uses laser technology for high-quality text and graphics.
2. Inkjet Printer – Sprays liquid ink onto paper.
3. Thermal Printer (Inkless) – Uses heat-sensitive paper.
20
Characters per Second (CPS)
Lines per Minute (LPM)
Pages per Minute (PPM)
4. Plotters
Definition: A specialized printer used for printing vector graphics (e.g., architectural
designs).
Difference from printers: Uses pens to draw lines instead of ink.
6. Projectors
Definition: Displays computer output on a larger screen.
Used in: Meetings, presentations, classrooms.
Types of Projectors
1. Cathode Ray Tube (CRT) Projector – Uses three CRTs (Red, Green, Blue).
2. Liquid Crystal Display (LCD) Projector – Uses liquid crystal panels.
3. Digital Light Processing (DLP) Projector – Uses tiny mirrors to reflect light.
Questions
21
c) Web browsers
d) Output devices
o Answer: c) Web browsers
3. Which part of the computer is responsible for processing data?
a) Monitor
b) Central Processing Unit (CPU)
c) Hard Disk Drive (HDD)
d) RAM
o Answer: b) Central Processing Unit (CPU)
4. What are the two main components of the CPU?
a) Monitor and Keyboard
b) Arithmetic Logic Unit (ALU) and Control Unit (CU)
c) RAM and ROM
d) Hard Drive and SSD
o Answer: b) Arithmetic Logic Unit (ALU) and Control Unit (CU)
5. Which of the following is NOT an example of computer hardware?
a) Printer
b) Operating System
c) Motherboard
d) RAM
o Answer: b) Operating System
2. Input Devices
6. What is the function of an input device?
a) Displays information on a screen
b) Stores data permanently
c) Allows the user to enter data into the computer
d) Connects computers to the internet
o Answer: c) Allows the user to enter data into the computer
7. Which of the following is NOT an input device?
a) Keyboard
b) Mouse
c) Monitor
d) Scanner
o Answer: c) Monitor
8. Which input device is used to enter alphanumeric data?
a) Joystick
b) Scanner
c) Keyboard
d) Webcam
o Answer: c) Keyboard
9. Which input device uses a light-sensitive sensor to scan images or documents?
a) Mouse
22
b) Scanner
c) Touchpad
d) Gamepad
o Answer: b) Scanner
10. Which of these is a biometric input device?
a) Microphone
b) Fingerprint scanner
c) Projector
d) Hard drive
3. Pointing Devices
11. Which of the following is an example of a pointing device?
a) Speaker
b) Mouse
c) Printer
d) RAM
Answer: b) Mouse
Answer: b) Touchpad
14. Which pointing device is used for digital drawing and sketching?
a) Scanner
b) Graphic tablet
c) Microphone
d) Joystick
23
Answer: b) Graphic tablet
Answer: c) Gamepad
Answer: b) Webcam
Answer: b) 3D scanner
18. Which device captures video input and allows for live streaming?
a) Printer
b) Webcam
c) Trackball
d) Stylus
Answer: b) Webcam
19. Which device scans barcodes and converts them into digital data?
a) Digital camera
b) Barcode reader
c) Microphone
d) Joystick
24
20. What type of scanner is commonly used at retail stores?
a) 3D scanner
b) Flatbed scanner
c) Barcode scanner
d) Optical scanner
Answer: c) Microphone
6. Output Devices
24. What is the primary function of an output device?
a) To enter data into a computer
b) To process information
c) To display, print, or transmit the results of processing
d) To store data permanently
25
Answer: c) To display, print, or transmit the results of processing
Answer: c) Keyboard
Answer: c) CRT
28. Which type of output device projects a computer screen onto a larger surface?
a) Monitor
b) Projector
c) Printer
d) Speaker
Answer: b) Projector
30. Which device converts digital sound signals into audio output?
a) Projector
b) Printer
26
c) Speaker
d) Scanner
LECTURE 4
Introduction to Software
Definition: A set of programs that instructs the computer to perform tasks.
Hardware & software complement each other to produce meaningful results.
Two main types of software:
1. System Software (Operating Systems, Compilers, Device Drivers)
2. Application Software (Word processors, Spreadsheets, Database Software)
3. System Software
Definition: Controls and manages hardware and system operations.
Functions:
o Manages memory, peripherals, files.
o Provides an interface between application programs and the computer.
Examples: MS-DOS, UNIX.
27
4. Programming Languages
Definition: A set of rules and symbols used to create software.
Types of Programming Languages:
1. Machine Language - Direct binary code.
2. Low-Level Language - Assembly language.
3. High-Level Language - Java, Python, C++, etc.
Language Translators
Compilation vs Interpretation
5. Utility Software
Definition: Helps maintain and optimize a computer system.
Examples:
o File conversion (changing file format).
o File copying.
o Housekeeping operations (cleaning up storage).
6. Application Software
Definition: Programs designed for users to perform specific tasks.
Examples:
o Word Processing Software (MS Word, Notepad).
o Spreadsheet Software (MS Excel).
o Database Management Systems (MS Access).
o Graphics Software (Photoshop).
28
A storage device is any hardware component that is used to store, retrieve, and manage digital
data. Storage devices retain data either temporarily (volatile storage) or permanently (non-
volatile storage).
Definition: A volatile memory that temporarily holds data and programs that the CPU is
currently using.
Types:
o Static RAM (SRAM): Faster, used for cache memory.
o Dynamic RAM (DRAM): Slower, used for main memory.
Purpose: Provides quick read/write access to running programs.
b) Cache Memory
c) Register Memory
29
2. Secondary Storage (Non-Volatile Memory)
Definition: A magnetic storage device that stores and retrieves digital data.
Components:
o Platter: Circular disks where data is stored.
o Read/Write Head: Reads and writes data.
o Spindle: Rotates the platters.
Advantages: Large storage capacity, cost-effective.
Disadvantages: Slower than SSDs, prone to mechanical failures.
Definition: A modern storage device that uses flash memory instead of moving parts.
Types:
o SATA SSD: Slower but affordable.
o NVMe SSD: Faster, uses PCIe connection.
Advantages: Faster, durable, energy-efficient.
Disadvantages: More expensive than HDDs.
Definition: A portable storage device used for backup and data transfer.
Advantages: Portable, large storage capacity.
Disadvantages: More expensive than internal drives.
30
Advantages: Compact, durable, easy to use.
Disadvantages: Limited lifespan, small storage compared to HDDs.
g) Magnetic Tape
3. Cloud Storage
Definition: A remote storage service that allows users to store data online.
Examples: Google Drive, Dropbox, OneDrive, iCloud.
Advantages: Accessible from anywhere, secure backups.
Disadvantages: Requires internet access, potential security risks.
Introduction to Software
1. What is software?
a) A physical component of a computer
b) A set of programs that instructs the hardware
31
c) A type of input device
d) A computer virus
o Answer: b) A set of programs that instructs the hardware
2. Which of the following is NOT a category of computer software?
a) System Software
b) Application Software
c) Hardware Software
d) Programming Software
o Answer: c) Hardware Software
3. Which of the following statements is true?
a) Hardware and software function independently.
b) Software is unnecessary for hardware to operate.
c) Hardware and software must work together.
d) Software is always built into the hardware.
o Answer: c) Hardware and software must work together.
2. System Software
4. Which software manages hardware and allows applications to run?
a) System Software
b) Application Software
c) Programming Software
d) Web Browser
o Answer: a) System Software
5. Which of the following is an example of system software?
a) Microsoft Word
b) Linux
c) Photoshop
d) Google Chrome
o Answer: b) Linux
6. Which of the following is NOT a function of an operating system?
a) Managing memory
b) Controlling input and output devices
c) Running application software
d) Designing graphics
o Answer: d) Designing graphics
7. Which of these is NOT a type of operating system?
a) Multi-user
b) Multithreading
c) Multiprocessing
d) Database
o Answer: d) Database
8. Which operating system is commonly used in mobile devices?
a) Windows
32
b) MacOS
c) Android
d) UNIX
o Answer: c) Android
9. Which of the following is a function of an operating system?
a) Managing files and directories
b) Browsing the internet
c) Editing videos
d) Creating presentations
o Answer: a) Managing files and directories
Answer: c) Assembly
Answer: b) Compiler
Answer: b) Interpreter
33
14. Which of the following is an example of a compiled programming language?
a) Python
b) JavaScript
c) C++
d) HTML
Answer: c) C++
4. Utility Software
16. Which of the following is a utility software?
a) Microsoft Excel
b) Disk Cleanup
c) Mozilla Firefox
d) Photoshop
34
5. Application Software
19. What is application software used for?
a) Managing hardware
b) Running system utilities
c) Performing specific tasks for users
d) Controlling memory
Answer: a) PowerPoint
6. Storage Devices
35
24. Which of the following is a non-volatile storage device?
a) RAM
b) ROM
c) Cache Memory
d) Register
Answer: b) ROM
25. Which storage device has the fastest data access speed?
a) Hard Disk Drive (HDD)
b) Solid-State Drive (SSD)
c) USB Flash Drive
d) Optical Disc
11. Which of the following storage devices has the largest capacity?
a) CD
37
b) DVD
c) Blu-ray Disc
d) Hard Disk Drive (HDD)
Answer: d) RAM
15. Which of these storage devices is typically used in digital cameras and smartphones?
a) USB flash drive
b) SD card
c) External HDD
d) Optical disc
Answer: b) SD card
38
c) Blu-ray
d) Floppy Disk
Answer: c) Blu-ray
Answer: d) SSD
LECTURE 5
Computer Constituents
Hardware
Software
39
Types: System software, Application software, Programming software.
System Software
Programming Software
Application Software
4. Software Licensing
6. Algorithm Development
41
2. Which part of the computer is responsible for processing data?
a) RAM
b) Hard Disk
c) CPU
d) Monitor
o Answer: c) CPU
3. Which device is used to enter data into a computer?
a) Printer
b) Mouse
c) Monitor
d) Speaker
o Answer: b) Mouse
4. Which of the following is an example of an output device?
a) Scanner
b) Keyboard
c) Speaker
d) Mouse
o Answer: c) Speaker
5. Which of the following is a primary storage device?
a) Hard disk
b) RAM
c) USB flash drive
d) DVD
o Answer: b) RAM
2. Computer Software
6. What is software?
a) Physical components of a computer
b) A set of instructions that tells the hardware what to do
c) The metal casing of a computer
d) A type of input device
o Answer: b) A set of instructions that tells the hardware what to do
7. Which of the following is NOT a type of software?
a) System software
b) Application software
c) Peripheral software
d) Programming software
o Answer: c) Peripheral software
8. Which type of software controls hardware operations?
a) System software
b) Application software
c) Utility software
d) Word processor
o Answer: a) System software
42
9. Which of the following is an example of system software?
a) Microsoft Word
b) Windows Operating System
c) Photoshop
d) Excel
o Answer: b) Windows Operating System
10. Which software helps in creating, debugging, and maintaining programs?
a) Application software
b) Programming software
c) Utility software
d) System software
3. Types of Software
43
Answer: b) Microsoft Access
4. Programming Software
Answer: b) NetBeans
Answer: c) Spreadsheet
Answer: b) JavaScript
44
b) To convert source code into machine code
c) To display graphics
d) To store data
5. System Software
23. Which software ensures the communication between hardware and software?
a) System software
b) Application software
c) Programming software
d) Media software
25. Which type of software includes system utilities like disk cleanup and system
restore?
a) System software
b) Application software
c) Programming software
d) Multimedia software
45
Answer: a) System software
LECTURE 6
Algorithm
46
3. Example Problem Scenario
Pseudocode:
o Provides a clear, concise description of the steps in plain language.
o Example:
pgsql
Copy code
IF lamp works THEN
go to step 7
ELSE
CHECK if lamp is plugged in
IF not plugged in, plug in the lamp
CHECK if bulb is burnt out
IF burnt, replace the bulb
IF lamp still does not work, buy a new lamp
Quit
Flowchart:
o Uses graphical symbols to represent the sequence and decision points in the
algorithm.
o Ideal for visually mapping out the process steps.
47
Note: Abbreviations:
Questions
4. Which of the following is the first step in a systematic approach to problem solving?
a) Write the program
b) Develop an algorithm
c) Understand the problem
d) Test the program
o Answer: c) Understand the problem
5. After understanding the problem, what is the next step?
a) Debug the program
b) Formulate a model
48
c) Evaluate the solution
d) Draw a flowchart
o Answer: b) Formulate a model
6. Which step involves breaking down a problem into smaller, manageable parts?
a) Testing the program
b) Formulating a model
c) Debugging
d) Writing the program
o Answer: b) Formulating a model
7. What is the purpose of developing an algorithm in the problem-solving process?
a) To write code in a specific programming language immediately
b) To create a precise sequence of steps for solving a problem
c) To debug the program automatically
d) To store data in the computer’s memory
o Answer: b) To create a precise sequence of steps for solving a problem
49
b) A vague idea of how to solve a problem
c) A precise sequence of instructions to solve a problem
d) A debugging tool
o Answer: c) A precise sequence of instructions to solve a problem
12. Which two representations are commonly used to depict an algorithm?
a) Binary code and machine language
b) Pseudocode and flowcharts
c) Diagrams and databases
d) Spreadsheets and text files
o Answer: b) Pseudocode and flowcharts
13. Pseudocode is best described as:
a) A programming language with strict syntax rules
b) An informal, English-like description of the steps in an algorithm
c) A type of flowchart symbol
d) The final source code of a program
o Answer: b) An informal, English-like description of the steps in an algorithm
14. A flowchart is:
a) A graphical representation of an algorithm’s sequence of steps
b) A list of programming errors
c) A storage format for algorithms
d) A language used for coding
o Answer: a) A graphical representation of an algorithm’s sequence of steps
15. In the example provided for a broken lamp, what is the first decision point in the
pseudocode?
a) Checking if the lamp is broken
b) Checking if the lamp is plugged in
c) Going directly to step 7
d) Buying a new lamp
o Answer: b) Checking if the lamp is plugged in
50
o Answer: a) To check if the program meets the requirements and produces correct
output
18. The process of running a program with different test cases to identify errors is
known as:
a) Programming
b) Evaluation
c) Debugging
d) Documentation
o Answer: c) Debugging
19. Why is it recommended to have a third party test your program?
a) They can write the entire code for you
b) They may identify input scenarios you overlooked
c) They can guarantee your program is bug-free
d) They can increase the program’s execution speed
o Answer: b) They may identify input scenarios you overlooked
20. Which step follows writing the program in the systematic approach?
a) Formulate a model
b) Debugging
c) Test the program
d) Evaluate the solution
o Answer: c) Test the program
51
24. Which of the following is NOT a benefit of following a systematic approach to
problem solving?
a) Reducing the number of bugs
b) Increasing the predictability of the solution
c) Making the process entirely error-free
d) Helping to organize the steps required to solve a problem
o Answer: c) Making the process entirely error-free
Lecture 7
Overview of Programming
2. Fundamentals of Programming
Core Components:
o Programming Environment: The platform (offline/online, mobile/desktop)
where coding is performed. For this course, the online Colab platform is used.
o Basic Syntax: Rules that define the structure of code.
o Data Types & Variables:
Data Types: Different kinds of data such as numbers (integers, floats,
complex numbers), strings (text), and others.
Variables: Containers used to store data values.
o Keywords & Basic Operators:
Reserved words that have special meaning.
Operators to perform arithmetic, comparisons, etc.
o File I/O: Input and output operations for reading and writing data to files.
o Control Structures:
Decision making (if-else conditions).
Loops (for, while) for repetition.
o Arrays, Strings, and Functions:
Arrays and strings as collections of elements.
Functions to encapsulate reusable code.
52
3. Environment Setup
Executing Code:
o Python code can be executed directly via a command line or within an IDE like
Colab.
Key Syntax Elements:
o Indentation: Critical in Python as it indicates code blocks.
o Comments:
Single-line comments start with #.
Multi-line comments can be enclosed in triple quotes (""" or ''').
Numbers:
o Integers (int): Non-decimal whole numbers (e.g., 1, 3, 191).
o Floats (float): Decimal numbers (e.g., 1.1, 3.4).
o Complex Numbers: Numbers with a real and imaginary part (e.g., 3j, 2j).
Strings:
o Text enclosed in single ('hello') or double quotes ("hello").
o Escape Characters: Used to insert illegal characters in strings (e.g., \" to include
quotation marks).
Definition:
Variables are containers for storing data values.
Example:
53
python
Copy code
x = 5
y = "John"
print(x)
print(y)
7. Comments in Python
Purpose:
o To explain code and improve readability.
o To temporarily disable code during testing.
Syntax Examples:
o Single-line: # This is a comment
o Multi-line:
python
Copy code
"""
This is a comment
that spans multiple lines.
"""
Example Program:
A simple program that prints "Hello World" can be executed directly in the command
line or in Colab:
python
Copy code
print('Hello World')
9. Learning Resources
Questions
Overview of Programming
54
c) A type of operating system
d) A data storage method
o Answer: b) A sequence of instructions written in a programming language
2. The act of writing computer programs is known as:
a) Debugging
b) Compiling
c) Computer programming
d) Data processing
o Answer: c) Computer programming
3. Which of the following is NOT mentioned as an example of a programming
language?
a) Python
b) Java
c) C++
d) HTML
o Answer: d) HTML
2. Fundamentals of Programming
55
3. Programming Environment Setup
5. Data Types
56
13. Which of the following is NOT a numeric type in Python?
a) Integer
b) Float
c) Complex
d) String
o Answer: d) String
14. How are string literals defined in Python?
a) Using angle brackets (< >)
b) Enclosed in either single or double quotation marks
c) Using curly braces ({ })
d) With no delimiters
o Answer: b) Enclosed in either single or double quotation marks
15. What is the purpose of an escape character in a string?
a) To comment out code
b) To insert special characters that cannot be typed directly
c) To terminate a string
d) To convert a number to a string
o Answer: b) To insert special characters that cannot be typed directly
python
Copy code
x = 10
y = "John"
print(x)
print(y)
a) 10 John
b) John 10
c) x y
d) 10 and John on the same line
o Answer: a) 10 John
57
7. Comments in Python
18. Which of the following is a correct way to write a multi-line comment in Python?
a) /* This is a comment */
b) // This is a comment
c) """ This is a multi-line comment """
d) <!-- This is a comment -->
o Answer: c) """ This is a multi-line comment """
19. Which statement best describes the sample Python program provided in the
lecture?
a) It performs complex calculations
b) It prints a simple message to the screen
c) It demonstrates file I/O operations
d) It creates a graphical user interface
o Answer: b) It prints a simple message to the screen
20. How can Python code be executed according to the lecture?
a) Only through a web browser
b) Directly via the command line or an online platform like Colab
c) Only using an IDE installed on a local machine
d) By compiling into machine language manually
o Answer: b) Directly via the command line or an online platform like Colab
9. Learning Resources
21. Which online resource is recommended for learning Python as mentioned in the
lecture?
a) Codecademy
b) W3Schools
c) Coursera
d) Udacity
o Answer: b) W3Schools
(Refer to https://www.w3schools.com/python/default.asp)
22. Which of the following best describes the relationship between data types and
variables?
58
a) Variables store data, and the type of data determines what operations can be performed
b) Data types are not important in Python
c) Variables and data types are the same thing
d) Data types only apply to numbers
o Answer: a) Variables store data, and the type of data determines what operations
can be performed
23. What role do keywords play in programming?
a) They are used for file management
b) They are reserved words that have special meaning in a programming language
c) They are used to define variables
d) They are only used in comments
o Answer: b) They are reserved words that have special meaning in a programming
language
24. What is File I/O in the context of programming?
a) Input and output operations with files
b) A type of data type
c) A method for debugging code
d) The setup of the programming environment
o Answer: a) Input and output operations with files
25. Which of the following is NOT typically part of the basic programming
fundamentals covered in the lecture?
a) Decision making and loops
b) Arrays and strings
c) Advanced database design
d) Functions
o Answer: c) Advanced database design
59