10th Computer Unit 1: Computer System

Unit 1: Computer System

Write answers to the following short response questions.

Q.1. What is the significance of the Most Significant Bit (MSB) in signed binary numbers?

Answer: The leftmost bit carries the most weight, called the Most Significant Bit (MSB). MSB is a binary number with the greatest value because it impacts the number’s overall value the most.

Q.2. What is a binary digit, and why is it fundamental in computer systems?

Answer: A binary digit (bit) is the smallest unit of data in computing, representing a 0 or 1. It is fundamental because digital computers operate using two states (on/off), corresponding to binary.

Q.3. Why are binary numbers more efficient for computer calculations than decimal numbers?

Answer: Binary numbers are more efficient because digital circuits naturally represent two states, simplifying hardware design and enabling faster, more reliable processing.

Q.4. How do ASCII and Unicode differ in character representation?

Answer: ASCII uses 7 or 8 bits to represent 128 or 256 characters, mainly for English. Unicode uses up to 32 bits and can represent over a million characters, supporting many languages and symbols.

Q.5. What is the importance of positional value in number systems? Give two examples.

Answer: Positional value determines the worth of a digit based on its place.

The decimal number system is a positional-value system in which the value of a digit depends on its position in the number. For example, consider the decimal number 964. Here:
9 represents 9 hundreds

6 represents 6 tens

4 represents 4 units

The binary system is also a positional-value system, wherein each bit has its own value or weight expressed as a power of 2. For example (1011)2 = 1×23 + 0x22 + 1×21 + 1×2°

Q.6. What is the process to convert a binary number to its hexadecimal equivalent?

Answer:

  • Take a group of 4 binaries from the right side.
  • If any one or two, or three bits are left alone, add zeros to the left to make them a group of 4.
  • Convert each binary group to its equivalent Hexadecimal digit.

Q.7. What is the purpose of machine code in computer operations?

Answer: Machine code is the lowest-level programming language, directly executed by the CPU. It allows hardware to perform tasks precisely as programmed.

Q. 8. Why is a coding scheme used in computers? Give three reasons.

Answer:

Data Representation: Computers use binary (0s and 1s) to represent all data, making it possible for computers to store and manipulate text and other data.

Standardization: Coding schemes provide a consistent way to represent characters across different platforms and devices, ensuring compatibility and accurate data exchange.

Communication: They enable different computer systems to communicate with each other by using a common representation for characters and symbols.

Q.9. State five differences between a process and a thread.

Answer:

 ProcessThread
1An executing instance of a program is called a process.A thread is a subset of the process.
2It has its own copy of the data segment of the parent process.It has direct access to the data segment of its process.
3Processes run in separate memory.Threads run in a shared memory.
4Process is controlled by the operating system.Threads are controlled by programmer in a program.
5Process are independent.Threads are dependent.

Q.10. What is memory management, and how does it work in an operating system?

Answer: Memory management is the Operating System (OS) function that handles the allocation and deallocation of memory spaces to various programs, manages memory hierarchy, and ensures that each process has adequate memory while optimising the use of available memory.

Q. 11. What is a real-time operating system, and where is it commonly used?.

Answer: A real-time operating system is designed to process data and provide immediate responses. It is used in environments where timing is critical, such as medical equipment, traffic control systems, and industrial automation.

Q.12. Differentiate between multiprogramming and multitasking operating systems.

Answer: A multiprogramming operating system allows multiple programs to be loaded into the main memory simultaneously.

A multitasking operating system enables multiple tasks to be performed concurrently on a single CPU. The system rapidly switches between tasks.

Q.13. List two pros and two cons of on-premises hosting.

Answer:

Pros:

  • You have complete control over hardware and data security.
  • It is customizable to specific needs and compliance requirements.

Cons:

  • It has high initial and ongoing costs.
  • It requires in-house technical expertise, It has limited scalability.

Q.14. What is an application patch? Give the key functions of it.

Answer: An application patch is a piece of software designed to update, fix, or improve an existing program or its supporting data.

Key Functions of Application Patches are to fix bugs, resolve software glitches or errors, to improve security and to enhance performance.

Q.15. Differentiate between offline and online applications. Give one example of each.

Answer: Offline applications are programs that can run without an internet connection. These apps are useful when there’s no access to the internet, but they can still perform tasks. For example, Microsoft Word – used for writing and editing documents.

Online applications require an internet connection to function because they access resources, data, or services hosted on remote servers. For example, Google Docs – for creating and sharing documents in real-time.

Write answers of the following extended response questions.

Q.1. Explain decimal, binary, octal and hexadecimal number systems with examples.

Answer:

i. Decimal Number System

