Posts
Showing posts from November, 2025
Networking Lab
- Get link
- X
- Other Apps
AIM. Write a program to Simulate Packet Transmission Delay Source code packets = {'Packet1', 'Packet2', 'Packet3'}; delay = 1; % seconds for i = 1:length(packets) fprintf('Transmitting %s...\n', packets{i}); pause(delay); end AIM. Write a program to check the simple IP Address Validator Source code ip = '192.168.1.10'; parts = str2double(strsplit(ip, '.')); if length(parts)==4 && all(parts >= 0 & parts <= 255) disp('Valid IP Address'); else disp('Invalid IP Address'); end AIM. Write a program to simulate Ping with Random Delay. Source code for i = 1:5 delay = rand() * 0.1; % Simulate delay in seconds fprintf('Ping %d: delay = %.2f ms\n', i, delay*1000); pause(1); end AIM: Write a pro...
CODE
- Get link
- X
- Other Apps
1.Implementation of BFS from collections import deque graph = { 'A': ['B', 'C'], 'B': ['C', 'D', 'E'], 'C': ['F'], 'D': [], 'E': ['F'], 'F': [] } def bfs(graph, start_node, key): visited = set() queue = deque([start_node]) print("Breadth First Search started") while queue: node = queue.popleft() if node == key: print(node, "Found") return if node not in visited: print(node, end=" -> ") visited.add(node) for i in graph[node]: if i not in visited: ...
Popular posts from this blog
C-Programming of Class 12
1. Write a program to input any three numbers and find out which one is the largest number using user defined function. #include<stdio.h> int larg_num(int num1, int num2, int num3){ if(num1 >= num2 && num1 >= num3){ return num1; }else if(num2 >=num1 && num2>=num3){ return num2; } else{ return num3; } } int main(){ int num1, num2, num3; scanf("%d%d%d", &num1,&num2,&num3); int largest = larg_num(num1,num2,num3); printf("the largest number is %d",largest); return 0; } 2. Write a program to display the day using the switch statement depending upon the number entered. i.e. input 1 for Sunday, 7 for Saturday using user defined function. #include <stdio.h> char *days(int num) { switch (num) { case 1: ...
C-Program of Class 11
1. Define string. Explain any four-string handling function used in C. A String in C programming is a sequence of characters terminated with a null character ‘\0’. The C String is stored as an array of characters. #include <stdio.h> #include <string.h> int main() { char str1[20] = "Hello"; char str2[20] = "World"; char str3[20]; strcpy(str3, str1); printf("Copied string: %s\n", str3); strcat(str2, str1); printf("Concatenates string: %s\n", str1); printf("Length of str1: %lu\n", strlen(str1)); if (strcmp(str1, str2) == 0) printf("str1 and str2 are equal\n"); else if (strcmp(str1, str2) < 0) printf("str1 is less than str2\n"); else printf("str1 is greater than str2\n"); return 0; } strcat(): Concatenates (joins) two stri...