Bangladesh Ordnance Factory
Post: Assistant Programmer and Assistant Maintenance Engineer
Exam Date: 2022, Exam Taker: MIST
Sample Output:
How Many Students? 5
Enter the Elements of the Array: 49 60 7 80 90
Average is: 69
3 Number students got above of the Average
2 number of students got below of the average.
#include <stdio.h>
#include <math.h>
int main() {
int n, i;
printf("How Many Students? ");
scanf("%d", &n);
int a[1000], sum = 0, avg, aboveAvg = 0, belowAvg = 0;
printf("Enter the Elements of the Array: \n");
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
sum += a[i];
}
avg = sum / n;
for (i = 0; i < n; i++) { if (a[i] > avg)
aboveAvg++;
else if (a[i] < avg)
belowAvg++;
}
printf("\nAverage is %d.\n", avg);
printf("%d students got above the average.\n", aboveAvg);
printf("%d students got below the average.\n", belowAvg);
return 0;
}
Sample I/O:
How Many Students? 5
Enter the Elements of the Array:
50
53
60
49
51
Average is 52.
2 students got above the average.
3 students got below the average.
=== Code Execution Successful ===
i) Network address of this network?
ii) What is the subnet mask of this Network?
iii) How many hosts can cover the network?
- Network Address: 172.3.16.0
- Subnet Mask: 255.255.254.0 or /23
- Hosts per Network: 510
- Broadcast IP Address: 172.3.17.255
- First Valid Host: 172.3.16.1
- Last Valid Host: 172.3.17.254
#include<stdio.h>
int fun(int n) {
if (n == 4)
return n;
else
return 2 * fun(n + 1);
}
int main() {
printf("%d ", fun(2));
return 0;
}
Answer: 16
Explanation:
1. Function fun is called with n = 2
– The if condition n == 4 is false.
– Therefore, it goes to the else branch: return 2 * fun(n + 1);
– This means it will call fun(3).
2. Function fun is called with n = 3
– The if condition n == 4 is false again.
– It goes to the else branch: return 2 * fun(n + 1);
– This means it will call fun(4).
3. Function fun is called with n = 4
– The if condition n == 4 is true this time.
– It returns 4.
4. Returning to the previous call where n = 3
– return 2 * fun(4) becomes return 2 * 4 which is 8.
5. Returning to the first call where n = 2
– return 2 * fun(3) becomes return 2 * 8 which is 16.
Final Output:
The final output of the program will be:
16
This is because the function keeps doubling the returned value until it reaches the base case where n == 4.
Hyper Threading
Hyper Threading (HT) is a technology developed by Intel that allows a single physical CPU core to act like two logical cores.
It enables one processor core to handle two threads at the same time, improving multitasking and overall performance.
How It Works:
In normal processors, one core executes one thread at a time. With Hyper Threading, each core creates two logical processors, allowing the CPU to process multiple tasks simultaneously.
Uses of Hyper Threading:
1. Improves Multitasking: Run multiple applications smoothly at the same time.
2. Better CPU Utilization: Makes efficient use of CPU resources by reducing idle time.
3. Faster Processing: Increases performance in tasks like video editing, gaming, programming, and data processing.
4. Enhanced Parallel Processing: Useful for applications that support multithreading.
In short, Hyper Threading increases system performance without adding extra physical cores.
Hyper Threading
Hyper Threading (HT) হলো Intel-এর একটি প্রযুক্তি, যা একটি Physical CPU Core-কে দুইটি Logical Core-এর মতো কাজ করতে দেয়।
এর মাধ্যমে একটি Core একই সাথে দুইটি Thread পরিচালনা করতে পারে, ফলে Multitasking ও Performance বৃদ্ধি পায়।
কীভাবে কাজ করে:
সাধারণ Processor-এ একটি Core এক সময়ে একটি Thread Execute করে। কিন্তু Hyper Threading প্রযুক্তিতে প্রতিটি Core দুইটি Logical Processor তৈরি করে, ফলে একাধিক কাজ একসাথে সম্পাদন করা যায়।
Hyper Threading-এর ব্যবহার:
১. Multitasking উন্নত করে: একাধিক Application একসাথে Smoothভাবে চালানো যায়।
২. CPU Utilization বৃদ্ধি: CPU-এর Idle Time কমিয়ে দক্ষ ব্যবহার নিশ্চিত করে।
৩. দ্রুত Processing: Video Editing, Gaming, Programming ও Data Processing-এ Performance বাড়ায়।
৪. Parallel Processing সমর্থন: Multithreading সমর্থিত Application-এ কার্যকর।
সংক্ষেপে, Hyper Threading অতিরিক্ত Physical Core ছাড়াই System Performance বৃদ্ধি করে।