The decimal (also called Denary) number system is composed of the 10 symbols: 0, 1, 2, 3,4, 5, 6, 7, 8 and 9. Using these symbols we can express any quantity. The decimal number system is called base 10 system because it has 10 digits. The decimal number system is a positional-value system, in which the value of a digit depends on its position in the number.

For example, (8745)10 = 8×103 + 7×102 + 4×101 + 5×10° = 8000 + 700 + 40 + 5= (8745)10

ii. Binary Number System

In binary number system there are only two symbols or digits, 0 and 1. The base of binary number system is 2. All the statements made earlier about the decimal number system are equally applicable to the binary number system as well. The binary system is also a positional-value system, wherein each bit has its own value or weight expressed as power of 2.

For example, (1011)2 = 1×23 + 0x22 + 1×21 + 1×2° =8+0+2+1= (11)10

iii. Octal Number System

The Octal number system has a base of 8, meaning it has eight possible digits; 0,1, 2, 3, 4, 5, 6, and 7. Thus, each digit of an octal number system can have any value from 0 to 7. The digit positions in an octal number system have weight with powers of 8. An octal number can be easily converted to its decimal equivalent by multiplying each digit by its positional weight.

For example, (672)8 = 6×82 + 7×81 + 2×8° = 384 + 56 + 2 = (442)10

iv. Hexadecimal Number System

The hexadecimal number system uses base 16. Thus it has 16 possible digits. It uses the digits0-9 and letters A, B, C, D, E and F as the 16 digit symbols. The table shows the relationship among hexadecimal and decimal numbers. It is important to remember that hexadecimal digits A through F are equivalent to the decimal values 10 through 15.

For example, (3AF)16 = 3×162 + 10×161 + 15×16° = 768 + 160 + 15 = (943)10

Q.2. What is 2’s complement, and why it is used? Give examples.

Answer: Two’s complement is a mathematical operation used to represent negative numbers in binary. It is the most common way of representing signed integers in computers.


Why is 2’s Complement Used?

  • Simplifies Binary Arithmetic: With 2’s complement, the same circuitry can be used for both addition and subtraction.
  • Unique Zero: Only one representation for 0 (unlike other systems like sign-magnitude, which has two zeros).
  • Efficient Processing: Hardware is simpler and faster to design for arithmetic operations.

Example: Find the 2’s complement of 5 (to represent -5 in 8-bit binary)

+5 in binary (8-bit) is 00000101

Invert the bits (1’s complement): 11111010

Add 1:

11111010

+ 1

___________
 11111011   This is -5 in 2’s complement (8-bit)

Q.3. Define the terms Overflow and Underflow. Explain Overflow in the number system with one example.

Answer:

Overflow

Overflow happens when a calculation produces a result that is larger than the maximum value that can be stored or represented with the available number of digits or bits in a system.

Underflow

Underflow occur when calculations produce results that are too small to be represented within the allowed number of bits.

Example: 8-bit Unsigned Integer Overflow An 8-bit unsigned integer can represent values from 0 to 255. If user attempts to add 1 to 255, the result is 256, which cannot be represented with just 8 bits. Since an 8-bit register can only store 8 bits, the ninth bit (1) is the overflow bit, which will be lost and the overall result becomes wrong.

Q.4. What is the significance of ASCII and Unicode character coding schemes?

Answer: ASCII stands for American Standard Code for Information Interchange. It is a standard data coding scheme in computers. It assigns standard numeric values to alphabets, numerals, punctuation marks and other characters used in computers. Initially ASCII used 7-bit codes of various combinations of 0’s and 1’s to represent 128 different characters. Later, ASCII was extended to an 8-bit code that can represent 256 different characters.

Unicode is an international character-encoding system designed to facilitate the electronic exchange, processing, and display of written texts from diverse modern and classical languages. The Unicode Standard encompasses letters, digits, accents, punctuation marks, technical symbols for the world’s major written languages, as well as emoji and other symbols, all using a uniform encoding scheme. The latest version of Unicode includes over 100,000 characters. Unicode assigns a unique number to each character that remains consistent across all systems that support Unicode.

Q.5. What is an operating system? Explain any five tasks/functions of OS.

Answer: An operating system (OS) is essential software that manages a computer’s memory, processes, hardware, and software, enabling user interaction. It loads into RAM when the computer is turned on and is necessary to run any programs.

Main Tasks/Functions of an Operating System

Operating system performs the following main tasks or functions.

  • Process Management
  • Memory Management
  • File Management
  • Device Management
  • Network Management
  • Security management

Process Management

A process is a program in execution, and process management in an operating system allocates resources like CPU time to various processes in memory.

Memory Management

Memory management is the part of operating system that controls and manages the operation of main memory during the operation of computer. It allocates space to programs that are loaded in main memory for execution.

File Management

