National Skills Development Authority

Post: Assistant Programmer
Exam Date: 04/03/2022, Exam Taker: MIST
1. Write an algorithm to check if a given number is prime or not.

Step 1: Start
Step 2: Read number n
Step 3: Set f = 0
Step 4: For i = 2 to n – 1
Step 5: If n mod i = 0 then
 Set f = 1 and break
Step 6: Loop
Step 7: If f = 0 then
 Print ‘The given number is prime’
Else
 Print ‘The given number is not prime’
Step 8: Stop

2 a) Output Tracing:
char str[20] = "Development";
str[5] = '\0';
int len = strlen(str);
printf("%s", str);

Output: Devel

2 b) Output Tracing:
int i;
for (i = 0; i < 9; i++) {
if (i == 5)
continue;
printf("%d\n", i);
}

Output: 0 1 2 3 4 6 7 8

3.Write a program which takes 'n' as input and calculates all the odd numbers up to n:
#include <stdio.h>
#include <math.h>
int main() {
    int i, sum = 0;
    printf("Enter the Value of N: \\n");
    scanf("%d", &n);
    printf("The Odd Numbers are: \\n");
    for (i = 1; i <= n; i++) {
        if (i % 2 != 0) {
            printf("%d ", i);
            sum += i;
        }
    }
    printf("\\nThe Sum of Odd Numbers up to %d: %d\\n", n, sum);
    return 0;
}

Output:

Enter the Value of N: 10
The Odd Numbers are: 1 3 5 7 9
The Sum of Odd Numbers up to 10: 25

4. In IPv4 Mention the Maximum Number of Networks and Hosts Used in Class A, B, and C Networks:
Class of IPMaximum Number of NetworksMaximum Number of Hosts
Class A27224 – 2
Class B214216 – 2
Class C22128 – 2
5. Find out the following items of IP Address: 192,168.5.154/26

Non Technical

সাধারন অংশ (৩০) Bangla

১)সন্ধি বিচ্ছেদ করুন(৫); ২) ব্যাস বাক্যসহ সমাস নির্ণয়(৫)

English

৩)B2E Translation(৫); ৪) Transformation of Sentence(৫)

GK

৫) গ্রীন পিস কী? (২)
৬) সুষম খাদ্যের উপাদান কয়টি?(২)
৭) বংবন্ধুর ঐতিহাসিক ৭ই মার্চের ভাষণ ইউনেস্কো কত তারিখে মেমোরি অব দ্য ওয়ার্ল্ড ইন্টারন্যাসশনাল রেজিস্টারে অন্তর্ভুক্ত করে? (২)
8) রুপকল্প ২০৪১ বলতে কী বুঝায়?

Leave a Comment

WhatsApp Telegram Messenger