0% found this document useful (0 votes)
15 views10 pages

Ans FAQ 2 - CS 4-11

Uploaded by

bittusingh0027u
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)
15 views10 pages

Ans FAQ 2 - CS 4-11

Uploaded by

bittusingh0027u
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/ 10

​Ans 4.

### a) Types of Networks:


1. **LAN (Local Area Network)**: A network that connects
computers and devices within a limited area such as a home, office,
or building.
2. **WAN (Wide Area Network)**: A network that covers a large
geographical area, often spanning cities, countries, or even
continents.

### b) Network Topologies:


1. **Star Topology**: A network configuration where all devices are
connected to a central hub or switch.
2. **Ring Topology**: A network where each device is connected to
two other devices, forming a circular data path.

### c) Network Devices:


1. **Switch**: A device that connects multiple devices in a network,
directing data to the correct destination based on MAC addresses.
2. **Router**: A device that forwards data between different
networks, often used to connect local networks to the internet.

### d) Transmission Media:


1. **Coaxial Cable**: A type of cable consisting of a central
conductor, insulating layer, and outer shield, used for transmitting
electrical signals.
2. **Optical Fiber**: A medium for transmitting data as light
signals, providing high-speed internet and long-distance
communication.
Ans 5.
### a) Definitions:

1. **VoIP (Voice over Internet Protocol)**: A technology that allows


voice communication and multimedia sessions over the internet or
other IP networks, replacing traditional phone lines.
2. **HTTPS (HyperText Transfer Protocol Secure)**: A secure
version of HTTP, it uses encryption (SSL/TLS) to secure
communication between a web browser and a server, ensuring
data privacy and security.
3. **TCP (Transmission Control Protocol)**: A reliable, connection-
oriented protocol that ensures data is transmitted accurately and in
order over the internet.

b)
**Circuit Switching** and **Packet Switching** are two different
methods of transmitting data across a network:

- **Circuit Switching**: In circuit switching, a dedicated


communication path is established between the sender and
receiver before the transmission starts. This path remains reserved
for the entire duration of the communication, even if no data is
being transmitted at certain times. This method is typically used in
traditional telephone networks. It is less efficient because it
reserves bandwidth for the entire connection, regardless of
whether data is being transmitted.

- **Packet Switching**: In packet switching, data is divided into


small packets, and each packet may take a different route to reach
the destination. The network does not reserve a dedicated path for
communication, allowing more efficient use of resources. This
method is used by the internet, where packets are transmitted
independently and may arrive out of order, but are reassembled at
the destination. It is more efficient than circuit switching as it
dynamically utilizes available network resources.
Ans 6.

def Push_elements(Stu_Stk, Stu_dict):


for Stu_ID, marks in Stu_dict.items():
if marks[2] >= 80:
Stu_Stk.append(Stu_ID)

def Pop_elements(Stu_Stk):
if not Stu_Stk:
print("Stack Empty")
else:
while Stu_Stk:
Stu_ID = Stu_Stk.pop()
print(f"Popped Student ID: {Stu_ID}")

Stu_dict = {
101: (75, 82, 88),
102: (85, 90, 78),
103: (88, 84, 90),
104: (80, 79, 85),
105: (60, 70, 95)
}

Stu_Stk = []

Push_elements(Stu_Stk, Stu_dict)
Pop_elements(Stu_Stk)
Ans 7.

Push_book :-

def push_book(BooksStack, new_book):


BooksStack.append(new_book)

Pop_book:-

def pop_book(BooksStack):
if len(BooksStack) == 0:
return "Underflow"
else:
return BooksStack.pop()

peep:-

def peep(BooksStack):
if len(BooksStack) == 0:
return None
else:
return BooksStack[-1]

Ans 8.
1)
push_even(N): Pushes all even integers from the list N into the
stack EvenNumbers.

code:-

def push_even(N):
EvenNumbers = []
for number in N:
if number % 2 == 0:
EvenNumbers.append(number)
return EvenNumbers

2)
pop_even(): Pops the topmost even number from the stack and
returns it, or shows "Empty" if the stack is empty.

code:-

def pop_even(EvenNumbers):
if len(EvenNumbers) == 0:
return "Empty"
else:
return EvenNumbers.pop()
3)
Disp_even(): Displays all the elements in the stack without deleting
them, or shows "None" if the stack is empty.

code:-

def D
isp_even(EvenNumbers):
if len(EvenNumbers) == 0:
return "None"
else:
return EvenNumbers

Ans 9.

class CustomerStack:
def __init__(self):
self.stack = []

def Push_element(self, customer_details):


for customer in customer_details:
name, phone, city = customer
if city == "Goa":
self.stack.append([name, phone])

def Pop_element(self):
if self.stack:
while self.stack:
print(self.stack.pop())
else:
print("Stack Empty")

customer_details = [
["Gurdas", "99999999999", "Goa"],
["Julee", "8888888888", "Mumbai"],
["Murugan", "77777777777", "Cochin"],
["Ashmit", "1010101010", "Goa"]
]

status = CustomerStack()
status.Push_element(customer_details)
status.Pop_element()

Ans 10.

def Push(SItem):
stack = []
count = 0
for item, price in SItem.items():
if price > 75:
stack.append(item)
count += 1
for item in stack:
print(item)
print(f"The count of elements in the stack is {count}")

Ditem = {"Pen": 106, "Pencil": 59, "Notebook": 80, "Eraser": 25}


Push(Ditem)

Ans 11.

### 1. **PUSH**:

The `PUSH` operation adds an element to the top of the stack. It


increases the size of the stack by one.

- **Example**: `Push(5)` will add the element `5` to the stack.

### 2. **POP**:

The `POP` operation removes and returns the element from the
top of the stack. It decreases the size of the stack by one.

- **Example**: `Pop()` will remove the top element from the


stack and return it.

### 3. **OVERFLOW**:

`OVERFLOW` occurs when you try to `PUSH` an element onto a


stack that is already full, i.e., the stack has reached its maximum
capacity.
- **Example**: Trying to push an element onto a stack that has no
more space results in an overflow condition.

### 4. **UNDERFLOW**:

`UNDERFLOW` occurs when you try to `POP` an element from an


empty stack, i.e., the stack has no elements to remove.

- **Example**: Trying to pop from an empty stack results in an


underflow condition.

### 5. **PIP (Peek or Top)**:

The `PIP` (often called `Peek` or `Top`) operation retrieves the


top element from the stack without removing it, allowing you to
view the element at the top without altering the stack.

- **Example**: `Peek()` will return the top element of the stack


without removing it.

b)

A
AB
AB*
ABC
ABC+
ABCD
ABCDE
ABCDE/
ABCDE/+
ABCDE/+*

ABCDE/+*+

You might also like