A File management is the part of operating system that manages files and folders on storage devices such as hard disk, USB flash drive and DVD. It allows computer user to perform operations such as creating, copying, moving, renaming, deleting, and searching files and folders.

Device Management

Device management is the part of operating system that controls input and output devices, such as keyboards, mouse, printers, and network interfaces. Efficient I/0 management improves the performance of the computer.

Network Management

Network management is the part of network operating system that monitors and manages the resources of a network. It allows to create user groups and assigns privileges to them. It shares the network resources among users and detects and fixes network problems.

Security management

Security management in an operating system ensures resources are used according to user privileges set by the system administrator. It creates user accounts, enforces security policies, controls access to resources, and protects the system from unauthorized access and malware.

Q. 6. Explain any four types of operating systems.

Answer: The following are the important types of operating systems that are commonly used on various computer systems.

Batch Processing Operating System

A batch processing operating system groups similar tasks into batches and executes them sequentially. It is ideal for repetitive tasks, such as payroll processing or generating bank statements, where the same operation is applied to multiple users or jobs.

Multiprogramming Operating System (RTOS)

A multiprogramming operating system allows multiple programs to be loaded into the main memory simultaneously. Although the CPU can execute only one program at a time, it switches between programs when one is waiting for input or output, thus Operating maximizing CPU utilization.

Multitasking Operating System

A multitasking operating system enables multiple tasks to be performed concurrently on a single CPU. The system rapidly switches between tasks, creating the impression that all tasks are running simultaneously. This capability is essential for modern personal computers and mobile devices, where users often run several programs at once.

Real-time Operating System (RTOS)

A real-time operating system is designed to process data and provide immediate responses. It is used in environments where timing is critical, such as medical equipment, traffic control systems, and industrial automation.

Multiprocessor Operating System

A multiprocessor operating system controls the operation of multiple CPUs within a single computer system. By distributing tasks among several processors, the system can handle large amounts of data more efficiently and increase the overall processing speed.

Distributed Operating System

A distributed operating system manages a network of computers, allowing programs to run on multiple machines simultaneously. In a distributed system, the operating system distributes tasks across different computers in the network, balancing the load and providing fast execution of application software.

Embedded Operating System

An embedded operating system is integrated into hardware of a specific device, such as a microwave oven, TV, or camera. It is designed to perform specialized tasks and operates automatically when the device is turned on.

Q.7. How operating system manage applications? Explain the five states of a process with a diagram.

Answer: Application programs run on top of operating systems by utilizing the resources and services provided by the operating system. The operating system serves as an intermediary between the hardware and the application programs, managing tasks such as memory allocation, process scheduling, and device management.

Various States of a Process: There are five states of a process which are start, ready, running, waiting and terminated as shown in Figure.

Start/New State: This is the first state of a process when it is created. Any new operation or service that is requested by a program for execution by the processor is known as new state or process.

Ready State: A process is said to be in ready state when it is ready for execution but it is waiting to be assigned to the processor by the operating system.

Running State: A process is said to be in running state when it is being executed by the processor. A process is assigned to a processor for execution by operating system.

Blocked State/Waiting State: A process is in blocked or waiting state when it is not under execution. It is waiting for a resource to become available.

Terminated State: A process is in terminated state when it completes its execution.

Q.8. Explain the role of Integrated Development Environments (IDEs) in the software development process, including specific features that enhance programming efficiency.

Answer: IDEs are comprehensive tools that combine a text editor, debugger, and compiler in one interface.

Text Editors and IDEs provide a platform for writing code with features like syntax highlighting, which colours the code according to its syntax, making it easier to read and understand. For example, keywords in a programming language might appear in blue, while comments are in green.

  • IDEs offer advanced code completion, where the software predicts and suggests the next part of the code you are typing. This feature helps in writing code faster and with fewer errors.
  • IDEs come with integrated debuggers that allow programmers to run their code step by step, inspects variable, and understand the flow of execution to find and fix bugs (errors).
  • Text Editors and IDEs provide real-time error checking, underlining syntax errors and other issues as you type. This immediate feedback s helps in quickly identifying and correcting mistakes.
  • IDEs offer project management features that help organize code files, manage dependencies, and streamline the build process.

Q.9. What is software hosting? Explain On-premises and Cloud hosting. Also, give two pros and cons of each.

Answer: Software hosting refers to the process of deploying, managing, and providing access to software applications on servers. These servers can be located on-premises, in data centers, or in the cloud. The primary objective of software hosting is to make applications accessible to users over a network, typically the internet.

On-Premises Hosting:

On-premises hosting involves installing and running software on servers located within an organization’s physical premises. This setup offers complete control over the hardware, software, and data security, making it ideal for organizations with strict compliance and security requirements. However, it comes with high upfront costs for purchasing and setting up the hardware, as well as ongoing maintenance and operational expenses.

