Loading...
National Institute of Youth Development

Post: Instructor ICT
Exam Date: 20.05.2023
1 a) Write a Program: a) Sample Output:
1
12
123
#include <stdio.h>
int main() {
int i, j, rows;
printf("Enter the number of rows: ");
scanf("%d", &rows);
for (i = 1; i <= rows; ++i) {
for (j = 1; j <= i; ++j) {
printf("%d", j);
}
printf("\n");
}

return 0;
}

Sample I/O:
Enter the number of rows: 5
1
12
123
1234
12345
=== Code Execution Successful ===
        


🔗 Run Online: Print Pattern

1. b) Sample Output:
Start
Start
Start
Start.
#include <stdio.h>
void main() {
int i, j, rows;
printf("Input number of rows: ");
scanf("%d", &rows);

for(i = 1; i <= rows; i++) {
printf("Start");
printf("\n");
}
}
2. What is virtual function?

Virtual Function

A virtual function is a member function of a class that is declared using the virtual keyword and is meant to be overridden in a derived class. It supports runtime polymorphism, meaning the function that gets executed is determined at runtime based on the object, not the pointer type.

Example (C++)

#include <iostream>
using namespace std;

class Base {
public:
    virtual void show() {
        cout << "Base class" << endl;
    }
};

class Derived : public Base {
public:
    void show() override {
        cout << "Derived class" << endl;
    }
};

int main() {
    Base* ptr;
    Derived obj;
    ptr = &obj;
    ptr->show();  // Calls Derived class function
}

Because the function is virtual, the Derived class version is called even though the pointer type is Base.

Virtual Function

Virtual function হলো একটি class-এর member function যা virtual keyword ব্যবহার করে ঘোষণা করা হয় এবং derived class-এ override করা যায়। এটি runtime polymorphism সমর্থন করে, অর্থাৎ কোন function চলবে তা runtime-এ নির্ধারিত হয় object অনুযায়ী।

উদাহরণ (C++)

#include <iostream>
using namespace std;

class Base {
public:
    virtual void show() {
        cout << "Base class" << endl;
    }
};

class Derived : public Base {
public:
    void show() override {
        cout << "Derived class" << endl;
    }
};

int main() {
    Base* ptr;
    Derived obj;
    ptr = &obj;
    ptr->show();  // Derived class function call হবে
}

এখানে function virtual হওয়ার কারণে Base pointer ব্যবহার করলেও Derived class-এর function execute হয়।

3. What is Software testing? Difference between Black box testing and White box testing.

Software Testing

Software testing is the process of evaluating and verifying that a software application works correctly according to the specified requirements. It is performed to identify bugs, errors, or defects before the software is delivered to users.

The main objective of software testing is to ensure quality, reliability, performance, and security of the software system.

Software Testing

Software testing হলো একটি প্রক্রিয়া যার মাধ্যমে যাচাই করা হয় যে কোনো software নির্ধারিত requirement অনুযায়ী সঠিকভাবে কাজ করছে কিনা। ব্যবহারকারীর কাছে দেওয়ার আগে bug বা error শনাক্ত করার জন্য এটি করা হয়।

Software testing-এর মূল উদ্দেশ্য হলো software-এর quality, reliability, performance এবং security নিশ্চিত করা।

4. Define copy constructor. What Static binding and Dynamic binding?

Copy Constructor

A copy constructor is a special constructor in a class that initializes a new object using another object of the same class. It is mainly used to create a copy of an existing object.

Example (C++):

class Sample {
public:
    int x;
    Sample(int a) { x = a; }
    Sample(const Sample &obj) { x = obj.x; }
};

Static Binding (Early Binding)

Static binding occurs when the function call is resolved at compile time. The compiler determines which function to execute based on the reference type of the object. It does not depend on the actual object at runtime.

Static binding usually happens in function overloading, normal member functions, and when virtual keyword is not used. It is faster because the decision is made during compilation.

Example: If a base class pointer calls a non-virtual function, the base class version will execute even if it points to a derived object.

Dynamic Binding (Late Binding)

Dynamic binding occurs when the function call is resolved at runtime. The decision of which function to execute depends on the actual object, not the reference type.

Dynamic binding happens when virtual functions are used. It supports runtime polymorphism and allows method overriding to work properly.

Example: If a base class pointer calls a virtual function, the derived class version will execute if the object belongs to the derived class.

Copy Constructor

Copy constructor হলো একটি বিশেষ constructor যা একই class-এর অন্য একটি object ব্যবহার করে নতুন object তৈরি করে। এটি মূলত একটি existing object-এর copy তৈরি করতে ব্যবহৃত হয়।

উদাহরণ (C++):

