Posts

Showing posts from November, 2025

PP

Program 6: Write a MPI program to demonstration of deadlock using point to point communication and avoidance of deadlock by altering the call sequence. #include <mpi.h> #include <stdio.h> int main(int argc, char** argv) { int rank, size; int msg_send = 100, msg_recv; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); if (size < 2) { if (rank == 0) printf("Run with at least 2 processes.\n"); MPI_Finalize(); return 0; } if (rank == 0) { printf("Process 0 sending to Process 1...\n"); MPI_Send(&msg_send, 1, MPI_INT, 1, 0, MPI_COMM_WORLD); // blocking send MPI_Recv(&msg_recv,1,MPI_INT,1,0,MPI_COMM_WORLD, MPI_STATUS_IGNORE); printf("Process 0 received from Process 1: %d\n", msg_recv); } else if (rank == 1) { printf("Process 1 sending to Process 0...\n"); MPI_Send(&msg_send, 1, MPI_INT, 0, 0, MPI_COMM_WORLD); // block...

11

 import math from scipy import stats # Given values mu_0 = 200   # Old recipe mean x_bar = 190   # Sample mean s = 15        # Sample standard deviation n = 40        # Sample size alpha = 0.05 # Calculate t-statistic t_stat = (x_bar - mu_0) / (s / math.sqrt(n)) df = n - 1 # Get critical t-value for one-tailed test t_critical = stats.t.ppf(alpha, df) # Calculate p-value p_value = stats.t.cdf(t_stat, df) # Print results print(f"T-statistic: {t_stat:.3f}") print(f"Critical t-value: {t_critical:.3f}") print(f"P-value: {p_value:.5f}") if t_stat < t_critical:      print("Reject the null hypothesis: The new recipe has significantly fewer calories.") else:      print("Fail to reject the null hypothesis: Not enough evidence to support the claim.")