Pros:

You have complete control over hardware and data security.

It is customizable to specific needs and compliance requirements.

Cons:

On-Premises has high initial and ongoing costs.

It requires in-house technical expertise. It has limited scalability.

Cloud Hosting:

Cloud hosting uses a network of virtual and physical servers to provide scalable and flexible resources on demand. Managed by cloud providers like AWS, Google Cloud, and Microsoft Azure, it offers high scalability, cost-efficiency with a pay-as-you-go model, and excellent reliability. Cloud hosting is ideal for applications with variable or unpredictable traffic.

Pros:

Cloud hosting is highly scalable and flexible.

It is cost-efficient with pay-as-you-go pricing. It is reliable and supports global reach.

Cons:

It is dependent on internet connectivity. There are potential data security and compliance concerns.

Select the best answer for the following MCQs.

1. What is the binary representation of the decimal number -43 using 8-bit two’s complement notation? .

a) 10101011

b) 11010101

c) 11010101

d) 11101011

2. Which of the following binary numbers corresponds to the hexadecimal number 3FA7?

a) 0011 111110100111

b) 11000011 1101 1000

c) 1011 110000110111

d) 0111 10111011 1100

3. How does the ASCII code for the character Z (90 in decimal) look in binary?

a) 01011010

b) 01001110

c) 01011000

d) 01101001

4. In an 8-bit signed integer representation, what is the range of values that can be represented?

a) -127 to 128

b) -128 to 127

c) 0 to 255

d) -256 to 255

5. How many different values can be represented with a 10-bit binary number?

a) 256

b) 1024

c) 512

d) 2048

6. Which of the following is NOT a task performed by an operating system?

a) Process Management

b) Memory Management

c) Email Management

d) Device Management

7. Which type of operating system allows multiple tasks to be performed at the same time?

a) Multiprogramming

b) Batch Processing

c) Real-time

d) Single-tasking

8. Which state of a process represents that it is ready for execution but waiting for CPU time?

a) Start State

b) Running State

c) Ready State

d) Blocked State

9. What is the main purpose of a process scheduler?

a) To manage file operations

b) To manage CPU utilization

c) To manage memory allocation

d) To manage network resources

10. Which memory management approach involves dividing memory into fixed-sized blocks?

a) Paging

b) Segmentation

c) Virtual Memory

d) Contiguous Allocation

11. What is the main purpose of interrupts in an operating system?

a) To speed up CPU processing

b) To slow down CPU processing

c) To handle immediate events

d) To manage network connections

12. Which scheduling algorithm assigns CPU time in fixed time slices to each process in a cyclic order?

a) First-Come First-Served (FCFS)

b) Shortest Job Next (SJN)

c) Priority Scheduling

d) Round Robin (RR)

13. Which memory management technique divides memory into fixed-sized blocks?

a) Segmentation

b) Paging

c) Fixed Partitioning

d) Dynamic Partitioning

14. Which type of hosting involves installing and running software on servers located within an organization’s physical premises?

a) Shared Hosting

b) Dedicated Hosting

c) On-Premises Hosting

d) Cloud Hosting

15. Which component of programming software translates code written in a high-level programming language into machine code?

a) Text Editor

b) Compiler

c) Debugger

d) IDE

10th Computer Unit 1: Computer System

Learning Activity “Hello World Project”

index.html

<!DOCTYPE html>

<html lang=”en”>

<head>

  <meta charset=”UTF-8″>

  <meta name=”viewport” content=”width=device-width, initial-scale=1.0″>

  <title>Change Message</title>

  <link rel=”stylesheet” href=”styles.css”>

</head>

<body>

  <div id=”message”>Hello world</div>

  <button id=”change-message-button”>Change Message</button>

  <script src=”script.js”></script>

</body>

</html>

Styles.css

body {

  font-family: Arial, sans-serif;

  display: flex;

  flex-direction: column;

  justify-content: center;

  align-items: center;

  height: 100vh;

  margin: 0;

  background-color: #f0f0f0;

}

#message {

  color: #333;

  font-size: 2em;

  margin-bottom: 20px;

}

button {

  padding: 10px 20px;

  font-size: 1em;

  cursor: pointer;

  background-color: #4CAF50;

  color: white;

  border: none;

  border-radius: 5px;

}

button:hover {

  background-color: #45a049;

}

script.js

document.addEventListener(“DOMContentLoaded”, function() {

  const messageDiv = document.getElementById(‘message’);

  const button = document.getElementById(‘change-message-button’);

  button.addEventListener(“click”, function() {

    if (messageDiv.textContent === ‘Hello world’) {

      messageDiv.textContent = ‘I love my country, Pakistan’;

    } else {

      messageDiv.textContent = ‘Hello world’;

    }

  });

});