class Sample {
public:
    int x;
    Sample(int a) { x = a; }
    Sample(const Sample &obj) { x = obj.x; }
};

Static Binding (Early Binding)

Static binding তখন ঘটে যখন function call compile time-এই নির্ধারিত হয়। Compiler reference type দেখে ঠিক করে কোন function execute হবে। Runtime-এ actual object অনুযায়ী এটি পরিবর্তন হয় না।

সাধারণ function, function overloading এবং virtual keyword ব্যবহার না করলে static binding ঘটে। এটি তুলনামূলক দ্রুত, কারণ compile time-এই সিদ্ধান্ত নেওয়া হয়।

উদাহরণ: Base class pointer যদি non-virtual function call করে, তাহলে Derived object হলেও Base class-এর function-ই execute হবে।

Dynamic Binding (Late Binding)

Dynamic binding তখন ঘটে যখন function call runtime-এ নির্ধারিত হয়। এখানে কোন function চলবে তা actual object-এর উপর নির্ভর করে।

Virtual function ব্যবহার করলে dynamic binding ঘটে। এটি runtime polymorphism সমর্থন করে এবং method overriding সঠিকভাবে কাজ করতে সাহায্য করে।

উদাহরণ: Base pointer যদি virtual function call করে এবং object যদি Derived class-এর হয়, তাহলে Derived class-এর function execute হবে।

5. Define primary key, super key, and Candidate key.

Primary Key, Super Key and Candidate Key

Super Key

A Super Key is any attribute or set of attributes that can uniquely identify a record in a table. It may contain extra attributes that are not necessary for unique identification.

Example: In a Student table (Student_ID, Email, Name), {Student_ID}, {Email}, and {Student_ID, Name} are Super Keys because they uniquely identify each student.

Candidate Key

A Candidate Key is a minimal Super Key. It contains only the necessary attributes required to uniquely identify a record, without any extra attributes.

Example: In the Student table, {Student_ID} and {Email} are Candidate Keys because both uniquely identify students and have no unnecessary attributes.

Primary Key

A Primary Key is one Candidate Key selected to uniquely identify records in a table. It cannot contain NULL or duplicate values.

Example: If {Student_ID} is chosen among candidate keys, then Student_ID becomes the Primary Key.

Primary Key, Super Key এবং Candidate Key

Super Key

Super Key হলো এমন attribute বা attribute-এর সমষ্টি যা একটি table-এর প্রতিটি record-কে uniquely শনাক্ত করতে পারে। এতে অতিরিক্ত attribute থাকতে পারে যা প্রয়োজনীয় নয়।

উদাহরণ: Student table (Student_ID, Email, Name)-এ {Student_ID}, {Email}, এবং {Student_ID, Name} হলো Super Key।

Candidate Key

Candidate Key হলো minimal Super Key। এতে শুধুমাত্র প্রয়োজনীয় attribute থাকে যা একটি record-কে uniquely শনাক্ত করে, অতিরিক্ত কিছু থাকে না।

উদাহরণ: Student table-এ {Student_ID} এবং {Email} Candidate Key, কারণ উভয়ই unique এবং অতিরিক্ত attribute নেই।

Primary Key

Primary Key হলো Candidate Key-এর মধ্যে থেকে নির্বাচিত একটি key যা table-এর record-কে uniquely শনাক্ত করে। এতে NULL বা duplicate value থাকতে পারে না।

উদাহরণ: যদি {Student_ID} নির্বাচন করা হয়, তাহলে Student_ID হবে Primary Key।

You must subscribe & Login to view more.

Don’t have an account? Register

Or your subscription is under review by admin. Please message on WhatsApp / Telegram.

Leave a Comment

Latest Post
Field Based Job Question & Solution
Bank IT Job Solution

MCQ + Written from Bangladesh Bank, Sonali, Combined Bank IT recruitment.

BPSC IT Job Solution

BPSC Computer/IT cadre & non-cadre post Question papers with full solutions.

Gas Field IT Job Solution

Gas field like TGTDCL, BGDCL, JGTDSL, KGDCL, SGCL, RPGCL, GTCL etc. question solution

Power Sector IT Job Solution

Power sector such as NESCO, DESCO, DPDC, WZPDCL, BPDB, PGCB, BREB etc

Other IT Job Solution

Other Govt. Semi govt. organization like BCC, BTCL, CAAB, NSI etc.

NTRCA IT Job Solution (upcoming)

NTRCA ICT-related posts such as Assistant Teacher, Demonstrator, Lecturer.

IT MCQ Job Solution

Collected MCQ Job solution of BANK, BPSC, POWER SECTOR, GAS Field and Others.

Topic Based Q&S
WhatsApp Telegram Messenger