commit fe6e33e1fed7b78d26ab630639720bc38ef8cd75
parent 9a1ea28d0482dbc18c5c874a7f3bdf8606c88dd8
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Fri, 6 Mar 2026 20:50:26 +0530
[2026-03-06] : .\Semester_1\EduInCS Exam\Paper-2_05-03-2026 : test ans for Paper-2_05-03-2026
Diffstat:
4 files changed, 397 insertions(+), 0 deletions(-)
diff --git a/Semester_1/EduInCS Exam/Paper-2_05-03-2026/Qn-11.c b/Semester_1/EduInCS Exam/Paper-2_05-03-2026/Qn-11.c
@@ -0,0 +1,55 @@
+/*
+ * Author : Amit Dutta <amitdutta4255@gmail.com>
+ * Date : 06 Mar 2026
+ * Repo : https://github.com/notamitgamer/bsc
+ * License : MIT License (See the LICENSE file for details)
+ * Copyright (c) 2026 Amit Dutta
+ */
+
+/* Write a program to explain, how an array of stucture can you defined and accessed. */
+
+#include <stdio.h>
+#include <string.h>
+
+// 1. Defining the Structure
+struct Student {
+ int rollNo;
+ char name[50];
+ float marks;
+};
+
+int main() {
+ int n, i;
+
+ printf("Enter the number of students: ");
+ scanf("%d", &n);
+
+ // 2. Defining an Array of Structures
+ // This creates 'n' blocks of memory, each large enough to hold a Student
+ struct Student s[n];
+
+ // 3. Accessing members to STORE data
+ for (i = 0; i < n; i++) {
+ printf("\nEnter details for Student %d:\n", i + 1);
+ printf("Roll No: ");
+ scanf("%d", &s[i].rollNo); // Using dot (.) operator with index [i]
+
+ printf("Name: ");
+ getchar(); // To clear the newline character from buffer
+ fgets(s[i].name, sizeof(s[i].name), stdin);
+ s[i].name[strcspn(s[i].name, "\n")] = '\0'; // Safe newline removal
+
+ printf("Marks: ");
+ scanf("%f", &s[i].marks);
+ }
+
+ // 4. Accessing members to DISPLAY data
+ printf("\n--- Student Records ---\n");
+ printf("ID\tName\t\tMarks\n");
+ for (i = 0; i < n; i++) {
+ // Accessing using s[i].member
+ printf("%d\t%-15s\t%.2f\n", s[i].rollNo, s[i].name, s[i].marks);
+ }
+
+ return 0;
+}+
\ No newline at end of file
diff --git a/Semester_1/EduInCS Exam/Paper-2_05-03-2026/Qn-3.c b/Semester_1/EduInCS Exam/Paper-2_05-03-2026/Qn-3.c
@@ -0,0 +1,67 @@
+/*
+ * Author : Amit Dutta <amitdutta4255@gmail.com>
+ * Date : 06 Mar 2026
+ * Repo : https://github.com/notamitgamer/bsc
+ * License : MIT License (See the LICENSE file for details)
+ * Copyright (c) 2026 Amit Dutta
+ */
+
+/* Write a program to search an element from an array using linear
+search technique using malloc() and free() for memory allocation
+and deallocation. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int inputArray(int[], int);
+int linearSearch(int[], int, int);
+
+int main()
+{
+ int size, *arr = NULL;
+ printf("How many element do you want to enter: ");
+ scanf("%d", &size);
+ arr = (int *)malloc(size * sizeof(int));
+ if (arr == NULL)
+ {
+ printf("Memory allocation failed! Exiting...\n");
+ return 1;
+ }
+ int target = inputArray(arr, size);
+ int index = linearSearch(arr, size, target);
+ if (index != -1)
+ {
+ printf("\nElement %d is found at index %d.", target, index);
+ }
+ else
+ {
+ printf("\nElement %d is not found.", target);
+ }
+ free(arr);
+ return 0;
+}
+
+int inputArray(int arr[], int size)
+{
+ int i, target;
+ for (i = 0; i < size; i++)
+ {
+ printf("Enter element for position %d: ", i);
+ scanf("%d", &arr[i]);
+ }
+ printf("\nEnter the target element: ");
+ scanf("%d", &target);
+ return target;
+}
+
+int linearSearch(int arr[], int size, int target)
+{
+ for (int i = 0; i < size; i++)
+ {
+ if (arr[i] == target)
+ {
+ return i;
+ }
+ }
+ return -1;
+}+
\ No newline at end of file
diff --git a/Semester_1/EduInCS Exam/Paper-2_05-03-2026/Qn-4.c b/Semester_1/EduInCS Exam/Paper-2_05-03-2026/Qn-4.c
@@ -0,0 +1,45 @@
+/*
+ * Author : Amit Dutta <amitdutta4255@gmail.com>
+ * Date : 06 Mar 2026
+ * Repo : https://github.com/notamitgamer/bsc
+ * License : MIT License (See the LICENSE file for details)
+ * Copyright (c) 2026 Amit Dutta
+ */
+
+/* Write a program to check a string is palindrome or not using
+user-defined function. */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <ctype.h>
+
+bool isPalindrome(char str[]);
+
+int main() {
+ char str[100];
+
+ printf("Enter a string: ");
+ fgets(str, sizeof(str), stdin);
+ str[strcspn(str, "\n")] = '\0';
+ if (isPalindrome(str)) {
+ printf("\"%s\" is a palindrome.\n", str);
+ } else {
+ printf("\"%s\" is not a palindrome.\n", str);
+ }
+ return 0;
+}
+
+bool isPalindrome(char str[]) {
+ int left = 0;
+ int right = strlen(str) - 1;
+
+ while (right > left) {
+ if (tolower(str[left]) != tolower(str[right])) {
+ return false;
+ }
+ left++;
+ right--;
+ }
+ return true;
+}+
\ No newline at end of file
diff --git a/docs/index.html b/docs/index.html
@@ -585,6 +585,233 @@ int findSum(int row, int col, int arr[row][col])
</div>
</div>
+ <div class="folder-container mb-2">
+ <div class="flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-slate-100 rounded-lg transition-colors group select-none" onclick="toggleFolder(this)">
+ <svg class="chevron w-4 h-4 text-slate-400 transition-transform duration-200" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
+ </svg>
+ <svg class="folder-icon w-5 h-5 text-blue-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" />
+ </svg>
+ <span class="font-medium text-slate-700 group-hover:text-blue-600 transition-colors">Paper-2_05-03-2026</span>
+ </div>
+ <div class="hidden pl-4 mt-1 border-l-2 border-slate-100 ml-3.5">
+
+ <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1">
+ <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-EduInCS-Exam-Paper-2_05-03-2026-Qn-11-c', 'Qn-11.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/EduInCS Exam/Paper-2_05-03-2026/Qn-11.c')">
+ <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
+ </svg>
+ <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">Qn-11.c</span>
+ </div>
+ <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/EduInCS Exam/Paper-2_05-03-2026/Qn-11.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub">
+ <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg>
+ </a>
+ </div>
+ <!-- Embedded Code Storage -->
+ <div id="code-Semester_1-EduInCS-Exam-Paper-2_05-03-2026-Qn-11-c" style="display:none;">/*
+ * Author : Amit Dutta <amitdutta4255@gmail.com>
+ * Date : 06 Mar 2026
+ * Repo : https://github.com/notamitgamer/bsc
+ * License : MIT License (See the LICENSE file for details)
+ * Copyright (c) 2026 Amit Dutta
+ */
+
+/* Write a program to explain, how an array of stucture can you defined and accessed. */
+
+#include <stdio.h>
+#include <string.h>
+
+// 1. Defining the Structure
+struct Student {
+ int rollNo;
+ char name[50];
+ float marks;
+};
+
+int main() {
+ int n, i;
+
+ printf("Enter the number of students: ");
+ scanf("%d", &n);
+
+ // 2. Defining an Array of Structures
+ // This creates 'n' blocks of memory, each large enough to hold a Student
+ struct Student s[n];
+
+ // 3. Accessing members to STORE data
+ for (i = 0; i < n; i++) {
+ printf("\nEnter details for Student %d:\n", i + 1);
+ printf("Roll No: ");
+ scanf("%d", &s[i].rollNo); // Using dot (.) operator with index [i]
+
+ printf("Name: ");
+ getchar(); // To clear the newline character from buffer
+ fgets(s[i].name, sizeof(s[i].name), stdin);
+ s[i].name[strcspn(s[i].name, "\n")] = '\0'; // Safe newline removal
+
+ printf("Marks: ");
+ scanf("%f", &s[i].marks);
+ }
+
+ // 4. Accessing members to DISPLAY data
+ printf("\n--- Student Records ---\n");
+ printf("ID\tName\t\tMarks\n");
+ for (i = 0; i < n; i++) {
+ // Accessing using s[i].member
+ printf("%d\t%-15s\t%.2f\n", s[i].rollNo, s[i].name, s[i].marks);
+ }
+
+ return 0;
+}</div>
+ </div>
+
+ <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1">
+ <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-EduInCS-Exam-Paper-2_05-03-2026-Qn-3-c', 'Qn-3.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/EduInCS Exam/Paper-2_05-03-2026/Qn-3.c')">
+ <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
+ </svg>
+ <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">Qn-3.c</span>
+ </div>
+ <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/EduInCS Exam/Paper-2_05-03-2026/Qn-3.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub">
+ <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg>
+ </a>
+ </div>
+ <!-- Embedded Code Storage -->
+ <div id="code-Semester_1-EduInCS-Exam-Paper-2_05-03-2026-Qn-3-c" style="display:none;">/*
+ * Author : Amit Dutta <amitdutta4255@gmail.com>
+ * Date : 06 Mar 2026
+ * Repo : https://github.com/notamitgamer/bsc
+ * License : MIT License (See the LICENSE file for details)
+ * Copyright (c) 2026 Amit Dutta
+ */
+
+/* Write a program to search an element from an array using linear
+search technique using malloc() and free() for memory allocation
+and deallocation. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int inputArray(int[], int);
+int linearSearch(int[], int, int);
+
+int main()
+{
+ int size, *arr = NULL;
+ printf("How many element do you want to enter: ");
+ scanf("%d", &size);
+ arr = (int *)malloc(size * sizeof(int));
+ if (arr == NULL)
+ {
+ printf("Memory allocation failed! Exiting...\n");
+ return 1;
+ }
+ int target = inputArray(arr, size);
+ int index = linearSearch(arr, size, target);
+ if (index != -1)
+ {
+ printf("\nElement %d is found at index %d.", target, index);
+ }
+ else
+ {
+ printf("\nElement %d is not found.", target);
+ }
+ free(arr);
+ return 0;
+}
+
+int inputArray(int arr[], int size)
+{
+ int i, target;
+ for (i = 0; i < size; i++)
+ {
+ printf("Enter element for position %d: ", i);
+ scanf("%d", &arr[i]);
+ }
+ printf("\nEnter the target element: ");
+ scanf("%d", &target);
+ return target;
+}
+
+int linearSearch(int arr[], int size, int target)
+{
+ for (int i = 0; i < size; i++)
+ {
+ if (arr[i] == target)
+ {
+ return i;
+ }
+ }
+ return -1;
+}</div>
+ </div>
+
+ <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1">
+ <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-EduInCS-Exam-Paper-2_05-03-2026-Qn-4-c', 'Qn-4.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/EduInCS Exam/Paper-2_05-03-2026/Qn-4.c')">
+ <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
+ </svg>
+ <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">Qn-4.c</span>
+ </div>
+ <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
+ <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/EduInCS Exam/Paper-2_05-03-2026/Qn-4.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub">
+ <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg>
+ </a>
+ </div>
+ <!-- Embedded Code Storage -->
+ <div id="code-Semester_1-EduInCS-Exam-Paper-2_05-03-2026-Qn-4-c" style="display:none;">/*
+ * Author : Amit Dutta <amitdutta4255@gmail.com>
+ * Date : 06 Mar 2026
+ * Repo : https://github.com/notamitgamer/bsc
+ * License : MIT License (See the LICENSE file for details)
+ * Copyright (c) 2026 Amit Dutta
+ */
+
+/* Write a program to check a string is palindrome or not using
+user-defined function. */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <ctype.h>
+
+bool isPalindrome(char str[]);
+
+int main() {
+ char str[100];
+
+ printf("Enter a string: ");
+ fgets(str, sizeof(str), stdin);
+ str[strcspn(str, "\n")] = '\0';
+ if (isPalindrome(str)) {
+ printf("\"%s\" is a palindrome.\n", str);
+ } else {
+ printf("\"%s\" is not a palindrome.\n", str);
+ }
+ return 0;
+}
+
+bool isPalindrome(char str[]) {
+ int left = 0;
+ int right = strlen(str) - 1;
+
+ while (right > left) {
+ if (tolower(str[left]) != tolower(str[right])) {
+ return false;
+ }
+ left++;
+ right--;
+ }
+ return true;
+}</div>
+ </div>
+
+ </div>
+ </div>
+
</div>
</div>