0% found this document useful (0 votes)
11 views5 pages

Cos 101 Test

The document is a test for a computer science/statistics course, detailing the role of computer units in ATM machines, the definition and importance of algorithms, examples of input/output/storage devices, and the five generations of computers. It also highlights key figures in computing history, such as Charles Babbage and Ada Lovelace, and includes an algorithm for ATM withdrawal and a QBasic program simulating ATM operations. Overall, it covers fundamental concepts in computer science and programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

Cos 101 Test

The document is a test for a computer science/statistics course, detailing the role of computer units in ATM machines, the definition and importance of algorithms, examples of input/output/storage devices, and the five generations of computers. It also highlights key figures in computing history, such as Charles Babbage and Ada Lovelace, and includes an algorithm for ATM withdrawal and a QBasic program simulating ATM operations. Overall, it covers fundamental concepts in computer science and programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

COS 101 TEST

NAME : Maduka Chsiom Collins


DEPARTMENT : Computer science / Statistics
REG NO. : 2024/279706

Part A: Concept Application

1. Role of Computer Units in an ATM Machine


a) Input Unit: Accepts user inputs like PIN, withdrawal amount, and card details (e.g.,
keypad, card reader).

b) Processing Unit: Verifies PIN, checks balance, processes transactions (e.g., CPU).

c) Storage Unit: Stores account data, transaction records, and user PINs (e.g., hard
drive/database).

d)Output Unit: Displays messages, dispenses cash, and prints receipts (e.g., screen, cash
dispenser, printer).
Certainly! Below is an expanded and more detailed version of the answers to the test
questions, providing additional explanations, context, and examples where applicable.

2. Algorithm Definition & Importance


- Definition: A step-by-step procedure to solve a problem (e.g., recipe for ATM withdrawal).

-Importance: Ensures accurate, efficient, and repeatable problem-solving by computers.

3) Examples of Device
-Input Devices:
1. Keyboard
2. Mouse
3. Scanner

Output Devices:
1. Monitor
2. Speakers
3. Printer

Storage Devices:
1. Hard Disk Drive
2. Solid-State Drive
3. USB Flash Drive

4. Five Generations of Computers


1. First Generation (1940–1956)
- Technology: Vacuum tubes.
- Example: ENIAC (Electronic Numerical Integrator and Computer).
- Limitations: Large size, high power consumption, prone to overheating.

2. Second Generation (1956–1963)


- Technology: Transistors (smaller, faster, more reliable than vacuum tubes).
- Example: IBM 1401.
- Advancements: Magnetic core memory, assembly language programming.

3. Third Generation (1964–1971)


- Technology: Integrated Circuits (ICs).
- Example: IBM System/360.
- Impact : Smaller, cheaper, and more efficient computers; introduction of operating
systems.

4. Fourth Generation (1971–Present)


- Technology : Microprocessors (thousands of ICs on a single chip).
- Example: Personal Computers (PCs) like Apple II, IBM PC.
- Innovations: GUI, networking, and portable devices (laptops).

5. Fifth Generation (Future-Oriented)


- Technology: Artificial Intelligence (AI), Quantum Computing.
- Example: IBM Watson (AI), Google’s Quantum Computer.
- Goals: Natural language processing, machine learning, and problem-solving without
explicit programming.

5. Father of the Computer


Charles Babbage (1791–1871) is regarded as the "Father of the Computer" for his
pioneering work on mechanical computing devices:
- Difference Engine (1822) Designed to calculate polynomial functions automatically.
- Analytical Engine (1837): A general-purpose mechanical computer with concepts like ALU,
memory, and control flow—essentially the blueprint for modern computers.

6. Giants in Computing

- Ada Lovelace (1815–1852)


Achievement: Wrote the first algorithm for Babbage’s Analytical Engine (1843), making her
the world’s first programmer.
- Legacy: Her notes introduced the concept of loops and conditional branching,
foundational to programming.

- Charles Babbage (1791–1871)


- Contribution: Invented programmable mechanical computers (Difference and Analytical
Engines).
- Impact: His designs inspired later electronic computers.
- Alan Turing (1912–1954)
- Achievement: Proposed the Turing Machine (1936), a theoretical model for computation.
- Role in WWII: Cracked the Enigma code, saving millions of lives.
- Legacy: Turing Award (the "Nobel Prize of Computing") is named in his honor.

Part B: Algorithm & Flowchart**

7. Algorithm for ATM Withdrawal


Below is a detailed step-by-step algorithm for an ATM withdrawal:

1. Start: Initiate the ATM process.


2. Insert Card: User inserts their debit/credit card into the card reader.
3. Enter PIN: The ATM prompts the user to enter their 4-digit PIN.
4. Validate PIN:
- If the PIN matches the bank’s records, proceed.
- If incorrect, display "Invalid PIN. Try again." (Allow 2 more attempts before locking the
card).
5. Select Transaction: User chooses "Withdrawal" from the menu.
6. Check Balance: The system retrieves the account balance from the bank’s database.
7. Enter Amount: User inputs the desired withdrawal amount.
8. Validate Amount:
- If the amount ≤ balance, proceed.
- Else, display "Insufficient Funds" and return to step 7.
9. Dispense Cash: The cash dispenser releases the requested money.
10. Update Balance: Deduct the withdrawal amount from the account.
11. Print Receipt: Offer the user a printed receipt with transaction details.
12. Eject Card: Return the card to the user.
13. End: Terminate the session.

Part C: QBasic Programming

8.
9. QBasic Program
Here’s an expanded QBasic program simulating ATM operations with comments for clarity:

```qbasic
CLS ' Clear the screen
DIM correctPIN AS STRING
DIM userPIN AS STRING
DIM balance AS INTEGER
DIM withdrawal AS INTEGER

' Initialize variables


correctPIN = "1234" ' Default PIN for demonstration
balance = 5000 ' Starting balance

' Step 1: PIN Verification


INPUT "Enter your PIN: ", userPIN

IF userPIN = correctPIN THEN


PRINT "PIN Correct. Welcome to Your Bank!"

' Step 2: Display Menu


PRINT "1. Check Balance"
PRINT "2. Withdraw Cash"
INPUT "Select an option (1 or 2): ", choice

IF choice = 1 THEN
PRINT "Your current balance is: $"; balance
ELSEIF choice = 2 THEN
' Step 3: Withdrawal Process
INPUT "Enter amount to withdraw: $", withdrawal

IF withdrawal <= balance THEN


balance = balance - withdrawal
PRINT "Success! Dispensing $"; withdrawal
PRINT "Remaining balance: $"; balance
ELSE
PRINT "Error: Insufficient funds."
END IF
ELSE
PRINT "Invalid option. Session ended."
END IF
ELSE
PRINT "Incorrect PIN. Access Denied!"
END IF
PRINT "Thank you for using our ATM. Goodbye!"
END
```

You might also like